class_docstr: Class for finding label issues in big datasets where memory becomes a problem for other cleanlab methods.
  Only create one such object per dataset and do not try to use the same ``LabelInspector`` across 2 datasets.
  For efficiency, this class does little input checking.
  You can first run :py:func:`filter.find_label_issues <cleanlab.filter.find_label_issues>`
  on a small subset of your data to verify your inputs are properly formatted.
  Do NOT modify any of the attributes of this class yourself!
  Multi-label classification is not supported by this class, it is only for multi-class classification.
  
  The recommended usage demonstrated in the examples script below involves two passes over your data:
  one pass to compute `confident_thresholds`, another to evaluate each label.
  To maximize efficiency, try to use the largest batch_size your memory allows.
  To reduce runtime further, you can run the first pass on a subset of your dataset
  as long as it contains enough data from each class to estimate `confident_thresholds` accurately.
  
  In the examples script below:
  - `labels` is a (big) 1D ``np.ndarray`` of class labels represented as integers in ``0,1,...,K-1``.
  - ``pred_probs`` = is a (big) 2D ``np.ndarray`` of predicted class probabilities,
  where each row is an example, each column represents a class.
  
  `labels` and `pred_probs` can be stored in a file instead where you load chunks of them at a time.
  Methods to load arrays in chunks include: ``np.load(...,mmap_mode='r')``, ``numpy.memmap()``,
  HDF5 or Zarr files, see: https://pythonspeed.com/articles/mmap-vs-zarr-hdf5/
  
  Examples
  --------
  >>> n = len(labels)
  >>> batch_size = 10000  # you can change this in between batches, set as big as your RAM allows
  >>> lab = LabelInspector(num_class = pred_probs.shape[1])
  >>> # First compute confident thresholds (for faster results, can also do this on a random subset of your data):
  >>> i = 0
  >>> while i < n:
  >>>     end_index = i + batch_size
  >>>     labels_batch = labels[i:end_index]
  >>>     pred_probs_batch = pred_probs[i:end_index,:]
  >>>     i = end_index
  >>>     lab.update_confident_thresholds(labels_batch, pred_probs_batch)
  >>> # See what we calculated:
  >>> confident_thresholds = lab.get_confident_thresholds()
  >>> # Evaluate the quality of the labels (run this on full dataset you want to evaluate):
  >>> i = 0
  >>> while i < n:
  >>>     end_index = i + batch_size
  >>>     labels_batch = labels[i:end_index]
  >>>     pred_probs_batch = pred_probs[i:end_index,:]
  >>>     i = end_index
  >>>     batch_results = lab.score_label_quality(labels_batch, pred_probs_batch)
  >>> # Indices of examples with label issues, sorted by label quality score (most severe to least severe):
  >>> indices_of_examples_with_issues = lab.get_label_issues()
  >>> # If your `pred_probs` and `labels` are arrays already in memory,
  >>> # then you can use this shortcut for all of the above:
  >>> indices_of_examples_with_issues = find_label_issues_batched(labels, pred_probs, batch_size=10000)
  
  Parameters
  ----------
  num_class : int
    The number of classes in your multi-class classification task.
  
  store_results : bool, optional
    Whether this object will store all label quality scores, a 1D array of shape ``(N,)``
    where ``N`` is the total number of examples in your dataset.
    Set this to False if you encounter memory problems even for small batch sizes (~1000).
    If ``False``, you can still identify the label issues yourself by aggregating
    the label quality scores for each batch, sorting them across all batches, and returning the top ``T`` indices
    with ``T = self.get_num_issues()``.
  
  verbose : bool, optional
    Whether to suppress print statements or not.
  
  n_jobs: int, optional
    Number of processes for multiprocessing (default value = 1). Only used on Linux.
    If `n_jobs=None`, will use either the number of: physical cores if psutil is installed, or logical cores otherwise.
  
  quality_score_kwargs : dict, optional
    Keyword arguments to pass into :py:func:`rank.get_label_quality_scores <cleanlab.rank.get_label_quality_scores>`.
  
  num_issue_kwargs : dict, optional
    Keyword arguments to :py:func:`count.num_label_issues <cleanlab.count.num_label_issues>`
    to control estimation of the number of label issues.
    The only supported kwarg here for now is: `estimation_method`.
