code: def test_2m_2cf():
      two_group = pd.DataFrame(
          data=np.stack((g_1, g_2), axis=1), columns=["g_1", "g_2"]
      )
      target = MetricFrame(
          metrics={
              "recall": skm.recall_score,
              "prec": skm.precision_score,
          },
          y_true=y_t,
          y_pred=y_p,
          sensitive_features=g_3,  # Unused
          control_features=two_group,
      )
  
      assert isinstance(target.overall, pd.DataFrame)
      assert target.overall.shape == (4, 2)
      assert target.overall.index.names == ["g_1", "g_2"]
      mask_a_f = np.logical_and((g_1 == "aa"), (g_2 == "f"))
      mask_a_g = np.logical_and((g_1 == "aa"), (g_2 == "g"))
      mask_b_f = np.logical_and((g_1 == "ba"), (g_2 == "f"))
      mask_b_g = np.logical_and((g_1 == "ba"), (g_2 == "g"))
  
      recall_a_f = skm.recall_score(y_t[mask_a_f], y_p[mask_a_f])
      recall_a_g = skm.recall_score(y_t[mask_a_g], y_p[mask_a_g])
      recall_b_f = skm.recall_score(y_t[mask_b_f], y_p[mask_b_f])
      recall_b_g = skm.recall_score(y_t[mask_b_g], y_p[mask_b_g])
      assert target.overall["recall"][("aa", "f")] == recall_a_f
      assert target.overall["recall"][("aa", "g")] == recall_a_g
      assert target.overall["recall"][("ba", "f")] == recall_b_f
      assert target.overall["recall"][("ba", "g")] == recall_b_g
  
      prec_a_f = skm.precision_score(y_t[mask_a_f], y_p[mask_a_f])
      prec_a_g = skm.precision_score(y_t[mask_a_g], y_p[mask_a_g])
      prec_b_f = skm.precision_score(y_t[mask_b_f], y_p[mask_b_f])
      prec_b_g = skm.precision_score(y_t[mask_b_g], y_p[mask_b_g])
      assert target.overall["prec"][("aa", "f")] == prec_a_f
      assert target.overall["prec"][("aa", "g")] == prec_a_g
      assert target.overall["prec"][("ba", "f")] == prec_b_f
      assert target.overall["prec"][("ba", "g")] == prec_b_g
  
file_path: fairlearn/test/unit/metrics/test_metricframe_overall.py
imports: import numpy
  import pandas
  import pytest
  import sklearn.metrics
  from fairlearn.metrics import MetricFrame
  from .data_for_test import g_1, g_2, g_3, s_w, y_p, y_t
label_desc: Use image node_id 12 for calling a global function with example usage: test_2m_2cf() without return types