code: def test_multiclass_confusion_matrix():
      data = np.array(
          [
              [0, 1],
              [0, 0],
              [1, 0],
              [1, 1],
              [1, 0],
              [1, 2],
              [2, 1],
              [2, 0],
              [2, 2],
              [2, 1],
          ]
      )
      pred = data.copy()
      pred[3, 1] = 0
      pred[4, 1] = 2
  
      df = pd.DataFrame(data, columns=["feat", "label"])
      df2 = pd.DataFrame(pred, columns=["feat", "label"])
  
      favorable_values = [0, 1]
      unfavorable_values = [2]
      mcld = MulticlassLabelDataset(
          favorable_label=favorable_values,
          unfavorable_label=unfavorable_values,
          df=df,
          label_names=["label"],
          protected_attribute_names=["feat"],
      )
      mcld2 = MulticlassLabelDataset(
          favorable_label=favorable_values,
          unfavorable_label=unfavorable_values,
          df=df2,
          label_names=["label"],
          protected_attribute_names=["feat"],
      )
      cm = ClassificationMetric(
          mcld,
          mcld2,
          unprivileged_groups=[{"feat": 2}],
          privileged_groups=[{"feat": 0}, {"feat": 1}],
      )
      confusion_matrix = cm.binary_confusion_matrix()
  
      actual_labels_df = df[["label"]].values
      actual_labels_df2 = df2[["label"]].values
  
      assert np.all(actual_labels_df == mcld.labels)
      assert np.all(actual_labels_df2 == mcld2.labels)
  
      assert confusion_matrix == {
          "TP": 7.0,
          "FN": 1.0,
          "TN": 2.0,
          "FP": 0.0,
      }
  
      fnr = cm.false_negative_rate_difference()
      assert fnr == -0.2
  
file_path: AIF360/tests/test_classification_metric.py
imports: import numpy
  import pandas
  from aif360.datasets import BinaryLabelDataset
  from aif360.datasets.multiclass_label_dataset import MulticlassLabelDataset
  from aif360.metrics import ClassificationMetric
label_desc: Use image node_id 5 for calling a global function with example usage: test_multiclass_confusion_matrix() without return types