code: def get_self_confidence_for_each_label(
      labels: np.ndarray,
      pred_probs: np.ndarray,
  ) -> np.ndarray:
      """Returns the self-confidence label-quality score for each datapoint.
  
      This is a function to compute label-quality scores for classification datasets,
      where lower scores indicate labels less likely to be correct.
  
      The self-confidence is the classifier's predicted probability that an example belongs to
      its given class label.
  
      Self-confidence can work better than normalized-margin for detecting label errors due to out-of-distribution (OOD) or weird examples
      vs. label errors in which labels for random examples have been replaced by other classes.
  
      Parameters
      ----------
      labels : np.ndarray
        Labels in the same format expected by the `~cleanlab.rank.get_label_quality_scores` function.
  
      pred_probs : np.ndarray
        Predicted-probabilities in the same format expected by the `~cleanlab.rank.get_label_quality_scores` function.
  
      Returns
      -------
      label_quality_scores : np.ndarray
        Contains one score (between 0 and 1) per example.
        Lower scores indicate more likely mislabeled examples.
      """
  
      # To make this work for multi-label (but it will slow down runtime), return:
      # np.array([np.mean(pred_probs[i, l]) for i, l in enumerate(labels)])
      return pred_probs[np.arange(labels.shape[0]), labels]
  
file_path: cleanlab/cleanlab/rank.py
imports: import numpy
  from sklearn.metrics import log_loss
  from typing import List, Optional
  import warnings
  from cleanlab.internal.validation import assert_valid_inputs
  from cleanlab.internal.constants import CLIPPING_LOWER_BOUND
  from cleanlab.internal.label_quality_utils import _subtract_confident_thresholds, get_normalized_entropy
label_desc: Use image node_id 6 for calling a global function with example usage: get_self_confidence_for_each_label(labels, pred_probs) and returns: pred_probs