class_docstr: A base class for forecast estimators that fit using
  `~greykite.algo.forecast.silverkite.forecast_silverkite.SilverkiteForecast.forecast`.
  
  Notes
  -----
  Allows estimators that fit using
  `~greykite.algo.forecast.silverkite.forecast_silverkite.SilverkiteForecast.forecast`
  to share the same functions for input data validation,
  fit postprocessing, predict, summary, plot_components, etc.
  
  Subclasses should:
  
      - Implement their own ``__init__`` that uses a superset of the parameters here.
      - Implement their own ``fit``, with this sequence of steps:
  
          - calls ``super().fit``
          - calls ``SilverkiteForecast.forecast`` or ``SimpleSilverkiteForecast.forecast_simple`` and stores the result in ``self.model_dict``
          - calls ``super().finish_fit``
  
  Uses ``coverage`` to set prediction band width. Even though
  coverage is not needed by ``forecast_silverkite``, it is included
  in every ``BaseForecastEstimator`` to be used universally for
  forecast evaluation.
  
  Therefore, ``uncertainty_dict`` must be consistent with ``coverage``
  if provided as a dictionary. If ``uncertainty_dict`` is None or
  "auto", an appropriate default value is set, according to ``coverage``.
  
  Parameters
  ----------
  score_func : callable, optional, default mean_squared_error
      See `~greykite.sklearn.estimator.base_forecast_estimator.BaseForecastEstimator`.
  coverage : `float` between [0.0, 1.0] or None, optional
      See `~greykite.sklearn.estimator.base_forecast_estimator.BaseForecastEstimator`.
  null_model_params : `dict`, optional
      Dictionary with arguments to define DummyRegressor null model, default is `None`.
      See `~greykite.sklearn.estimator.base_forecast_estimator.BaseForecastEstimator`.
  uncertainty_dict : `dict` or `str` or None, optional
      How to fit the uncertainty model.
      See `~greykite.algo.forecast.silverkite.forecast_silverkite.SilverkiteForecast.forecast`.
      Note that this is allowed to be "auto". If None or "auto", will be set to
      a default value by ``coverage`` before calling ``forecast_silverkite``.
  
  Attributes
  ----------
  silverkite : Class or a derived class of `~greykite.algo.forecast.silverkite.forecast_silverkite.SilverkiteForecast`
      The silverkite algorithm instance used for forecasting
  model_dict : `dict` or None
      A dict with fitted model and its attributes.
      The output of `~greykite.algo.forecast.silverkite.forecast_silverkite.SilverkiteForecast.forecast`.
  pred_cols : `list` [`str`] or None
      Names of the features used in the model.
  feature_cols : `list` [`str`] or None
      Column names of the patsy design matrix built by
      `~greykite.algo.common.ml_models.design_mat_from_formula`.
  df : `pandas.DataFrame` or None
      The training data used to fit the model.
  coef_ : `pandas.DataFrame` or None
      Estimated coefficient matrix for the model.
      Not available for ``random forest`` and ``gradient boosting`` methods and
      set to the default value `None`.
  _pred_category : `dict` or None
      A dictionary with keys being the predictor category and
      values being the predictors belonging to the category.
      For details, see
      `~greykite.sklearn.estimator.base_silverkite_estimator.BaseSilverkiteEstimator.pred_category`.
  extra_pred_cols : `list` or None
      User provided extra predictor names, for details, see
      `~greykite.sklearn.estimator.simple_silverkite_estimator.SimpleSilverkiteEstimator`
      or
      `~greykite.sklearn.estimator.silverkite_estimator.SilverkiteEstimator`.
  past_df : `pandas.DataFrame` or None
      The extra past data before training data used to generate autoregression terms.
  forecast : `pandas.DataFrame` or None
      Output of ``predict_silverkite``, set by ``self.predict``.
  forecast_x_mat : `pandas.DataFrame` or None
      The design matrix of the model at the predict time.
  model_summary : `class` or `None`
      The `~greykite.algo.common.model_summary.ModelSummary` class.
  
  See Also
  --------
  `~greykite.algo.forecast.silverkite.forecast_silverkite.SilverkiteForecast.forecast`
      Function performing the fit and predict.
  
  Notes
  -----
  The subclasses will pass ``fs_components_df`` to ``forecast_silverkite``. The model terms
  it creates internally are used to generate the component plots.
  
      - `~greykite.common.features.timeseries_features.fourier_series_multi_fcn` uses
        ``fs_components_df["names"]`` (e.g. ``tod``, ``tow``) to build the fourier series
        and to create column names.
  
      - ``fs_components_df["seas_names"]`` (e.g. ``daily``, ``weekly``) is appended
        to the column names, if provided.
  
  `~greykite.sklearn.estimator.base_silverkite_estimator.BaseSilverkiteEstimator.plot_components` relies
  on a regular expression dictionary to group components together.  There are two available in the library, see
  `~greykite.common.constants` for the two definitions
  
      1. "DEFAULT_COMPONENTS_REGEX_DICT"
         Grouped seasonality that is the default
      2. "DETAILED_SEASONALITY_COMPONENTS_REGEX_DICT":
         A detailed seasonality breakdown where the user can view daily/weekly/monthly/quarterly/yearly seasonality
