code: def test_silverkite_regressor():
      """Tests forecast_pipeline with silverkite and input regressors,
      autoregression and lagged regressors"""
      data = generate_df_with_reg_for_tests(
          freq="1D",
          periods=20 * 7,  # short-term: 20 weeks of data
          remove_extra_cols=True,
          mask_test_actuals=True,
      )
      regressor_cols = ["regressor1", "regressor2", "regressor_categ"]
      lagged_regressor_cols = ["regressor1", "regressor2"]
      keep_cols = [TIME_COL, VALUE_COL] + regressor_cols
      df = data["df"][keep_cols]
      coverage = 0.1
      hyperparameter_grid = {
          "estimator__origin_for_time_vars": [
              None
          ],  # inferred from training data
          "estimator__fs_components_df": [
              pd.DataFrame(
                  {
                      "name": ["tow", "conti_year"],
                      "period": [7.0, 1.0],
                      "order": [3, 0],
                      "seas_names": ["weekly", None],
                  }
              )
          ],
          "estimator__extra_pred_cols": [
              regressor_cols,
              regressor_cols + ["ct_sqrt"],
          ],  # two cases: no growth term and single growth term
          "estimator__fit_algorithm_dict": [
              {"fit_algorithm": "linear"}
          ],
          "estimator__autoreg_dict": [
              {
                  "lag_dict": {"orders": [7]},
                  "agg_lag_dict": {
                      "orders_list": [[7, 7 * 2, 7 * 3]],
                      "interval_list": [(7, 7 * 2)],
                  },
                  "series_na_fill_func": lambda s: s.bfill().ffill(),
              }
          ],
          "estimator__lagged_regressor_dict": [
              {
                  "regressor1": {
                      "lag_dict": {"orders": [1, 2, 3]},
                      "agg_lag_dict": {
                          "orders_list": [[7, 7 * 2, 7 * 3]],
                          "interval_list": [(8, 7 * 2)],
                      },
                      "series_na_fill_func": lambda s: s.bfill().ffill(),
                  },
                  "regressor2": "auto",
              }
          ],
      }
      test_horizon = 2 * 7
      periods_between_train_test = 2
      # Runs pipeline with 2 (of 3) CV folds, 1 parameter set
      result = forecast_pipeline(
          df,
          time_col=TIME_COL,
          value_col=VALUE_COL,
          date_format=None,  # not recommended, but possible to specify
          freq=None,
          regressor_cols=regressor_cols,
          lagged_regressor_cols=lagged_regressor_cols,
          estimator=SilverkiteEstimator(),
          hyperparameter_grid=hyperparameter_grid,
          hyperparameter_budget=1,
          n_jobs=1,
          forecast_horizon=3 * 7,
          coverage=coverage,
          test_horizon=test_horizon,
          periods_between_train_test=periods_between_train_test,
          agg_periods=7,
          agg_func=np.mean,
          score_func=mean_absolute_error,  # callable score_func
          score_func_greater_is_better=False,
          null_model_params=None,
          cv_horizon=1 * 7,
          cv_expanding_window=True,
          cv_min_train_periods=8 * 7,
          cv_periods_between_splits=7,
          cv_periods_between_train_test=3 * 7,
          cv_max_splits=2,
      )
      check_forecast_pipeline_result(
          result,
          coverage=coverage,
          expected_grid_size=1,
          lower_bound_cv=0.0,
          score_func=mean_absolute_error,
          greater_is_better=False,
      )
  
      expected_backtest_train_size = (
          result.timeseries.fit_df.shape[0]
          - test_horizon
          - periods_between_train_test
      )
      assert (
          result.backtest.estimator.model_dict["x_mat"].shape[0]
          == expected_backtest_train_size
      )
      expected_forecast_train_size = result.timeseries.fit_df.shape[0]
      assert (
          result.forecast.estimator.model_dict["x_mat"].shape[0]
          == expected_forecast_train_size
      )
  
      model = result.model.steps[-1][-1]
      trained_model = model.model_dict
      pred_cols = trained_model["pred_cols"]
      expected_feature_cols = {
          # regressor columns
          "regressor1",
          "regressor2",
          "regressor_categ",
          # lagged regressor columns
          "regressor1_lag1",
          "regressor1_lag2",
          "regressor1_lag3",
          "regressor1_avglag_7_14_21",
          "regressor1_avglag_8_to_14",
          "regressor2_lag35",
          "regressor2_avglag_35_42_49",
          "regressor2_avglag_30_to_36",
      }
      assert expected_feature_cols.issubset(pred_cols)
  
imports: import datetime
  import math
  import sys
  import warnings
  import numpy
  import pandas
  import pytest
  from scipy.stats import randint
  from sklearn.metrics import explained_variance_score
  from sklearn.metrics import mean_absolute_error
  from sklearn.metrics import mean_squared_error
  from sklearn.pipeline import Pipeline
  from greykite.common.constants import ACTUAL_COL
  from greykite.common.constants import ADJUSTMENT_DELTA_COL
  from greykite.common.constants import END_TIME_COL
  from greykite.common.constants import FRACTION_OUTSIDE_TOLERANCE
  from greykite.common.constants import METRIC_COL
  from greykite.common.constants import PREDICTED_COL
  from greykite.common.constants import QUANTILE_SUMMARY_COL
  from greykite.common.constants import START_TIME_COL
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.constants import R2_null_model_score
  from greykite.common.evaluation import EvaluationMetricEnum
  from greykite.common.evaluation import add_finite_filter_to_scorer
  from greykite.common.evaluation import add_preaggregation_to_scorer
  from greykite.common.python_utils import assert_equal
  from greykite.common.python_utils import unique_elements_in_list
  from greykite.common.testing_utils import generate_df_for_tests
  from greykite.common.testing_utils import generate_df_with_reg_for_tests
  from greykite.framework.constants import CV_REPORT_METRICS_ALL
  from greykite.framework.constants import FRACTION_OUTSIDE_TOLERANCE_NAME
  from greykite.framework.input.univariate_time_series import UnivariateTimeSeries
  from greykite.framework.pipeline.pipeline import forecast_pipeline
  from greykite.framework.templates.prophet_template import ProphetTemplate
  from greykite.framework.utils.framework_testing_utils import check_forecast_pipeline_result
  from greykite.framework.utils.framework_testing_utils import mock_pipeline
  from greykite.sklearn.estimator.null_model import DummyEstimator
  from greykite.sklearn.estimator.prophet_estimator import ProphetEstimator
  from greykite.sklearn.estimator.silverkite_estimator import SilverkiteEstimator
  from greykite.sklearn.estimator.simple_silverkite_estimator import SimpleSilverkiteEstimator
  from greykite.sklearn.transform.column_selector import ColumnSelector
  from greykite.sklearn.transform.drop_degenerate_transformer import DropDegenerateTransformer
  from greykite.sklearn.transform.dtype_column_selector import DtypeColumnSelector
  from greykite.sklearn.transform.normalize_transformer import NormalizeTransformer
  from greykite.sklearn.transform.null_transformer import NullTransformer
  from greykite.sklearn.transform.pandas_feature_union import PandasFeatureUnion
  from greykite.sklearn.transform.zscore_outlier_transformer import ZscoreOutlierTransformer
label_desc: Use image node_id 18 for calling a global function with example usage: test_silverkite_regressor() without return types