code: def test_classification():
      X, y = df_classification()
  
      sel = SelectByTargetMeanPerformance(
          variables=None,
          scoring="accuracy",
          threshold=None,
          bins=2,
          strategy="equal_width",
          cv=2,
      )
  
      sel.fit(X, y)
  
      # expected result
      Xtransformed = X[["cat_var_A", "num_var_A"]]
  
      performance_dict = {
          "cat_var_A": 1.0,
          "cat_var_B": 0.8,
          "num_var_A": 1.0,
          "num_var_B": 0.8,
      }
      features_to_drop = ["cat_var_B", "num_var_B"]
  
      assert sel.features_to_drop_ == features_to_drop
      assert sel.feature_performance_ == performance_dict
      pd.testing.assert_frame_equal(sel.transform(X), Xtransformed)
  
      sel = SelectByTargetMeanPerformance(
          variables=[
              "cat_var_A",
              "cat_var_B",
              "num_var_A",
              "num_var_B",
          ],
          scoring="roc_auc",
          threshold=0.9,
          bins=2,
          strategy="equal_frequency",
          cv=2,
      )
  
      sel.fit(X, y)
  
      # expected result
      Xtransformed = X[["cat_var_A", "cat_var_B", "num_var_A"]]
  
      performance_dict = {
          "cat_var_A": 1.0,
          "cat_var_B": 0.92,
          "num_var_A": 1.0,
          "num_var_B": 0.8,
      }
      features_to_drop = ["num_var_B"]
  
      assert sel.features_to_drop_ == features_to_drop
      assert sel.feature_performance_ == performance_dict
      pd.testing.assert_frame_equal(sel.transform(X), Xtransformed)
  
file_path: feature_engine/tests/test_selection/test_target_mean_selection.py
imports: import pandas
  import pytest
  from feature_engine.selection import SelectByTargetMeanPerformance
label_desc: Use image node_id 3 for calling a global function with example usage: test_classification() without return types