code: def test_plot_grouping_evaluation(df2):
      """Tests plot_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()
      fig = forecast.plot_grouping_evaluation(
          score_func=metric.get_metric_func(),
          score_func_name=metric_name,
          which="train",
          groupby_time_feature="dow",
      )
      assert fig.data[0].name == f"train {metric_name}"
      assert fig.layout.xaxis.title.text == "dow"
      assert fig.layout.yaxis.title.text == f"train {metric_name}"
      assert fig.layout.title.text == f"train {metric_name} vs dow"
      assert fig.layout.title.x == 0.5
      assert fig.data[0].x.shape[0] == 5
  
      # MSE, groupby_sliding_window_size, train set
      metric = EvaluationMetricEnum.MeanSquaredError
      metric_name = metric.get_metric_name()
      fig = forecast.plot_grouping_evaluation(
          score_func=metric.get_metric_func(),
          score_func_name=metric_name,
          which="train",
          groupby_sliding_window_size=2,
      )  # there are 5 training points, so this creates groups of size (1, 2, 2)
      assert fig.data[0].name == f"train {metric_name}"
      assert fig.layout.xaxis.title.text == f"{cst.TIME_COL}_downsample"
      assert fig.layout.yaxis.title.text == f"train {metric_name}"
      assert (
          fig.layout.title.text
          == f"train {metric_name} vs {cst.TIME_COL}_downsample"
      )
      assert fig.layout.title.x == 0.5
      assert fig.data[0].x.shape[0] == 3
  
      # MAE, groupby_custom_column, test set
      forecast = UnivariateForecast(
          df2, train_end_date=datetime.datetime(2018, 1, 2)
      )
      metric = EvaluationMetricEnum.MeanAbsoluteError
      metric_name = metric.get_metric_name()
      custom_groups = pd.Series(
          ["g1", "g2", "g1", "g3", "g2"], name="custom_groups"
      )
      fig = forecast.plot_grouping_evaluation(
          groupby_custom_column=custom_groups,
          score_func=metric.get_metric_func(),
          score_func_name=metric_name,
          which="test",
          title=None,
      )
      assert fig.data[0].name == f"test {metric_name}"
      assert fig.layout.xaxis.title.text == "custom_groups"
      assert fig.layout.yaxis.title.text == f"test {metric_name}"
      assert (
          fig.layout.title.text
          == f"test {metric_name} vs custom_groups"
      )
      assert fig.layout.title.x == 0.5
      assert fig.data[0].x.shape[0] == 3
  
      # custom xlabel, ylabel, title
      fig = forecast.plot_grouping_evaluation(
          groupby_custom_column=custom_groups,
          score_func=metric.get_metric_func(),
          score_func_name=metric_name,
          which="test",
          xlabel="Custom labels",
          ylabel="Mean Absolute Error of y",
          title="Mean Absolute Error of y by Custom labels",
      )
      assert fig.layout.xaxis.title.text == "Custom labels"
      assert fig.layout.yaxis.title.text == "Mean Absolute Error of y"
      assert (
          fig.layout.title.text
          == "Mean Absolute Error of y by Custom labels"
      )
      assert fig.layout.title.x == 0.5
  
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 13 for calling a global function with example usage: test_plot_grouping_evaluation(df2) without return types