class_docstr: Forecast one-by-one estimator.
  
  Parameters
  ----------
  score_func : `callable`, default mean_squared_error
      Function to calculate model R2_null_model_score score,
      with signature (actual, predicted).
      ``actual``, ``predicted`` are array-like with the same shape.
      Smaller values are better.
  
  coverage : `float`, default 0.95
      Intended coverage of the prediction bands (0.0 to 1.0).
      If None, the upper/lower predictions are not returned by ``predict``.
  
  null_model_params : `dict`, default None
      Dictionary keys must be in ("strategy", "constant", "quantile").
      Defines null model. model score is R2_null_model_score of model error relative to null model,
      evaluated by score_func.
      If None, model score is score_func of the model itself.
  
  estimator : `str`
      The estimator used in forecast one-by-one.
      Must be one of the keys in ``ONEBYONE_ESTIMATORS``.
  
  forecast_horizon : `int`
      The forecast horizon.
  
  estimator_map : `bool`, `int` or `list` [`int`], default None
      The map between estimators and forecast horizons.
  
          If True, each time point in the forecasting period has a different model.
          If False, forecast one-by-one is turned off.
          If `int`, every ``estimator_map`` time points have a different model.
          If `list`, the sum must equal to the forecast horizon.
              The values are the number of timepoints in each estimator.
  
      For example, if forecast horizon is 7
  
          `estimator_map = True` corresponds to [1, 1, 1, 1, 1, 1, 1], 7 models.
          `estimator_map = 1` corresponds to [1, 1, 1, 1, 1, 1, 1], 7 models.
          `estimator_map = 2` corresponds to [2, 2, 2, 1], 4 models.
          `estimator_map = [1, 2, 4]` corresponds to 3 models.
          `estimator_map = False` corresponds to [7], 1 model.
          `estimator_map = None` corresponds to [7], 1 model.
  
  
  Attributes
  ----------
  estimator : `str`
      The estimator name.
  estimator_params : `dict`
      The parameters used in the estimator.
  forecast_horizon : `int`
      The forecast horizon.
  estimator_map : `bool`, `int`, `list` [`int]`
      The map between estimators and time points.
  estimator_map_list : `list` [`int`]
      The processed estimator_map as a list.
      We don't want to overwrite the original self.estimator_map.
  estimator_param_names : `list` [`str`]
      All available parameter names in estimator.
  estimator_class : `class`
      The estimator class.
  estimators : `list` [`class`]
      The list of estimator class instances.
  model_results : `list`
      The list of estimator fit method outputs.
  pred_indices : `list` [`int`]
      The list of indices used to splice forecasts.
  forecast : `pandas.DataFrame`
      The cached forecast results from the last call of ``self.predict``.
docstr: Gets the estimators for forecast one-by-one.
  
  If the given parameters indicate that multiple estimators are need
  for the forecast one-by-one algorithm, these estimators with proper
  parameters are initialized.
  
  Sets ``self.estimator_class``, ``self.estimators``, ``self.pred_indices``
  and ``self.estimator_map_list``.
docstr_tok: ["Gets","the","estimators","for","forecast","one-by-one",".","If","the","given","parameters","indicate","that","multiple","estimators","are","need","for","the","forecast","one-by-one","algorithm",",","these","estimators","with","proper","parameters","are","initialized",".","Sets","``","self.estimator_class","``",",","``","self.estimators","``",",","``","self.pred_indices","``","and","``","self.estimator_map_list","``","."]
code: def _get_estimators(self):
      """Gets the estimators for forecast one-by-one.
  
      If the given parameters indicate that multiple estimators are need
      for the forecast one-by-one algorithm, these estimators with proper
      parameters are initialized.
  
      Sets ``self.estimator_class``, ``self.estimators``, ``self.pred_indices``
      and ``self.estimator_map_list``.
      """
      # Only estimators in ``ONEBYONE_ESTIMATORS`` supports forecast one-by-one.
      if self.estimator not in ONEBYONE_ESTIMATORS:
          raise ValueError(
              f"Estimator {self.estimator} does not support forecast"
              f" one-by-one."
          )
  
      self.estimator_class = ONEBYONE_ESTIMATORS[self.estimator][
          "class"
      ]
      if self.estimator_params is None:
          self.estimator_params = {}
  
      # Sets estimator base parameters, so the prediction confidence intervals can be pulled.
      if "score_func" not in self.estimator_params:
          self.estimator_params["score_func"] = self.score_func
      if "coverage" not in self.estimator_params:
          self.estimator_params["coverage"] = self.coverage
      if "null_model_params" not in self.estimator_params:
          self.estimator_params[
              "null_model_params"
          ] = self.null_model_params
  
      # Checks if any provided parameters depend on forecast horizon.
      params_depending_on_horizon = ONEBYONE_ESTIMATORS[self.estimator][
          "params_depending_on_horizon"
      ]
      depending_on_horizon = False
      if params_depending_on_horizon is not None:
          for param, values in params_depending_on_horizon.items():
              if param in self.estimator_params:
                  input_value = self.estimator_params.get(param)
                  if input_value in values:
                      depending_on_horizon = True
      if not depending_on_horizon:
          log_message(
              message="No parameters depending on forecast horizon found. "
              "Forecast one-by-one is not activated.",
              level=LoggingLevelEnum.INFO,
          )
  
      # Checks if forecast horizon is a parameter in ``estimator_params``.
      # Forecast horizon should be different for different models.
      # If forecast horizon is a parameter, it need to be removed.
      # It will be added back differently for each estimator.
      forecast_horizon_param = ONEBYONE_ESTIMATORS[self.estimator][
          "forecast_horizon_param"
      ]
      if depending_on_horizon:
          if forecast_horizon_param in self.estimator_params:
              del self.estimator_params[forecast_horizon_param]
  
      # Initializes estimator instances.
      if depending_on_horizon and self.estimator_map is not False:
          if self.estimator_map is None or self.estimator_map is True:
              self.estimator_map_list = [1] * self.forecast_horizon
          elif isinstance(self.estimator_map, int):
              estimator_map = [
                  self.estimator_map
                  for _ in range(
                      self.forecast_horizon // self.estimator_map
                  )
              ]
              if self.forecast_horizon % self.estimator_map:
                  estimator_map.append(
                      self.forecast_horizon % self.estimator_map
                  )
              self.estimator_map_list = estimator_map
          else:
              if sum(self.estimator_map) != self.forecast_horizon:
                  raise ValueError(
                      "Sum of forecast one by one estimator map must equal to forecast horizon."
                  )
              self.estimator_map_list = deepcopy(self.estimator_map)
          self.estimators = []
          self.pred_indices = [0]
          current_horizon = 0
          for i in self.estimator_map_list:
              current_horizon += i
              self.estimator_params[
                  forecast_horizon_param
              ] = current_horizon
              self.estimators.append(
                  deepcopy(
                      self.estimator_class(**self.estimator_params)
                  )
              )
              self.pred_indices.append(current_horizon)
      else:
          self.estimator_map_list = [self.forecast_horizon]
          if forecast_horizon_param is not None:
              self.estimator_params[
                  forecast_horizon_param
              ] = self.forecast_horizon
          self.estimators = [
              deepcopy(self.estimator_class(**self.estimator_params))
          ]
  
imports: from copy import deepcopy
  from typing import Callable
  from typing import List
  from typing import Optional
  from typing import Union
  import pandas
  from sklearn.metrics import mean_squared_error
  from greykite.common import constants
  from greykite.common.logging import LoggingLevelEnum
  from greykite.common.logging import log_message
  from greykite.sklearn.estimator.base_forecast_estimator import BaseForecastEstimator
  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
label_desc: Use image node_id 3 for calling the OneByOneEstimator obj's underlying member method code with example usage: obj._get_estimators() without return types