code: def check_forecast_pipeline_result(
      result,
      coverage=0.95,
      strategy=None,
      interactive=False,
      expected_grid_size=None,
      lower_bound_cv=None,
      upper_bound_cv=None,
      score_func=EvaluationMetricEnum.MeanAbsolutePercentError.name,
      greater_is_better=False,
      cv_report_metrics_names=None,
      relative_error_tolerance=None,
  ):
      """Helper function that validates forecast_pipeline output.
      Raises an AssertionError is results do not match the expected values.
  
      Parameters
      ----------
      result : :class:`~greykite.framework.pipeline.pipeline.ForecastResult`
          ``forecast_pipeline`` output to check
      coverage : `float` or None, default 0.95
          The ``coverage`` passed to ``forecast_pipeline``
      strategy : `str` or None, default None
          Null model strategy.
          If None, not checked.
      interactive : `bool`, default False
          Whether to plot and print results.
      expected_grid_size : `int` or None, default None
          Expected number of options evaluated in grid search.
          If None, does not check the expected size.
      lower_bound_cv : `float` or None, default None
          Lower bound on CV test set error.
          If None, does not check the test error.
      upper_bound_cv : `float` or None, default None
          Upper bound on CV test set error.
          If None, does not check the test error.
      score_func : `str` or callable, default ``EvaluationMetricEnum.MeanAbsolutePercentError.name``
          Score function used to select optimal model in CV.
          The same as passed to ``forecast_pipeline`` and grid search.
          If a callable, takes arrays ``y_true``, ``y_pred`` and returns a float.
          If a string, must be either a
          `~greykite.common.evaluation.EvaluationMetricEnum` member name
          or `~greykite.common.constants.FRACTION_OUTSIDE_TOLERANCE`.
      greater_is_better : `bool`, default False
          Whether higher values are better.
          Must be explicitly passed for testing (not derived from ``score_func``).
      cv_report_metrics_names : `list` [`str`] or None, default None
          Additional metrics besides ``metric`` calculated during CV.
          If None, no other metrics are checked in the result.
  
          Unlike in ``forecast_pipeline``, these are the expected names,
          in the CV output, such as:
  
              - ``enum.get_metric_name()``
              - ``"CUSTOM_SCORE_FUNC_NAME"``
              - ``"FRACTION_OUTSIDE_TOLERANCE_NAME"``
      relative_error_tolerance : `float` or None
          The ``relative_error_tolerance`` passed to ``forecast_pipeline``
      """
      assert isinstance(result.grid_search, RandomizedSearchCV)
      assert isinstance(result.model, Pipeline)
      assert isinstance(result.backtest, UnivariateForecast)
      assert isinstance(result.forecast, UnivariateForecast)
  
      assert_proper_grid_search(
          result.grid_search,
          expected_grid_size=expected_grid_size,
          lower_bound=lower_bound_cv,
          upper_bound=upper_bound_cv,
          score_func=score_func,
          greater_is_better=greater_is_better,
          cv_report_metrics_names=cv_report_metrics_names,
      )
  
      ts = result.timeseries
      assert ts.df[VALUE_COL].equals(ts.y)
      assert result.backtest.train_evaluation is not None
      assert result.backtest.test_evaluation is not None
      if coverage is None:
          assert result.forecast.coverage is None
          assert result.backtest.coverage is None
          assert (
              result.backtest.train_evaluation[PREDICTION_BAND_COVERAGE]
              is None
          )
          assert (
              result.backtest.test_evaluation[PREDICTION_BAND_COVERAGE]
              is None
          )
          expected_cols = [TIME_COL, ACTUAL_COL, PREDICTED_COL]
          assert list(result.backtest.df.columns) == expected_cols
          assert list(result.forecast.df.columns) == expected_cols
      else:
          assert round(result.forecast.coverage, 3) == round(
              coverage, 3
          )
          assert round(result.backtest.coverage, 3) == round(
              coverage, 3
          )
          assert (
              result.backtest.train_evaluation[PREDICTION_BAND_COVERAGE]
              is not None
          )
          assert (
              result.backtest.test_evaluation[PREDICTION_BAND_COVERAGE]
              is not None
          )
  
      assert result.forecast.train_evaluation is not None
  
      # Tests if null model params are set for CV
      estimator = result.model.steps[-1][-1]
      if estimator.null_model is not None and strategy is not None:
          assert estimator.null_model.strategy == strategy
  
      # Tests if relative_error_tolerance is set for backtest/forecast
      if relative_error_tolerance is not None:
          assert (
              result.backtest.relative_error_tolerance
              == relative_error_tolerance
          )
          assert (
              result.forecast.relative_error_tolerance
              == relative_error_tolerance
          )
  
      if interactive:
          print(
              "backtest_train_evaluation",
              result.backtest.train_evaluation,
          )
          print(
              "backtest_test_evaluation",
              result.backtest.test_evaluation,
          )
          print(
              "forecast_train_evaluation",
              result.forecast.train_evaluation,
          )
          print(
              "forecast_test_evaluation",
              result.forecast.test_evaluation,
          )
          print(
              summarize_grid_search_results(
                  result.grid_search,
                  score_func=score_func,
                  score_func_greater_is_better=greater_is_better,
              )
          )
          ts.plot().write_html("test_ts_plot.html")
          result.backtest.plot().write_html("test_backtest_plot.html")
          result.forecast.plot().write_html("test_forecast_plot.html")
  
imports: import warnings
  from functools import partial
  from typing import Optional
  import numpy
  import pandas
  from sklearn.model_selection import RandomizedSearchCV
  from sklearn.pipeline import Pipeline
  from greykite.common.constants import ACTUAL_COL
  from greykite.common.constants import PREDICTED_COL
  from greykite.common.constants import PREDICTION_BAND_COVERAGE
  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 fraction_outside_tolerance
  from greykite.common.python_utils import assert_equal
  from greykite.common.testing_utils import assert_eval_function_equal
  from greykite.framework.constants import FRACTION_OUTSIDE_TOLERANCE_NAME
  from greykite.framework.output.univariate_forecast import UnivariateForecast
  from greykite.framework.pipeline.pipeline import validate_pipeline_input
  from greykite.framework.pipeline.utils import get_score_func_with_aggregation
  from greykite.framework.utils.result_summary import summarize_grid_search_results
  from greykite.sklearn.estimator.simple_silverkite_estimator import SimpleSilverkiteEstimator
  from greykite.sklearn.sklearn_scorer import _PredictScorerDF
label_desc: Use image node_id 4 for calling a global function with example usage: check_forecast_pipeline_result(result, coverage, strategy, interactive, expected_grid_size, lower_bound_cv, upper_bound_cv, score_func, greater_is_better, cv_report_metrics_names, relative_error_tolerance) without return types