code: def test_get_grouping_evaluation(
      valid_bm, metric_dict, df, valid_configs, custom_tscv
  ):
      bm = valid_bm
  
      # default value, all configs, groupby time feature
      grouped_evaluation_df = bm.get_grouping_evaluation_metrics(
          metric_dict=metric_dict, groupby_time_feature="dow"
      )
      expected_columns = set(
          ["config_name", "split_num", "dow"]
          + [
              f"train {metric_name}"
              for metric_name in metric_dict.keys()
          ]
      )
      assert set(grouped_evaluation_df.columns) == expected_columns
      assert grouped_evaluation_df.shape[
          0
      ] == 7 * bm.tscv.max_splits * len(bm.configs)
  
      # check metric values
      assert_equal(
          grouped_evaluation_df["dow"].values,
          np.tile(
              np.arange(1, 8), bm.tscv.max_splits * len(bm.configs)
          ),
      )
      assert_equal(
          grouped_evaluation_df["train MSE"].values,
          grouped_evaluation_df["train custom_MSE"].values,
      )
      assert (
          grouped_evaluation_df["train corr"]
          .dropna()
          .between(-1, 1)
          .all()
      )
  
      # groupby sliding window size
      config_names = ["valid_prophet"]
      grouped_evaluation_df = bm.get_grouping_evaluation_metrics(
          metric_dict=metric_dict,
          config_names=config_names,
          which="test",
          groupby_sliding_window_size=7,
      )
      expected_columns = set(
          ["config_name", "split_num", "ts_downsample"]
          + [
              f"test {metric_name}"
              for metric_name in metric_dict.keys()
          ]
      )
      assert set(grouped_evaluation_df.columns) == expected_columns
      # forecasting 2 weeks into future, so 2 rows for each split, config
      assert grouped_evaluation_df.shape[
          0
      ] == 2 * bm.tscv.max_splits * len(config_names)
  
      # check metric values
      assert_equal(
          grouped_evaluation_df["test MSE"].values,
          grouped_evaluation_df["test custom_MSE"].values,
      )
      assert (
          grouped_evaluation_df["test corr"]
          .dropna()
          .between(-1, 1)
          .all()
      )
  
      # groupby custom column
      custom_column = pd.Series(np.repeat(["g1", "g2"], 7), name="week")
      grouped_evaluation_df = bm.get_grouping_evaluation_metrics(
          metric_dict=metric_dict,
          which="test",
          groupby_custom_column=custom_column,
      )
      expected_columns = set(
          ["config_name", "split_num", custom_column.name]
          + [
              f"test {metric_name}"
              for metric_name in metric_dict.keys()
          ]
      )
      assert set(grouped_evaluation_df.columns) == expected_columns
      # forecasting 2 weeks into future, so 2 rows for each split, config
      assert grouped_evaluation_df.shape[
          0
      ] == 2 * bm.tscv.max_splits * len(bm.configs)
  
      # check metric values
      assert_equal(
          grouped_evaluation_df["test MSE"].values,
          grouped_evaluation_df["test custom_MSE"].values,
      )
      assert (
          grouped_evaluation_df["test corr"]
          .dropna()
          .between(-1, 1)
          .all()
      )
  
      # error when `run` method has not been executed yet
      with pytest.raises(
          ValueError,
          match="Please execute the 'run' method before "
          "computing grouped evaluation metrics.",
      ):
          bm = BenchmarkForecastConfig(
              df=df, configs=valid_configs, tscv=custom_tscv
          )
          bm.get_grouping_evaluation_metrics(metric_dict=metric_dict)
  
imports: import pickle
  import sys
  import numpy
  import pandas
  import pytest
  from plotly.colors import DEFAULT_PLOTLY_COLORS
  from greykite.algo.forecast.silverkite.constants.silverkite_holiday import SilverkiteHoliday
  from greykite.common.constants import ACTUAL_COL
  from greykite.common.constants import PREDICTED_COL
  from greykite.common.constants import PREDICTED_LOWER_COL
  from greykite.common.constants import PREDICTED_UPPER_COL
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.evaluation import EvaluationMetricEnum
  from greykite.common.evaluation import root_mean_squared_error
  from greykite.common.python_utils import assert_equal
  from greykite.common.testing_utils import generate_df_with_reg_for_tests
  from greykite.framework.benchmark.benchmark_class import BenchmarkForecastConfig
  from greykite.framework.constants import FORECAST_STEP_COL
  from greykite.framework.templates.autogen.forecast_config import ComputationParam
  from greykite.framework.templates.autogen.forecast_config import EvaluationMetricParam
  from greykite.framework.templates.autogen.forecast_config import EvaluationPeriodParam
  from greykite.framework.templates.autogen.forecast_config import ForecastConfig
  from greykite.framework.templates.autogen.forecast_config import MetadataParam
  from greykite.framework.templates.autogen.forecast_config import ModelComponentsParam
  from greykite.framework.templates.forecaster import Forecaster
  from greykite.framework.templates.model_templates import ModelTemplateEnum
  from greykite.sklearn.cross_validation import RollingTimeSeriesSplit
label_desc: Use image node_id 14 for calling a global function with example usage: test_get_grouping_evaluation(valid_bm, metric_dict, df, valid_configs, custom_tscv) without return types