class_docstr: Base template with common code used by multiple templates.
  
  Provides a particular modular approach to implement
  `~greykite.framework.templates.template_interface.TemplateInterface.apply_template_for_pipeline_params`.
  
  Includes the config defaults from
  `~greykite.framework.templates.forecast_config_defaults.ForecastConfigDefaults`.
  
  Subclasses must provide these properties / functions used by ``apply_template_for_pipeline_params``:
  
      - estimator (__init__ default value)
      - get_regressor_cols
      - get_lagged_regressor_info
      - get_hyperparameter_grid
  
  Subclasses may optionally want to override:
  
      - get_pipeline
      - get_forecast_time_properties
      - apply_metadata_defaults
      - apply_evaluation_metric_defaults
      - apply_evaluation_period_defaults
      - apply_computation_defaults
      - apply_model_components_defaults
      - apply_forecast_config_defaults
class_docstr_tok: ["Base","template","with","common","code","used","by","multiple","templates",".","Provides","a","particular","modular","approach","to","implement","`","~greykite.framework.templates.template_interface.TemplateInterface.apply_template_for_pipeline_params","`",".","Includes","the","config","defaults","from","`","~greykite.framework.templates.forecast_config_defaults.ForecastConfigDefaults","`",".","Subclasses","must","provide","these","properties","\/","functions","used","by","``","apply_template_for_pipeline_params","``",":","-","estimator","(","__init__","default","value",")","-","get_regressor_cols","-","get_lagged_regressor_info","-","get_hyperparameter_grid","Subclasses","may","optionally","want","to","override",":","-","get_pipeline","-","get_forecast_time_properties","-","apply_metadata_defaults","-","apply_evaluation_metric_defaults","-","apply_evaluation_period_defaults","-","apply_computation_defaults","-","apply_model_components_defaults","-","apply_forecast_config_defaults"]
docstr: Implements template interface method.
  Takes input data and optional configuration parameters
  to customize the model. Returns a set of parameters to call
  :func:`~greykite.framework.pipeline.pipeline.forecast_pipeline`.
  
  See template interface for parameters and return value.
  
  Uses the methods in this class to set:
  
      - ``"regressor_cols"`` : get_regressor_cols()
      - ``lagged_regressor_cols`` : get_lagged_regressor_info()
      - ``"pipeline"`` : get_pipeline()
      - ``"time_properties"`` : get_forecast_time_properties()
      - ``"hyperparameter_grid"`` : get_hyperparameter_grid()
  
  All other parameters are taken directly from ``config``.