docstr: Scores the label quality of each example in the provided batch of data,
  and also updates the number of label issues stored in this class.
  Inputs should be in same format as for: :py:func:`rank.get_label_quality_scores <cleanlab.rank.get_label_quality_scores>`.
  
  Parameters
  ----------
  labels: np.ndarray
    Given class labels for each example in the batch, values in ``0,1,2,...,K-1``.
  
  pred_probs: np.ndarray
    2D array of model-predicted class probabilities for each example in the batch of data.
  
  update_num_issues: bool, optional
    Whether or not to update the number of label issues or only compute label quality scores.
    For lower runtimes, set this to ``False`` if you only want to score label quality and not find label issues.
  
  Returns
  -------
  label_quality_scores : np.ndarray
    Contains one score (between 0 and 1) for each example in the batch of data.
docstr_tok: ["Scores","the","label","quality","of","each","example","in","the","provided","batch","of","data",",","and","also","updates","the","number","of","label","issues","stored","in","this","class",".","Inputs","should","be","in","same","format","as","for",":",":","py",":","func",":","`","rank.get_label_quality_scores","<","cleanlab.rank.get_label_quality_scores",">","`",".","Parameters","--","--","--","--","--","labels",":","np.ndarray","Given","class","labels","for","each","example","in","the","batch",",","values","in","``","0,1,2",",","...",",","K-1","``",".","pred_probs",":","np.ndarray","2D","array","of","model-predicted","class","probabilities","for","each","example","in","the","batch","of","data",".","update_num_issues",":","bool",",","optional","Whether","or","not","to","update","the","number","of","label","issues","or","only","compute","label","quality","scores",".","For","lower","runtimes",",","set","this","to","``","False","``","if","you","only","want","to","score","label","quality","and","not","find","label","issues",".","Returns","--","--","--","-","label_quality_scores",":","np.ndarray","Contains","one","score","(","between","0","and","1",")","for","each","example","in","the","batch","of","data","."]
code: def score_label_quality(
      self,
      labels: LabelLike,
      pred_probs: np.ndarray,
      *,
      update_num_issues: bool = True,
  ) -> np.ndarray:
      """
      Scores the label quality of each example in the provided batch of data,
      and also updates the number of label issues stored in this class.
      Inputs should be in same format as for: :py:func:`rank.get_label_quality_scores <cleanlab.rank.get_label_quality_scores>`.
  
      Parameters
      ----------
      labels: np.ndarray
        Given class labels for each example in the batch, values in ``0,1,2,...,K-1``.
  
      pred_probs: np.ndarray
        2D array of model-predicted class probabilities for each example in the batch of data.
  
      update_num_issues: bool, optional
        Whether or not to update the number of label issues or only compute label quality scores.
        For lower runtimes, set this to ``False`` if you only want to score label quality and not find label issues.
  
      Returns
      -------
      label_quality_scores : np.ndarray
        Contains one score (between 0 and 1) for each example in the batch of data.
      """
      labels = _batch_check(labels, pred_probs, self.num_class)
      batch_size = len(labels)
      scores = _compute_label_quality_scores(
          labels,
          pred_probs,
          confident_thresholds=self.get_confident_thresholds(
              silent=True
          ),
          **self.quality_score_kwargs,
      )
      class_counts = value_counts_fill_missing_classes(
          labels, num_classes=self.num_class
      )
      if update_num_issues:
          self._update_num_label_issues(
              labels, pred_probs, **self.num_issue_kwargs
          )
      self.examples_processed_quality += batch_size
      if self.store_results:
          self.label_quality_scores += list(scores)
  
      return scores
  
imports: import numpy
  from typing import Optional, List, Tuple, Any
  from cleanlab.count import get_confident_thresholds, _reduce_issues
  from cleanlab.rank import find_top_issues, _compute_label_quality_scores
  from cleanlab.typing import LabelLike
  from cleanlab.internal.util import value_counts_fill_missing_classes
  from cleanlab.internal.constants import CONFIDENT_THRESHOLDS_LOWER_BOUND, FLOATING_POINT_COMPARISON, CLIPPING_LOWER_BOUND
  import platform
  import multiprocessing
label_desc: Use image node_id 7 for calling the LabelInspector obj's underlying member method code with example usage: obj.score_label_quality(labels, pred_probs) and returns: scores