code: def test_get_grouping_evaluation(df2):
      """Tests get_grouping_evaluation function"""
      forecast = UnivariateForecast(
          df2, train_end_date=datetime.datetime(2018, 1, 5)
      )
  
      # MAPE, groupby_time_feature, train set
      metric = EvaluationMetricEnum.MeanAbsolutePercentError
      metric_name = metric.get_metric_name()
      grouped_df = forecast.get_grouping_evaluation(
          score_func=metric.get_metric_func(),
          score_func_name=metric_name,
          which="train",
          groupby_time_feature="dow",
      )
      expected = pd.DataFrame(
          {
              "dow": [
                  1,
                  2,
                  3,
                  4,
                  5,
              ],  # Monday, Tuesday, etc. Time feature is used as column name
              f"train {metric_name}": [0.0, 100.0, 0.0, 50.0, 40.0],
          }
      )
      assert_equal(grouped_df, expected)
  
      # MSE, groupby_sliding_window_size
      metric = EvaluationMetricEnum.MeanSquaredError
      metric_name = metric.get_metric_name()
      grouped_df = forecast.get_grouping_evaluation(
          score_func=metric.get_metric_func(),
          score_func_name=metric_name,
          which="train",
          groupby_sliding_window_size=2,
      )
      expected = pd.DataFrame(
          {
              f"{cst.TIME_COL}_downsample": [
                  datetime.datetime(2018, 1, 1),
                  datetime.datetime(2018, 1, 3),
                  datetime.datetime(2018, 1, 5),
              ],
              f"train {metric_name}": [0.0, 2.0, 4.0],
          }
      )
      assert_equal(grouped_df, expected)
  
      # MAE, groupby_custom_column, test set
      forecast = UnivariateForecast(
          df2, train_end_date=datetime.datetime(2018, 1, 2)
      )
      metric = EvaluationMetricEnum.MeanAbsoluteError
      custom_groups = pd.Series(
          ["g1", "g2", "g1", "g3", "g2"], name="custom_groups"
      )
      grouped_df = forecast.get_grouping_evaluation(
          score_func=metric.get_metric_func(),
          score_func_name=None,
          which="test",
          groupby_custom_column=custom_groups,
      )
      expected = pd.DataFrame(
          {
              "custom_groups": ["g1", "g2", "g3"],
              "test metric": [1.0, 1.5, 2.0],
          }
      )
      assert_equal(grouped_df, expected)
  
imports: import datetime
  import math
  import sys
  from functools import partial
  import numpy
  import pandas
  import pytest
  from pandas.testing import assert_frame_equal
  from pandas.testing import assert_series_equal
  from sklearn.pipeline import Pipeline
  from greykite.common import constants
  from greykite.common.evaluation import ElementwiseEvaluationMetricEnum
  from greykite.common.evaluation import EvaluationMetricEnum
  from greykite.common.python_utils import assert_equal
  from greykite.common.testing_utils import gen_sliced_df
  from greykite.framework.input.univariate_time_series import UnivariateTimeSeries
  from greykite.framework.output.univariate_forecast import UnivariateForecast
  from greykite.framework.pipeline.utils import get_forecast
  from greykite.sklearn.estimator.prophet_estimator import ProphetEstimator
  from greykite.sklearn.estimator.silverkite_estimator import SilverkiteEstimator
  from greykite.sklearn.estimator.testing_utils import params_component_breakdowns
label_desc: Use image node_id 12 for calling a global function with example usage: test_get_grouping_evaluation(df2) without return types