code: def test_regression():
      X, y = df_regression()
  
      sel = SelectByTargetMeanPerformance(
          variables=None,
          bins=2,
          scoring="r2",
          regression=True,
          cv=2,
          strategy="equal_width",
          threshold=None,
      )
  
      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.8533333333333333,
          "num_var_A": 0.8,
          "num_var_B": 0.512,
      }
  
      assert sel.features_to_drop_ == ["num_var_B"]
      assert sel.feature_performance_ == performance_dict
      pd.testing.assert_frame_equal(sel.transform(X), Xtransformed)
  
      X, y = df_regression()
  
      sel = SelectByTargetMeanPerformance(
          variables=[
              "cat_var_A",
              "cat_var_B",
              "num_var_A",
              "num_var_B",
          ],
          bins=2,
          scoring="neg_root_mean_squared_error",
          regression=True,
          cv=2,
          strategy="equal_width",
          threshold=-0.2,
      )
  
      sel.fit(X, y)
  
      # expected result
      Xtransformed = X["cat_var_A"].to_frame()
      performance_dict = {
          "cat_var_A": 0.0,
          "cat_var_B": -0.42817441928883765,
          "num_var_A": -0.5,
          "num_var_B": -0.7810249675906654,
      }
  
      assert sel.features_to_drop_ == [
          "cat_var_B",
          "num_var_A",
          "num_var_B",
      ]
      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 4 for calling a global function with example usage: test_regression() without return types