code: def test_batched_label_issues():
      f1 = filter.find_label_issues(
          labels=data["labels"],
          pred_probs=data["pred_probs"],
          return_indices_ranked_by="self_confidence",
          filter_by="low_self_confidence",
      )
      f1_mask = filter.find_label_issues(
          labels=data["labels"],
          pred_probs=data["pred_probs"],
          filter_by="low_self_confidence",
      )
      f2 = find_label_issues_batched(
          labels=data["labels"],
          pred_probs=data["pred_probs"],
          batch_size=int(len(data["labels"]) / 4.0),
      )
      f3 = find_label_issues_batched(
          labels=data["labels"],
          pred_probs=data["pred_probs"],
          batch_size=int(len(data["labels"]) / 2.0),
          n_jobs=None,
      )
      f4 = find_label_issues_batched(
          labels=data["labels"],
          pred_probs=data["pred_probs"],
          batch_size=len(data["labels"]) + 100,
          n_jobs=4,
      )
      f5 = find_label_issues_batched(
          labels=data["labels"],
          pred_probs=data["pred_probs"],
          batch_size=1,
      )
      f_single = find_label_issues_batched(
          labels=data["labels"],
          pred_probs=data["pred_probs"],
          batch_size=len(data["labels"]),
          n_jobs=1,
      )
      f_single_mask = find_label_issues_batched(
          labels=data["labels"],
          pred_probs=data["pred_probs"],
          batch_size=len(data["labels"]),
          n_jobs=1,
          return_mask=True,
      )
      assert np.all(f4 == f5)
      assert np.all(f4 == f3)
      assert np.all(f4 == f2)
      assert np.all(f_single == f4)
      assert len(f2) == len(f1)
      # check jaccard similarity:
      intersection = len(list(set(f1).intersection(set(f2))))
      union = len(set(f1)) + len(set(f2)) - intersection
      assert float(intersection) / union > 0.95
      # check jaccard similarity for mask:
      f1_mask_indices = np.where(f1_mask)[0]
      f_single_mask_indices = np.where(f_single_mask)[0]
      intersection = len(
          list(
              set(f1_mask_indices).intersection(
                  set(f_single_mask_indices)
              )
          )
      )
      union = (
          len(set(f1_mask_indices))
          + len(set(f_single_mask_indices))
          - intersection
      )
      assert float(intersection) / union > 0.95
  
      n1 = count.num_label_issues(
          labels=data["labels"],
          pred_probs=data["pred_probs"],
          estimation_method="off_diagonal_calibrated",
      )
      quality_score_kwargs = {"method": "normalized_margin"}
      num_issue_kwargs = {
          "estimation_method": "off_diagonal_calibrated"
      }
      extra_args = {
          "quality_score_kwargs": quality_score_kwargs,
          "num_issue_kwargs": num_issue_kwargs,
      }
      f5 = find_label_issues_batched(
          labels=data["labels"],
          pred_probs=data["pred_probs"],
          batch_size=int(len(data["labels"]) / 4.0),
          **extra_args,
      )
      f6 = find_label_issues_batched(
          labels=data["labels"],
          pred_probs=data["pred_probs"],
          batch_size=int(len(data["labels"]) / 2.0),
          n_jobs=None,
          **extra_args,
      )
      f7 = find_label_issues_batched(
          labels=data["labels"],
          pred_probs=data["pred_probs"],
          batch_size=len(data["labels"]) + 100,
          n_jobs=4,
          **extra_args,
      )
      f_single = find_label_issues_batched(
          labels=data["labels"],
          pred_probs=data["pred_probs"],
          batch_size=len(data["labels"]),
          n_jobs=1,
          **extra_args,
      )
      assert not np.array_equal(f5, f2)
      assert np.all(f7 == f5)
      assert np.all(f6 == f5)
      assert np.all(f_single == f5)
      assert np.abs(len(f5) - n1) < 2
      # Test batches loaded from file:
      labels_file = path.join(mkdtemp(), "labels.npy")
      pred_probs_file = path.join(mkdtemp(), "pred_probs.npy")
      np.save(labels_file, data["labels"])
      np.save(pred_probs_file, data["pred_probs"])
      f8 = find_label_issues_batched(
          labels_file=labels_file,
          pred_probs_file=pred_probs_file,
          batch_size=int(len(data["labels"]) / 4.0),
      )
      assert np.all(f8 == f3)
  
imports: import cleanlab.multilabel_classification.dataset
  from cleanlab import count, filter
  from cleanlab.count import get_confident_thresholds, estimate_py_and_noise_matrices_from_probabilities
  from cleanlab.internal.latent_algebra import compute_inv_noise_matrix
  from cleanlab.benchmarking.noise_generation import generate_noise_matrix_from_trace
  from cleanlab.benchmarking.noise_generation import generate_noisy_labels
  from cleanlab.internal.util import value_counts
  from cleanlab.internal.multilabel_utils import int2onehot
  from cleanlab.experimental.label_issues_batched import find_label_issues_batched
  import numpy
  import scipy
  import pytest
  from sklearn.multioutput import MultiOutputClassifier
  from sklearn.linear_model import LogisticRegression
  from sklearn.model_selection import cross_val_predict
  from tempfile import mkdtemp
  import os.path
label_desc: Use image node_id 31 for calling a global function with example usage: test_batched_label_issues() without return types