code: def test_generalized_binary_confusion_matrix():
      data = np.array(
          [
              [0, 1],
              [0, 0],
              [1, 0],
              [1, 1],
              [1, 0],
              [1, 0],
              [1, 2],
              [0, 0],
              [0, 0],
              [1, 2],
          ]
      )
  
      pred = np.array(
          [
              [0, 1, 0.8],
              [0, 0, 0.6],
              [1, 0, 0.7],
              [1, 1, 0.8],
              [1, 2, 0.36],
              [1, 0, 0.82],
              [1, 1, 0.79],
              [0, 2, 0.42],
              [0, 1, 0.81],
              [1, 2, 0.3],
          ]
      )
      df = pd.DataFrame(data, columns=["feat", "label"])
      df2 = pd.DataFrame(pred, columns=["feat", "label", "score"])
  
      favorable_values = [0, 1]
      unfavorable_values = [2]
  
      mcld = MulticlassLabelDataset(
          df=df,
          label_names=["label"],
          protected_attribute_names=["feat"],
          favorable_label=favorable_values,
          unfavorable_label=unfavorable_values,
      )
  
      mcld2 = MulticlassLabelDataset(
          df=df2,
          label_names=["label"],
          scores_names=["score"],
          protected_attribute_names=["feat"],
          favorable_label=favorable_values,
          unfavorable_label=unfavorable_values,
      )
  
      cm = ClassificationMetric(
          mcld,
          mcld2,
          unprivileged_groups=[{"feat": 0}],
          privileged_groups=[{"feat": 1}],
      )
  
      gen_confusion_matrix = cm.generalized_binary_confusion_matrix()
  
      gtp = cm.num_generalized_true_positives()
      assert round(gtp, 2) == 5.31
      gfp = cm.num_generalized_false_positives()
      assert gfp == 1.09
  
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 6 for calling a global function with example usage: test_generalized_binary_confusion_matrix() without return types