class_docstr: A basic label model that computes the majority vote across all rules.
  
  For single-label classification, it will predict the label with the most votes.
  For multi-label classification, it will predict all labels that got at least one vote by the rules.
  
  Args:
      weak_labels: The weak labels object.
class_docstr_tok: ["A","basic","label","model","that","computes","the","majority","vote","across","all","rules",".","For","single-label","classification",",","it","will","predict","the","label","with","the","most","votes",".","For","multi-label","classification",",","it","will","predict","all","labels","that","got","at","least","one","vote","by","the","rules",".","Args",":","weak_labels",":","The","weak","labels","object","."]
docstr: Helper method to compute scores for single-label classifications.
  
  Args:
      probabilities: The probabilities.
      tie_break_policy: Policy to break ties. You can choose among two policies:
  
          - `abstain`: Exclude from scores.
          - `random`: randomly choose among tied option using deterministic hash.
  
          The last policy can introduce quite a bit of noise, especially when the tie is among many labels,
          as is the case when all the labeling functions (rules) abstained.
  
  Returns:
      A tuple of the annotation and prediction array.
docstr_tok: ["Helper","method","to","compute","scores","for","single-label","classifications",".","Args",":","probabilities",":","The","probabilities",".","tie_break_policy",":","Policy","to","break","ties",".","You","can","choose","among","two","policies",":","-","`","abstain","`",":","Exclude","from","scores",".","-","`","random","`",":","randomly","choose","among","tied","option","using","deterministic","hash",".","The","last","policy","can","introduce","quite","a","bit","of","noise",",","especially","when","the","tie","is","among","many","labels",",","as","is","the","case","when","all","the","labeling","functions","(","rules",")","abstained",".","Returns",":","A","tuple","of","the","annotation","and","prediction","array","."]
code: def _score_single_label(
      self, probabilities: np.ndarray, tie_break_policy: TieBreakPolicy
  ) -> Tuple[np.ndarray, np.ndarray]:
      """Helper method to compute scores for single-label classifications.
  
      Args:
          probabilities: The probabilities.
          tie_break_policy: Policy to break ties. You can choose among two policies:
  
              - `abstain`: Exclude from scores.
              - `random`: randomly choose among tied option using deterministic hash.
  
              The last policy can introduce quite a bit of noise, especially when the tie is among many labels,
              as is the case when all the labeling functions (rules) abstained.
  
      Returns:
          A tuple of the annotation and prediction array.
      """
      # 1.e-8 is taken from the abs tolerance of np.isclose
      is_max = (
          np.abs(
              probabilities.max(axis=1, keepdims=True) - probabilities
          )
          < 1.0e-8
      )
      is_tie = is_max.sum(axis=1) > 1
  
      prediction = np.argmax(is_max, axis=1)
      # we need to transform the indexes!
      annotation = np.array(
          [
              self._weak_labels.labels.index(
                  self._weak_labels.int2label[i]
              )
              for i in self._weak_labels.annotation()
          ],
          dtype=np.short,
      )
  
      if not is_tie.any():
          pass
      # resolve ties
      elif tie_break_policy is TieBreakPolicy.ABSTAIN:
          prediction, annotation = (
              prediction[~is_tie],
              annotation[~is_tie],
          )
      elif tie_break_policy is TieBreakPolicy.RANDOM:
          for i in np.nonzero(is_tie)[0]:
              equal_prob_idx = np.nonzero(is_max[i])[0]
              random_idx = int(
                  hashlib.sha1(f"{i}".encode()).hexdigest(), 16
              ) % len(equal_prob_idx)
              prediction[i] = equal_prob_idx[random_idx]
      else:
          raise NotImplementedError(
              f"The tie break policy '{tie_break_policy.value}' is not implemented for MajorityVoter!"
          )
  
      return annotation, prediction
  
imports: import hashlib
  import logging
  from enum import Enum
  from typing import Dict, List, Tuple, Union
  import numpy
  from argilla import DatasetForTextClassification, TextClassificationRecord
  from argilla.labeling.text_classification.weak_labels import WeakLabels, WeakMultiLabels
  from argilla.utils.dependency import requires_dependencies
label_desc: Use image node_id 9 for calling the MajorityVoter obj's underlying member method code with example usage: obj._score_single_label(probabilities, tie_break_policy) and returns: annotation,  prediction