code: def test_calibrate_joint_multilabel():
      dataset = multilabel_data
      cj = count.compute_confident_joint(
          labels=dataset["labels"],
          pred_probs=dataset["pred_probs"],
          multi_label=True,
          calibrate=False,
      )
      calibrated_cj = count.calibrate_confident_joint(
          confident_joint=cj,
          labels=dataset["labels"],
          multi_label=True,
      )
      y_one = int2onehot(
          dataset["labels"], K=dataset["pred_probs"].shape[1]
      )
      # Check calibration
      for class_num in range(0, len(calibrated_cj)):
          label_counts = np.bincount(y_one[:, class_num])
          assert all(
              calibrated_cj[class_num].sum(axis=1).round().astype(int)
              == label_counts
          )
          assert len(dataset["labels"]) == int(
              round(np.sum(calibrated_cj[class_num]))
          )
      calibrated_cj2 = count.compute_confident_joint(
          labels=dataset["labels"],
          pred_probs=dataset["pred_probs"],
          calibrate=True,
          multi_label=True,
      )
      # Check equivalency
      assert np.all(calibrated_cj == calibrated_cj2)
      assert calibrated_cj.shape == calibrated_cj2.shape == (3, 2, 2)
  
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 7 for calling a global function with example usage: test_calibrate_joint_multilabel() without return types