class_docstr: The label model by `Snorkel <https://github.com/snorkel-team/snorkel/>`__.
  
  .. note:: It is not suited for multi-label classification and does not support it!
  
  Args:
      weak_labels: A `WeakLabels` object containing the weak labels and records.
      verbose: Whether to show print statements
      device: What device to place the model on ('cpu' or 'cuda:0', for example).
          Passed on to the `torch.Tensor.to()` calls.
  
  Examples:
      >>> from argilla.labeling.text_classification import WeakLabels
      >>> weak_labels = WeakLabels(dataset="my_dataset")
      >>> label_model = Snorkel(weak_labels)
      >>> label_model.fit()
      >>> records = label_model.predict()
class_docstr_tok: ["The","label","model","by","`","Snorkel","<","https",":","\/\/github.com\/snorkel-team\/snorkel\/",">","`","__",".","..","note",":",":","It","is","not","suited","for","multi-label","classification","and","does","not","support","it","!","Args",":","weak_labels",":","A","`","WeakLabels","`","object","containing","the","weak","labels","and","records",".","verbose",":","Whether","to","show","print","statements","device",":","What","device","to","place","the","model","on","(","'cpu","'","or","'cuda:0","'",",","for","example",")",".","Passed","on","to","the","`","torch.Tensor.to","(",")","`","calls",".","Examples",":",">",">",">","from","argilla.labeling.text_classification","import","WeakLabels",">",">",">","weak_labels","=","WeakLabels","(","dataset=","''","my_dataset","''",")",">",">",">","label_model","=","Snorkel","(","weak_labels",")",">",">",">","label_model.fit","(",")",">",">",">","records","=","label_model.predict","(",")"]
docstr: Returns some scores/metrics of the label model with respect to the annotated records.
  
  The metrics are:
  
  - accuracy
  - micro/macro averages for precision, recall and f1
  - precision, recall, f1 and support for each label
  
  For more details about the metrics, check out the
  `sklearn docs <https://scikit-learn.org/stable/modules/generated/sklearn.metrics.precision_recall_fscore_support.html#sklearn-metrics-precision-recall-fscore-support>`__.
  
  .. note:: Metrics are only calculated over non-abstained predictions!
  
  Args:
      tie_break_policy: Policy to break ties. You can choose among three policies:
  
          - `abstain`: Do not provide any prediction
          - `random`: randomly choose among tied option using deterministic hash
          - `true-random`: randomly choose among the tied options. NOTE: repeated runs may have slightly different results due to differences in broken ties
  
          The last two policies 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.
      output_str: If True, return output as nicely formatted string.
  
  Returns:
      The scores/metrics in a dictionary or as a nicely formatted str.
  
  Raises:
      MissingAnnotationError: If the ``weak_labels`` do not contain annotated records.
docstr_tok: ["Returns","some","scores\/metrics","of","the","label","model","with","respect","to","the","annotated","records",".","The","metrics","are",":","-","accuracy","-","micro\/macro","averages","for","precision",",","recall","and","f1","-","precision",",","recall",",","f1","and","support","for","each","label","For","more","details","about","the","metrics",",","check","out","the","`","sklearn","docs","<","https",":","\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.metrics.precision_recall_fscore_support.html","#","sklearn-metrics-precision-recall-fscore-support",">","`","__",".","..","note",":",":","Metrics","are","only","calculated","over","non-abstained","predictions","!","Args",":","tie_break_policy",":","Policy","to","break","ties",".","You","can","choose","among","three","policies",":","-","`","abstain","`",":","Do","not","provide","any","prediction","-","`","random","`",":","randomly","choose","among","tied","option","using","deterministic","hash","-","`","true-random","`",":","randomly","choose","among","the","tied","options",".","NOTE",":","repeated","runs","may","have","slightly","different","results","due","to","differences","in","broken","ties","The","last","two","policies","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",".","output_str",":","If","True",",","return","output","as","nicely","formatted","string",".","Returns",":","The","scores\/metrics","in","a","dictionary","or","as","a","nicely","formatted","str",".","Raises",":","MissingAnnotationError",":","If","the","``","weak_labels","``","do","not","contain","annotated","records","."]
code: def score(
      self,
      tie_break_policy: Union[TieBreakPolicy, str] = "abstain",
      output_str: bool = False,
  ) -> Union[Dict[str, float], str]:
      """Returns some scores/metrics of the label model with respect to the annotated records.
  
      The metrics are:
  
      - accuracy
      - micro/macro averages for precision, recall and f1
      - precision, recall, f1 and support for each label
  
      For more details about the metrics, check out the
      `sklearn docs <https://scikit-learn.org/stable/modules/generated/sklearn.metrics.precision_recall_fscore_support.html#sklearn-metrics-precision-recall-fscore-support>`__.
  
      .. note:: Metrics are only calculated over non-abstained predictions!
  
      Args:
          tie_break_policy: Policy to break ties. You can choose among three policies:
  
              - `abstain`: Do not provide any prediction
              - `random`: randomly choose among tied option using deterministic hash
              - `true-random`: randomly choose among the tied options. NOTE: repeated runs may have slightly different results due to differences in broken ties
  
              The last two policies 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.
          output_str: If True, return output as nicely formatted string.
  
      Returns:
          The scores/metrics in a dictionary or as a nicely formatted str.
  
      Raises:
          MissingAnnotationError: If the ``weak_labels`` do not contain annotated records.
      """
      from sklearn.metrics import classification_report
  
      if isinstance(tie_break_policy, str):
          tie_break_policy = TieBreakPolicy(tie_break_policy)
  
      if self._weak_labels.annotation().size == 0:
          raise MissingAnnotationError(
              "You need annotated records to compute scores/metrics for your label model."
          )
  
      l_pred = self._weak_labels.matrix(has_annotation=True)
      if self._need_remap:
          l_pred = self._copy_and_remap(l_pred)
  
      # get predictions and probabilities
      predictions, probabilities = self._model.predict(
          L=l_pred,
          return_probs=True,
          tie_break_policy=tie_break_policy.value,
      )
  
      # metrics are only calculated for non-abstained data points
      idx = predictions != -1
  
      annotation = self._weak_labels.annotation()[idx]
      if self._need_remap:
          annotation = self._copy_and_remap(annotation)
  
      return classification_report(
          annotation,
          predictions[idx],
          target_names=self._weak_labels.labels[: annotation.max() + 1],
          output_dict=not output_str,
      )
  
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 Snorkel obj's underlying member method code with example usage: obj.score(tie_break_policy, output_str) and returns: classification_report