class_docstr: The label model by `FlyingSquid <https://github.com/HazyResearch/flyingsquid>`__.
  
  .. 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.
      **kwargs: Passed on to the init of the FlyingSquid's
          `LabelModel <https://github.com/HazyResearch/flyingsquid/blob/master/flyingsquid/label_model.py#L18>`__.
  
  Examples:
      >>> from argilla.labeling.text_classification import WeakLabels
      >>> weak_labels = WeakLabels(dataset="my_dataset")
      >>> label_model = FlyingSquid(weak_labels)
      >>> label_model.fit()
      >>> records = label_model.predict()
class_docstr_tok: ["The","label","model","by","`","FlyingSquid","<","https",":","\/\/github.com\/HazyResearch\/flyingsquid",">","`","__",".","..","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",".","*","*","kwargs",":","Passed","on","to","the","init","of","the","FlyingSquid's","`","LabelModel","<","https",":","\/\/github.com\/HazyResearch\/flyingsquid\/blob\/master\/flyingsquid\/label_model.py","#","L18",">","`","__",".","Examples",":",">",">",">","from","argilla.labeling.text_classification","import","WeakLabels",">",">",">","weak_labels","=","WeakLabels","(","dataset=","''","my_dataset","''",")",">",">",">","label_model","=","FlyingSquid","(","weak_labels",")",">",">",">","label_model.fit","(",")",">",">",">","records","=","label_model.predict","(",")"]
docstr: Helper function that calls the ``predict_proba`` method of FlyingSquid's label model.
  
  Much of the implementation is taken from wrench:
  https://github.com/JieyuZ2/wrench/blob/main/wrench/labelmodel/flyingsquid.py
  
  Args:
      weak_label_matrix: The weak label matrix.
      verbose: If True, print out messages of the progress to stderr.
  
  Returns:
      A matrix containing the probability for each label and record.
  
  Raises:
      NotFittedError: If the label model was still not fitted.
docstr_tok: ["Helper","function","that","calls","the","``","predict_proba","``","method","of","FlyingSquid","'s","label","model",".","Much","of","the","implementation","is","taken","from","wrench",":","https",":","\/\/github.com\/JieyuZ2\/wrench\/blob\/main\/wrench\/labelmodel\/flyingsquid.py","Args",":","weak_label_matrix",":","The","weak","label","matrix",".","verbose",":","If","True",",","print","out","messages","of","the","progress","to","stderr",".","Returns",":","A","matrix","containing","the","probability","for","each","label","and","record",".","Raises",":","NotFittedError",":","If","the","label","model","was","still","not","fitted","."]
code: def _predict(
      self, weak_label_matrix: np.ndarray, verbose: bool
  ) -> np.ndarray:
      """Helper function that calls the ``predict_proba`` method of FlyingSquid's label model.
  
      Much of the implementation is taken from wrench:
      https://github.com/JieyuZ2/wrench/blob/main/wrench/labelmodel/flyingsquid.py
  
      Args:
          weak_label_matrix: The weak label matrix.
          verbose: If True, print out messages of the progress to stderr.
  
      Returns:
          A matrix containing the probability for each label and record.
  
      Raises:
          NotFittedError: If the label model was still not fitted.
      """
      if not self._models:
          raise NotFittedError(
              "This FlyingSquid instance is not fitted yet. Call `fit` before using this model."
          )
      # create predictions for each label
      if self._weak_labels.cardinality > 2:
          probas = np.zeros(
              (len(weak_label_matrix), self._weak_labels.cardinality)
          )
          for i in range(self._weak_labels.cardinality):
              wl_matrix_i = self._copy_and_transform_wl_matrix(
                  weak_label_matrix, i
              )
              probas[:, i] = self._models[i].predict_proba(
                  L_matrix=wl_matrix_i, verbose=verbose
              )[:, 0]
          probas = np.nan_to_num(probas, nan=-np.inf)  # handle NaN
          probas = np.exp(probas) / np.sum(
              np.exp(probas), axis=1, keepdims=True
          )
      # if binary, we only have one model
      else:
          wl_matrix_i = self._copy_and_transform_wl_matrix(
              weak_label_matrix, 0
          )
          probas = self._models[0].predict_proba(
              L_matrix=wl_matrix_i, verbose=verbose
          )
  
      return probas
  
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 FlyingSquid obj's underlying member method code with example usage: obj._predict(weak_label_matrix, verbose) and returns: probas