docstr: A dictionary that stores the predictor names in each category.
  
  This property is not initialized until used. This speeds up the
  fitting process. The categories includes
  
      - "intercept" : the intercept.
      - "time_features" : the predictors that include
        `~greykite.common.constants.TimeFeaturesEnum`
        but not
        `~greykite.common.constants.SEASONALITY_REGEX`.
      - "event_features" : the predictors that include
        `~greykite.common.constants.EVENT_PREFIX`.
      - "trend_features" : the predictors that include
        `~greykite.common.constants.TREND_REGEX`
        but not
        `~greykite.common.constants.SEASONALITY_REGEX`.
      - "seasonality_features" : the predictors that include
        `~greykite.common.constants.SEASONALITY_REGEX`.
      - "lag_features" : the predictors that include
        `~greykite.common.constants.LAG_REGEX`.
      - "regressor_features" : external regressors and other predictors
        manually passed to ``extra_pred_cols``, but not in the categories above.
      - "interaction_features" : the predictors that include
        interaction terms, i.e., including a colon.
  
  Note that each predictor falls into at least one category.
  Some "time_features" may also be "trend_features".
  Predictors with an interaction are classified into all categories matched by
  the interaction components. Thus, "interaction_features" are already included
  in the other categories.
code: def pred_category(self):
      """A dictionary that stores the predictor names in each category.
  
      This property is not initialized until used. This speeds up the
      fitting process. The categories includes
  
          - "intercept" : the intercept.
          - "time_features" : the predictors that include
            `~greykite.common.constants.TimeFeaturesEnum`
            but not
            `~greykite.common.constants.SEASONALITY_REGEX`.
          - "event_features" : the predictors that include
            `~greykite.common.constants.EVENT_PREFIX`.
          - "trend_features" : the predictors that include
            `~greykite.common.constants.TREND_REGEX`
            but not
            `~greykite.common.constants.SEASONALITY_REGEX`.
          - "seasonality_features" : the predictors that include
            `~greykite.common.constants.SEASONALITY_REGEX`.
          - "lag_features" : the predictors that include
            `~greykite.common.constants.LAG_REGEX`.
          - "regressor_features" : external regressors and other predictors
            manually passed to ``extra_pred_cols``, but not in the categories above.
          - "interaction_features" : the predictors that include
            interaction terms, i.e., including a colon.
  
      Note that each predictor falls into at least one category.
      Some "time_features" may also be "trend_features".
      Predictors with an interaction are classified into all categories matched by
      the interaction components. Thus, "interaction_features" are already included
      in the other categories.
      """
      if self.model_dict is None:
          raise NotFittedError(
              "Must fit before getting predictor category."
          )
      if self._pred_category is None:
          # extra_pred_cols could be None/list
          extra_pred_cols = (
              []
              if self.extra_pred_cols is None
              else self.extra_pred_cols
          )
          # regressor_cols could be non-exist/None/list
          # the if catches non-exist and None
          regressor_cols = (
              []
              if getattr(self, "regressor_cols", None) is None
              else getattr(self, "regressor_cols")
          )
          # lagged regressors
          lagged_regressor_dict = getattr(
              self, "lagged_regressor_dict", None
          )
          lagged_regressor_cols = []
          if lagged_regressor_dict is not None:
              lagged_regressor_cols = list(lagged_regressor_dict.keys())
          self._pred_category = create_pred_category(
              pred_cols=self.model_dict["x_mat"].columns,
              # extra regressors are specified via "regressor_cols" in simple_silverkite_estimator
              extra_pred_cols=extra_pred_cols
              + regressor_cols
              + lagged_regressor_cols,
              df_cols=list(self.model_dict["df"].columns),
          )
      return self._pred_category
  
imports: import re
  from typing import Dict
  from typing import Optional
  from typing import Type
  import pandas
  import plotly.express
  from pandas.tseries.frequencies import to_offset
  from plotly import graph_objects
  from plotly.subplots import make_subplots
  from sklearn.exceptions import NotFittedError
  from sklearn.metrics import mean_squared_error
  from greykite.algo.changepoint.adalasso.changepoints_utils import get_trend_changepoint_dates_from_cols
  from greykite.algo.common.col_name_utils import create_pred_category
  from greykite.algo.common.ml_models import breakdown_regression_based_prediction
  from greykite.algo.common.model_summary import ModelSummary
  from greykite.algo.forecast.silverkite.constants.silverkite_component import SilverkiteComponentsEnum
  from greykite.algo.forecast.silverkite.constants.silverkite_constant import default_silverkite_constant
  from greykite.algo.forecast.silverkite.forecast_silverkite import SilverkiteForecast
  from greykite.algo.forecast.silverkite.forecast_silverkite_helper import get_silverkite_uncertainty_dict
  from greykite.common import constants
  from greykite.common.features.timeseries_lags import min_max_lag_order
  from greykite.common.time_properties import min_gap_in_seconds
  from greykite.common.time_properties_forecast import get_simple_time_frequency_from_period
  from greykite.sklearn.estimator.base_forecast_estimator import BaseForecastEstimator
  from greykite.sklearn.uncertainty.uncertainty_methods import UncertaintyMethodEnum
label_desc: Use image node_id 7 for calling the BaseSilverkiteEstimator obj's underlying member method code with example usage: obj.pred_category() and returns: self