docstr_tok: ["Implements","template","interface","method",".","Takes","input","data","and","optional","configuration","parameters","to","customize","the","model",".","Returns","a","set","of","parameters","to","call",":","func",":","`","~greykite.framework.pipeline.pipeline.forecast_pipeline","`",".","See","template","interface","for","parameters","and","return","value",".","Uses","the","methods","in","this","class","to","set",":","-","``","``","regressor_cols","''","``",":","get_regressor_cols","(",")","-","``","lagged_regressor_cols","``",":","get_lagged_regressor_info","(",")","-","``","``","pipeline","''","``",":","get_pipeline","(",")","-","``","``","time_properties","''","``",":","get_forecast_time_properties","(",")","-","``","``","hyperparameter_grid","''","``",":","get_hyperparameter_grid","(",")","All","other","parameters","are","taken","directly","from","``","config","``","."]
code: def apply_template_for_pipeline_params(
      self, df: pd.DataFrame, config: Optional[ForecastConfig] = None
  ) -> Dict:
      """Implements template interface method.
      Takes input data and optional configuration parameters
      to customize the model. Returns a set of parameters to call
      :func:`~greykite.framework.pipeline.pipeline.forecast_pipeline`.
  
      See template interface for parameters and return value.
  
      Uses the methods in this class to set:
  
          - ``"regressor_cols"`` : get_regressor_cols()
          - ``lagged_regressor_cols`` : get_lagged_regressor_info()
          - ``"pipeline"`` : get_pipeline()
          - ``"time_properties"`` : get_forecast_time_properties()
          - ``"hyperparameter_grid"`` : get_hyperparameter_grid()
  
      All other parameters are taken directly from ``config``.
      """
      self.df = df
      self.config = config
      # Defines score_func, score_func_greater_is_better
      # Sets `score_func` to a string instead of a function, so CV results are
      # reported as "mean_test_{short_name}" instead of "mean_test_score".
      metric = EvaluationMetricEnum[
          config.evaluation_metric_param.cv_selection_metric
      ]
      self.score_func = metric.name
      self.score_func_greater_is_better = (
          metric.get_metric_greater_is_better()
      )
  
      self.regressor_cols = self.get_regressor_cols()
      self.lagged_regressor_cols = self.get_lagged_regressor_info().get(
          "lagged_regressor_cols", None
      )
      self.pipeline = self.get_pipeline()
      self.time_properties = self.get_forecast_time_properties()
      self.hyperparameter_grid = self.get_hyperparameter_grid()
  
      self.pipeline_params = dict(
          # input
          df=self.df,
          time_col=self.config.metadata_param.time_col,
          value_col=self.config.metadata_param.value_col,
          date_format=self.config.metadata_param.date_format,
          freq=self.config.metadata_param.freq,
          train_end_date=self.config.metadata_param.train_end_date,
          anomaly_info=self.config.metadata_param.anomaly_info,
          # model
          pipeline=self.pipeline,
          regressor_cols=self.regressor_cols,
          lagged_regressor_cols=self.lagged_regressor_cols,
          estimator=None,  # ignored when `pipeline` is provided
          hyperparameter_grid=self.hyperparameter_grid,
          hyperparameter_budget=self.config.computation_param.hyperparameter_budget,
          n_jobs=self.config.computation_param.n_jobs,
          verbose=self.config.computation_param.verbose,
          # forecast
          forecast_horizon=self.config.forecast_horizon,
          coverage=self.config.coverage,
          test_horizon=self.config.evaluation_period_param.test_horizon,
          periods_between_train_test=self.config.evaluation_period_param.periods_between_train_test,
          agg_periods=self.config.evaluation_metric_param.agg_periods,
          agg_func=self.config.evaluation_metric_param.agg_func,
          # evaluation
          score_func=self.score_func,
          score_func_greater_is_better=self.score_func_greater_is_better,
          cv_report_metrics=self.config.evaluation_metric_param.cv_report_metrics,
          null_model_params=self.config.evaluation_metric_param.null_model_params,
          relative_error_tolerance=self.config.evaluation_metric_param.relative_error_tolerance,
          # CV
          cv_horizon=self.config.evaluation_period_param.cv_horizon,
          cv_min_train_periods=self.config.evaluation_period_param.cv_min_train_periods,
          cv_expanding_window=self.config.evaluation_period_param.cv_expanding_window,
          cv_use_most_recent_splits=self.config.evaluation_period_param.cv_use_most_recent_splits,
          cv_periods_between_splits=self.config.evaluation_period_param.cv_periods_between_splits,
          cv_periods_between_train_test=self.config.evaluation_period_param.cv_periods_between_train_test,
          cv_max_splits=self.config.evaluation_period_param.cv_max_splits,
      )
      return self.pipeline_params
  
imports: import functools
  from abc import ABC
  from abc import abstractmethod
  from typing import Dict
  from typing import Optional
  import pandas
  from greykite.common.evaluation import EvaluationMetricEnum
  from greykite.common.time_properties_forecast import get_forecast_time_properties
  from greykite.framework.pipeline.utils import get_basic_pipeline
  from greykite.framework.templates.autogen.forecast_config import ForecastConfig
  from greykite.framework.templates.forecast_config_defaults import ForecastConfigDefaults
  from greykite.framework.templates.template_interface import TemplateInterface
  from greykite.sklearn.estimator.base_forecast_estimator import BaseForecastEstimator
label_desc: Use image node_id 9 for calling the BaseTemplate obj's underlying member method code with example usage: obj.apply_template_for_pipeline_params(df, config) and returns: self