class_docstr: Class implements probability to labels processing using the following ways:      choosing one or top_n indices with maximal probability or choosing any number of indices       which probabilities to belong with are higher than given confident threshold
  
  Args:
      max_proba: whether to choose label with maximal probability
      confidence_threshold: boundary probability value for sample to belong with the class (best use for multi-label)
      top_n: how many top labels with the highest probabilities to return
  
  Attributes:
      max_proba: whether to choose label with maximal probability
      confidence_threshold: boundary probability value for sample to belong with the class (best use for multi-label)
      top_n: how many top labels with the highest probabilities to return
docstr: Process probabilities to labels
  Args:
      Every argument is a list of vectors with probability distribution
  Returns:
      list of labels (only label classification) or list of lists of labels (multi-label classification),
      or list of the following lists (in multitask setting) for every argument
docstr_tok: ["Process","probabilities","to","labels","Args",":","Every","argument","is","a","list","of","vectors","with","probability","distribution","Returns",":","list","of","labels","(","only","label","classification",")","or","list","of","lists","of","labels","(","multi-label","classification",")",",","or","list","of","the","following","lists","(","in","multitask","setting",")","for","every","argument"]
code: def __call__(self, *args, **kwargs):
      """
      Process probabilities to labels
      Args:
          Every argument is a list of vectors with probability distribution
      Returns:
          list of labels (only label classification) or list of lists of labels (multi-label classification),
          or list of the following lists (in multitask setting) for every argument
      """
      answer = []
      log.debug(f"input {args}")
      for data in args:
          if all([k is None for k in data]):
              answer.append([])
          elif self.confidence_threshold:
              if self.is_binary:
                  answer.append(
                      [
                          int(el > self.confidence_threshold)
                          for el in data
                      ]
                  )
              else:
                  answer.append(
                      [
                          list(
                              np.where(
                                  np.array(d)
                                  > self.confidence_threshold
                              )[0]
                          )
                          for d in data
                      ]
                  )
          elif self.max_proba:
              answer.append([np.argmax(d) for d in data])
          elif self.top_n:
              answer.append(
                  [np.argsort(d)[::-1][: self.top_n] for d in data]
              )
          else:
              raise ConfigError(
                  "Proba2Labels requires one of three arguments: bool `max_proba` or "
                  "float `confidence_threshold` for multi-label classification or"
                  "integer `top_n` for choosing several labels with the highest probabilities"
              )
      if len(args) == 1:  # only one argument
          answer = answer[0]
      log.debug(f"output {answer}")
      return answer
  
file_path: DeepPavlov/deeppavlov/models/classifiers/proba2labels.py
imports: from logging import getLogger
  import numpy
  from deeppavlov.core.common.errors import ConfigError
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.models.component import Component
label_desc: Use image node_id 2 for calling the Proba2Labels obj's underlying member method code with example usage: obj.__call__() and returns: answer