code: def test_silverkite_regressor_with_missing_values():
      """Tests forecast_pipeline with silverkite and input regressors and lagged regressors.
      In particular, lagged regressor columns are not a subset of regressor columns.
      Multiple lag order + forecast horizon combinations are tested for warnings.
      """
      data = generate_df_with_reg_for_tests(
          freq="D",
          periods=20 * 7,
          train_start_date=datetime.datetime(2018, 1, 1),
          remove_extra_cols=True,
          mask_test_actuals=False,
      )
      regressor_cols_all = ["regressor1", "regressor2"]
      regressor_cols = ["regressor1"]
      lagged_regressor_cols = ["regressor2"]
      keep_cols = [TIME_COL, VALUE_COL] + regressor_cols_all
      df = data["df"][keep_cols].copy()
      # Setting NaN values at the end
      # VALUE_COL and regressor2 have the same length
      # regressor1 has 5 more future values than VALUE_COL and regressor2
      # Therefore, the max forecast horizon is 5
      df.loc[df.tail(8).index, VALUE_COL] = np.nan
      df.loc[df.tail(3).index, "regressor1"] = np.nan
      df.loc[df.tail(8).index, "regressor2"] = np.nan
  
      hyperparameter_grid = {
          "estimator__fs_components_df": [None],
          "estimator__extra_pred_cols": [
              regressor_cols
          ],  # two cases: no growth term and single growth term
          "estimator__fit_algorithm_dict": [
              {"fit_algorithm": "linear"}
          ],
          "estimator__lagged_regressor_dict": [
              {
                  "regressor2": {
                      "lag_dict": {"orders": [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": {
                      "lag_dict": {"orders": [5]},
                      "agg_lag_dict": {
                          "orders_list": [[7, 7 * 2, 7 * 3]],
                          "interval_list": [(8, 7 * 2)],
                      },
                      "series_na_fill_func": lambda s: s.bfill().ffill(),
                  }
              },
          ],
      }
  
      # When any minimal lagged regressor order in the grids is less than forecast_horizon,
      # there should a warning of lagged regressor columns being imputed
      forecast_horizon = 5
      test_horizon = 7
      periods_between_train_test = 0
      with pytest.warns(Warning) as record:
          result = forecast_pipeline(
              df,
              time_col=TIME_COL,
              value_col=VALUE_COL,
              regressor_cols=regressor_cols,
              lagged_regressor_cols=lagged_regressor_cols,
              estimator=SilverkiteEstimator(),
              hyperparameter_grid=hyperparameter_grid,
              forecast_horizon=forecast_horizon,
              test_horizon=test_horizon,
              periods_between_train_test=periods_between_train_test,
              cv_max_splits=2,
          )
          all_warnings = "".join(
              [warn.message.args[0] for warn in record]
          )
          assert (
              "test_horizon should never be larger than forecast_horizon"
              in all_warnings
          )
          assert (
              "Trained model's `min_lagged_regressor_order` (3) is less than the size of `fut_df` (5)"
              in all_warnings
          )
      assert (
          result.model[-1].model_dict["min_lagged_regressor_order"] == 5
      )
  
      # Checks model
      expected_pred_cols = [
          "regressor1",
          "regressor2_lag5",
          "regressor2_avglag_7_14_21",
          "regressor2_avglag_8_to_14",
      ]
      assert (
          result.model[-1].model_dict["pred_cols"] == expected_pred_cols
      )
  
      expected_train_size = result.timeseries.fit_df.shape[0]  # 132
      assert result.timeseries.fit_df.shape == (
          expected_train_size,
          4,
      )  # 132
      assert result.model[-1].model_dict["x_mat"].shape == (
          expected_train_size,
          5,
      )  # 132
  
      # Checks backtest
      expected_backtest_train_size = (
          expected_train_size
          - test_horizon
          - periods_between_train_test
      )  # 132 - 5 - 0
      assert result.backtest.estimator.model_dict["x_mat"].shape == (
          expected_backtest_train_size,
          5,
      )  # 127
      assert result.backtest.df_test.shape == (test_horizon, 5)  # 5
  
      # Checks forecast
      assert result.forecast.df_test.shape == (forecast_horizon, 5)  # 5
  
      # Checks key dates
      assert result.timeseries.train_end_date == datetime.datetime(
          2018, 5, 12
      )
      assert result.backtest.df_test[TIME_COL].iloc[
          0
      ] == datetime.datetime(2018, 5, 6)
      assert result.forecast.df_test[TIME_COL].iloc[
          0
      ] == datetime.datetime(2018, 5, 13)
  
      # More edge cases
      # When overall minimal lagged regressor order for all grids is at least forecast_horizon,
      # there is no warning
      forecast_horizon = 3
      test_horizon = 3
      periods_between_train_test = 0
      with pytest.warns(Warning) as record:
          result = forecast_pipeline(
              df,
              time_col=TIME_COL,
              value_col=VALUE_COL,
              regressor_cols=regressor_cols,
              lagged_regressor_cols=lagged_regressor_cols,
              estimator=SilverkiteEstimator(),
              hyperparameter_grid=hyperparameter_grid,
              forecast_horizon=forecast_horizon,
              test_horizon=test_horizon,
              periods_between_train_test=periods_between_train_test,
              cv_max_splits=2,
          )
          all_warnings = "".join(
              [warn.message.args[0] for warn in record]
          )
          assert (
              "Trained model's `min_lagged_regressor_order` (3) is less than the size of `fut_df` (3)"
              not in all_warnings
          )
      assert (
          result.model[-1].model_dict["min_lagged_regressor_order"] == 5
      )
  
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 19 for calling a global function with example usage: test_silverkite_regressor_with_missing_values() without return types