code: def _find_label_issues_multilabel(
      labels: list,
      pred_probs: np.ndarray,
      return_indices_ranked_by: Optional[str] = None,
      rank_by_kwargs={},
      filter_by: str = "prune_by_noise_rate",
      frac_noise: float = 1.0,
      num_to_remove_per_class: Optional[List[int]] = None,
      min_examples_per_class=1,
      confident_joint: Optional[np.ndarray] = None,
      n_jobs: Optional[int] = None,
      verbose: bool = False,
      low_memory: bool = False,
  ) -> np.ndarray:
      """
      Finds label issues in multi-label classification data where each example can belong to more than one class.
      This is done via a one-vs-rest reduction for each class and the results are subsequently aggregated across all classes.
      Here `labels` must be formatted as an iterable of iterables, e.g. ``List[List[int]]``.
      """
      if (
          filter_by in ["low_normalized_margin", "low_self_confidence"]
          and not low_memory
      ):
          num_errors = sum(
              find_label_issues(
                  labels=labels,
                  pred_probs=pred_probs,
                  confident_joint=confident_joint,
                  multi_label=True,
                  filter_by="confident_learning",
              )
          )
  
          y_one, num_classes = get_onehot_num_classes(
              labels, pred_probs
          )
          label_quality_scores = ml_scorer.get_label_quality_scores(
              labels=y_one,
              pred_probs=pred_probs,
          )
  
          cl_error_indices = np.argsort(label_quality_scores)[
              :num_errors
          ]
          label_issues_mask = np.zeros(len(labels), dtype=bool)
          label_issues_mask[cl_error_indices] = True
  
          if return_indices_ranked_by is not None:
              label_quality_scores_issues = ml_scorer.get_label_quality_scores(
                  labels=y_one[label_issues_mask],
                  pred_probs=pred_probs[label_issues_mask],
                  method=ml_scorer.MultilabelScorer(
                      base_scorer=ml_scorer.ClassLabelScorer.from_str(
                          return_indices_ranked_by
                      ),
                  ),
                  base_scorer_kwargs=rank_by_kwargs,
              )
              return cl_error_indices[
                  np.argsort(label_quality_scores_issues)
              ]
  
          return label_issues_mask
  
      per_class_issues = find_multilabel_issues_per_class(
          labels,
          pred_probs,
          return_indices_ranked_by,
          rank_by_kwargs,
          filter_by,
          frac_noise,
          num_to_remove_per_class,
          min_examples_per_class,
          confident_joint,
          n_jobs,
          verbose,
          low_memory,
      )
      if return_indices_ranked_by is None:
          assert isinstance(per_class_issues, np.ndarray)
          return per_class_issues.sum(axis=1) >= 1
      else:
          (
              label_issues_list,
              labels_list,
              pred_probs_list,
          ) = per_class_issues
          label_issues_idx = reduce(np.union1d, label_issues_list)
          y_one, num_classes = get_onehot_num_classes(
              labels, pred_probs
          )
          label_quality_scores = ml_scorer.get_label_quality_scores(
              labels=y_one,
              pred_probs=pred_probs,
              method=ml_scorer.MultilabelScorer(
                  base_scorer=ml_scorer.ClassLabelScorer.from_str(
                      return_indices_ranked_by
                  ),
              ),
              base_scorer_kwargs=rank_by_kwargs,
          )
          label_quality_scores_issues = label_quality_scores[
              label_issues_idx
          ]
          return label_issues_idx[
              np.argsort(label_quality_scores_issues)
          ]
  
imports: import numpy
  from sklearn.metrics import confusion_matrix
  import multiprocessing
  import sys
  import warnings
  from typing import Any, Dict, Optional, Tuple, List
  from functools import reduce
  import platform
  from cleanlab.count import calibrate_confident_joint, num_label_issues, _reduce_issues
  from cleanlab.rank import order_label_issues, get_label_quality_scores
  import cleanlab.internal.multilabel_scorer
  from cleanlab.internal.validation import assert_valid_inputs
  from cleanlab.internal.util import value_counts_fill_missing_classes, round_preserving_row_totals, get_num_classes
  from cleanlab.internal.multilabel_utils import stack_complement, get_onehot_num_classes, int2onehot
  from cleanlab.typing import LabelLike
  from cleanlab.multilabel_classification.filter import find_multilabel_issues_per_class
label_desc: Use image node_id 2 for calling a global function with example usage: _find_label_issues_multilabel(labels, pred_probs, return_indices_ranked_by, rank_by_kwargs, filter_by, frac_noise, num_to_remove_per_class, min_examples_per_class, confident_joint, n_jobs, verbose, low_memory) and returns: label_issues_mask, unknown, label_issues_idx, cl_error_indices