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 create records given predicted probabilities.
  
  Args:
      probabilities: The predicted probabilities.
      records: The records associated with the probabilities.
      include_abstentions: Whether to include records in the output, for which the label model abstained.
      prediction_agent: String used for the ``prediction_agent`` in the returned records.
      tie_break_policy: Policy to break ties. You can choose among two policies:
  
          - `abstain`: Do not provide any prediction
          - `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 list of records that include the predictions of the label model.
docstr_tok: ["Helper","method","to","create","records","given","predicted","probabilities",".","Args",":","probabilities",":","The","predicted","probabilities",".","records",":","The","records","associated","with","the","probabilities",".","include_abstentions",":","Whether","to","include","records","in","the","output",",","for","which","the","label","model","abstained",".","prediction_agent",":","String","used","for","the","``","prediction_agent","``","in","the","returned","records",".","tie_break_policy",":","Policy","to","break","ties",".","You","can","choose","among","two","policies",":","-","`","abstain","`",":","Do","not","provide","any","prediction","-","`","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","list","of","records","that","include","the","predictions","of","the","label","model","."]
code: def _make_single_label_records(
      self,
      probabilities: np.ndarray,
      records: List[TextClassificationRecord],
      include_abstentions: bool,
      prediction_agent: str,
      tie_break_policy: TieBreakPolicy,
  ) -> List[TextClassificationRecord]:
      """Helper method to create records given predicted probabilities.
  
      Args:
          probabilities: The predicted probabilities.
          records: The records associated with the probabilities.
          include_abstentions: Whether to include records in the output, for which the label model abstained.
          prediction_agent: String used for the ``prediction_agent`` in the returned records.
          tie_break_policy: Policy to break ties. You can choose among two policies:
  
              - `abstain`: Do not provide any prediction
              - `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 list of records that include the predictions of the label model.
      """
      records_with_prediction = []
      for i, prob, rec in zip(
          range(len(records)), probabilities, records
      ):
          # Check if model abstains, that is if the highest probability is assigned to more than one label
          # 1.e-8 is taken from the abs tolerance of np.isclose
          equal_prob_idx = np.nonzero(
              np.abs(prob.max() - prob) < 1.0e-8
          )[0]
          tie = False
          if len(equal_prob_idx) > 1:
              tie = True
  
          # maybe skip record
          if not include_abstentions and (
              tie and tie_break_policy is TieBreakPolicy.ABSTAIN
          ):
              continue
  
          if not tie:
              pred_for_rec = [
                  (self._weak_labels.labels[idx], prob[idx])
                  for idx in np.argsort(prob)[::-1]
              ]
          # resolve ties following the tie break policy
          elif tie_break_policy is TieBreakPolicy.ABSTAIN:
              pred_for_rec = None
          elif tie_break_policy is TieBreakPolicy.RANDOM:
              random_idx = int(
                  hashlib.sha1(f"{i}".encode()).hexdigest(), 16
              ) % len(equal_prob_idx)
              for idx in equal_prob_idx:
                  if idx == random_idx:
                      prob[
                          idx
                      ] += self._PROBABILITY_INCREASE_ON_TIE_BREAK
                  else:
                      prob[
                          idx
                      ] -= self._PROBABILITY_INCREASE_ON_TIE_BREAK / (
                          len(equal_prob_idx) - 1
                      )
              pred_for_rec = [
                  (self._weak_labels.labels[idx], prob[idx])
                  for idx in np.argsort(prob)[::-1]
              ]
          else:
              raise NotImplementedError(
                  f"The tie break policy '{tie_break_policy.value}' is not"
                  f" implemented for {self.__class__.__name__}!"
              )
  
          records_with_prediction.append(rec.copy(deep=True))
          records_with_prediction[-1].prediction = pred_for_rec
          records_with_prediction[
              -1
          ].prediction_agent = prediction_agent
  
      return records_with_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 5 for calling the MajorityVoter obj's underlying member method code with example usage: obj._make_single_label_records(probabilities, records, include_abstentions, prediction_agent, tie_break_policy) and returns: records_with_prediction