code: def _compute_confident_joint_multi_label(
      labels: list,
      pred_probs: np.ndarray,
      *,
      thresholds: Optional[Union[np.ndarray, list]] = None,
      calibrate: bool = True,
      return_indices_of_off_diagonals: bool = False,
  ) -> Union[np.ndarray, Tuple[np.ndarray, list]]:
      """Computes the confident joint for multi_labeled data. Thus,
      input `labels` is a list of lists (or list of iterable).
      This is intended as a helper function. You should probably
      be using `compute_confident_joint(multi_label=True)` instead.
  
      The MAJOR DIFFERENCE in how this is computed versus single_label,
      is the total number of errors considered is based on the number
      of labels, not the number of examples. So, the confident_joint
      will have larger values.
  
      See `compute_confident_joint` docstring for more info.
  
      Parameters
      ----------
      labels : list of list/iterable (length N)
          Given noisy labels for multi-label classification.
          Must be a list of lists (or a list of np.ndarrays or iterable).
          The i-th element is a list containing the classes that the i-th example belongs to.
  
      pred_probs : np.ndarray (shape (N, K))
          P(label=k|x) is a matrix with K model-predicted probabilities.
          Each row of this matrix corresponds to an example `x` and contains the model-predicted
          probabilities that `x` belongs to each possible class.
          The columns must be ordered such that these probabilities correspond to class 0, 1, 2,..., K-1.
          `pred_probs` must be out-of-sample (ideally should have been computed using 3+ fold cross-validation).
  
      thresholds : iterable (list or np.ndarray) of shape (K, 1)  or (K,)
          P(label^=k|label=k). If an example has a predicted probability "greater" than
          this threshold, it is counted as having true_label = k. This is
          not used for filtering/pruning, only for estimating the noise rates using
          confident counts. This value should be between 0 and 1. Default is None.
  
      calibrate : bool, default = True
          Calibrates confident joint estimate P(label=i, true_label=j) such that
          ``np.sum(cj) == len(labels) and np.sum(cj, axis = 1) == np.bincount(labels)``.
  
      return_indices_of_off_diagonals: bool, default = False
          If true returns indices of examples that were counted in off-diagonals
          of confident joint as a baseline proxy for the label issues. This
          sometimes works as well as filter.find_label_issues(confident_joint).
  
      Returns
      -------
      confident_joint_counts : np.ndarray
        An array of shape ``(K, 2, 2)`` representing the confident joint of noisy and true labels for each class, in a one-vs-rest format employed for multi-label settings.
  
      Note: if `return_indices_of_off_diagonals` is set as True, this function instead returns a tuple `(confident_joint_counts, indices_off_diagonal)`
      where `indices_off_diagonal` is a list of arrays (one per class) and each array contains the indices of examples counted in off-diagonals of confident joint for that class.
      """
  
      y_one, num_classes = get_onehot_num_classes(labels, pred_probs)
      confident_joint_list: np.ndarray = np.ndarray(
          shape=(num_classes, 2, 2), dtype=np.int64
      )
      indices_off_diagonal = []
      for class_num, (label, pred_prob_for_class) in enumerate(
          zip(y_one.T, pred_probs.T)
      ):
          pred_probs_binary = stack_complement(pred_prob_for_class)
          if return_indices_of_off_diagonals:
              cj, ind = compute_confident_joint(
                  labels=label,
                  pred_probs=pred_probs_binary,
                  multi_label=False,
                  thresholds=thresholds,
                  calibrate=calibrate,
                  return_indices_of_off_diagonals=return_indices_of_off_diagonals,
              )
              indices_off_diagonal.append(ind)
          else:
              cj = compute_confident_joint(
                  labels=label,
                  pred_probs=pred_probs_binary,
                  multi_label=False,
                  thresholds=thresholds,
                  calibrate=calibrate,
                  return_indices_of_off_diagonals=return_indices_of_off_diagonals,
              )
          confident_joint_list[class_num] = cj
  
      if return_indices_of_off_diagonals:
          return confident_joint_list, indices_off_diagonal
  
      return confident_joint_list
  
imports: from sklearn.linear_model import LogisticRegression
  from sklearn.model_selection import StratifiedKFold
  from sklearn.metrics import confusion_matrix
  import sklearn.base
  import numpy
  import warnings
  from typing import Tuple, Union, Optional
  from cleanlab.typing import LabelLike
  from cleanlab.internal.multilabel_utils import stack_complement, get_onehot_num_classes
  from cleanlab.internal.constants import TINY_VALUE, CONFIDENT_THRESHOLDS_LOWER_BOUND, FLOATING_POINT_COMPARISON
  from cleanlab.internal.util import value_counts_fill_missing_classes, clip_values, clip_noise_rates, round_preserving_row_totals, append_extra_datapoint, train_val_split, get_num_classes, get_unique_classes, is_torch_dataset, is_tensorflow_dataset
  from cleanlab.internal.latent_algebra import compute_inv_noise_matrix, compute_py, compute_noise_matrix_from_inverse
  from cleanlab.internal.validation import assert_valid_inputs, labels_to_array
label_desc: Use image node_id 9 for calling a global function with example usage: _compute_confident_joint_multi_label(labels, pred_probs) and returns: confident_joint_list, confident_joint_list,  indices_off_diagonal