class_docstr: The model template for Multistage Forecast Estimator.
class_docstr_tok: ["The","model","template","for","Multistage","Forecast","Estimator","."]
docstr: Gets the estimators and estimator parameters from ``MultistageForecastTemplateConfig`` objects.
  
  Parameters
  ----------
  new_configs : `list` [
  `~greykite.framework.templates.multistage_forecast_template_config.MultistageForecastTemplateConfig`]
      The Multistage Forecast configs overriden by the ``multistage_forecast_configs`` in ``custom``.
  
  Returns
  -------
  estimators : `list` [`~greykite.sklearn.estimator.base_forecast_estimator.BaseForecastEstimator`]
      The estimator classes in each stage.
  estimator_params : `list` [`dict` [`str`, any]]
      The estimator parameters in each stage.
      These parameters are in ``hyperparameter_grid`` format and may contain nested grids.
docstr_tok: ["Gets","the","estimators","and","estimator","parameters","from","``","MultistageForecastTemplateConfig","``","objects",".","Parameters","--","--","--","--","--","new_configs",":","`","list","`","[","`","~greykite.framework.templates.multistage_forecast_template_config.MultistageForecastTemplateConfig","`","]","The","Multistage","Forecast","configs","overriden","by","the","``","multistage_forecast_configs","``","in","``","custom","``",".","Returns","--","--","--","-","estimators",":","`","list","`","[","`","~greykite.sklearn.estimator.base_forecast_estimator.BaseForecastEstimator","`","]","The","estimator","classes","in","each","stage",".","estimator_params",":","`","list","`","[","`","dict","`","[","`","str","`",",","any","]","]","The","estimator","parameters","in","each","stage",".","These","parameters","are","in","``","hyperparameter_grid","``","format","and","may","contain","nested","grids","."]
code: def __get_estimators_and_params_from_template_configs(
      self, new_configs: List[MultistageForecastTemplateConfig]
  ):
      """Gets the estimators and estimator parameters from ``MultistageForecastTemplateConfig`` objects.
  
      Parameters
      ----------
      new_configs : `list` [
      `~greykite.framework.templates.multistage_forecast_template_config.MultistageForecastTemplateConfig`]
          The Multistage Forecast configs overriden by the ``multistage_forecast_configs`` in ``custom``.
  
      Returns
      -------
      estimators : `list` [`~greykite.sklearn.estimator.base_forecast_estimator.BaseForecastEstimator`]
          The estimator classes in each stage.
      estimator_params : `list` [`dict` [`str`, any]]
          The estimator parameters in each stage.
          These parameters are in ``hyperparameter_grid`` format and may contain nested grids.
      """
      estimator_list = []
      estimator_params_list = []
      for config in new_configs:
          template = self.__get_template_class(
              ForecastConfig(model_template=config.model_template)
          )()
          estimator = template._estimator.__class__
          # It's not common that `self.config.metadata_param` is None,
          # but since `get_hyperparameter_grid` is a public method,
          # in case people call it directly, we set the value defaults.
          if (
              self.config.metadata_param is not None
              and self.config.metadata_param.time_col is not None
          ):
              time_col = self.config.metadata_param.time_col
          else:
              time_col = cst.TIME_COL
          if (
              self.config.metadata_param is not None
              and self.config.metadata_param.value_col is not None
          ):
              value_col = self.config.metadata_param.value_col
          else:
              value_col = cst.VALUE_COL
          date_format = (
              self.config.metadata_param.date_format
              if self.config.metadata_param is not None
              else None
          )
          # Creates a sample df for the template class to generate hyperparameter grid.
          # The ``apply_template_for_pipeline_params`` function does not use any information from ``df``
          # when generating the hyperparameter grid.
          sample_df = pd.DataFrame(
              {
                  time_col: pd.date_range(
                      end=pd.to_datetime(self.df[time_col])
                      .max()
                      .date(),
                      periods=100,
                      freq=config.agg_freq,
                  ),
                  value_col: 0,
              }
          )
          estimator_params_grid = template.apply_template_for_pipeline_params(
              df=sample_df,
              # Here we ignore the ``forecast_horizon`` parameter.
              # Even the wrong ``forecast_horizon`` is inferred for this model,
              # the correct ``forecast_horizon`` will be used to override in the estimator's ``fit``
              # method.
              config=ForecastConfig(
                  metadata_param=MetadataParam(
                      time_col=time_col,
                      value_col=value_col,
                      freq=config.agg_freq,
                      date_format=date_format,
                  ),
                  model_template=config.model_template,
                  model_components_param=config.model_components,
              ),
          )[
              "hyperparameter_grid"
          ]
          estimator_list.append(estimator)
          estimator_params_list.append(estimator_params_grid)
      return estimator_list, estimator_params_list
  
imports: from itertools import product
  from typing import Dict
  from typing import List
  from typing import Type
  import pandas
  from greykite.common import constants
  from greykite.common.logging import LoggingLevelEnum
  from greykite.common.logging import log_message
  from greykite.common.python_utils import unique_in_list
  from greykite.common.python_utils import update_dictionaries
  from greykite.framework.templates.autogen.forecast_config import ForecastConfig
  from greykite.framework.templates.autogen.forecast_config import MetadataParam
  from greykite.framework.templates.base_template import BaseTemplate
  from greykite.framework.templates.multistage_forecast_template_config import MultistageForecastTemplateConfig
  from greykite.framework.templates.multistage_forecast_template_config import MultistageForecastTemplateConstants
  from greykite.sklearn.estimator.base_forecast_estimator import BaseForecastEstimator
  from greykite.sklearn.estimator.multistage_forecast_estimator import MultistageForecastEstimator
  from greykite.sklearn.estimator.multistage_forecast_estimator import MultistageForecastModelConfig
label_desc: Use image node_id 8 for calling the MultistageForecastTemplate obj's underlying member method code with example usage: obj.__get_estimators_and_params_from_template_configs(new_configs) and returns: estimator_list,  estimator_params_list