class_docstr: A base class for forecast models. Fits a timeseries and predicts future values
  
  Parameters
  ----------
  score_func : callable, optional, 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, optional, 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`
  
      Every subclass must use `coverage` to set prediction band width. This ensures a common
      BaseForecastEstimator interface for parameters used during fitting and forecast evaluation
  
  null_model_params : dict with arguments passed to DummyRegressor, optional, 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
  
  Attributes
  ----------
  null_model : DummyEstimator
      null model used to measure model score
  time_col_ : str
      Name of input data time column
  value_col_ : str
      Name of input data value column
  last_predicted_X_ : `pandas.DataFrame` or None
      The ``X`` last passed to ``self.predict()``.
      Used to speed up predictions if the same ``X`` is passed repeatedly.
      Resets to None when ``self.fit()`` is called.
  cached_predictions_ : `pandas.DataFrame` or None
      The return value of the last call to ``self.predict()``.
      Used to speed up predictions if the same ``X`` is passed repeatedly.
      Resets to None when ``self.fit()`` is called.
class_docstr_tok: ["A","base","class","for","forecast","models",".","Fits","a","timeseries","and","predicts","future","values","Parameters","--","--","--","--","--","score_func",":","callable",",","optional",",","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",",","optional",",","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","`","Every","subclass","must","use","`","coverage","`","to","set","prediction","band","width",".","This","ensures","a","common","BaseForecastEstimator","interface","for","parameters","used","during","fitting","and","forecast","evaluation","null_model_params",":","dict","with","arguments","passed","to","DummyRegressor",",","optional",",","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","Attributes","--","--","--","--","--","null_model",":","DummyEstimator","null","model","used","to","measure","model","score","time_col_",":","str","Name","of","input","data","time","column","value_col_",":","str","Name","of","input","data","value","column","last_predicted_X_",":","`","pandas.DataFrame","`","or","None","The","``","X","``","last","passed","to","``","self.predict","(",")","``",".","Used","to","speed","up","predictions","if","the","same","``","X","``","is","passed","repeatedly",".","Resets","to","None","when","``","self.fit","(",")","``","is","called",".","cached_predictions_",":","`","pandas.DataFrame","`","or","None","The","return","value","of","the","last","call","to","``","self.predict","(",")","``",".","Used","to","speed","up","predictions","if","the","same","``","X","``","is","passed","repeatedly",".","Resets","to","None","when","``","self.fit","(",")","``","is","called","."]
docstr: Fits a model to training data
  Also fits the null model, if specified, for use in evaluating the `score` function
  
  Every subclass must call this::
      super().fit(X, y=y, time_col=time_col, value_col=value_col, **fit_params)
  
  Parameters
  ----------
  X : `pandas.DataFrame`
      Input timeseries, with timestamp column,
      value column, and any additional regressors.
      The value column is the response, included in
      ``X`` to allow transformation by `sklearn.pipeline`.
  y : ignored
      The original timeseries values, ignored.
      (The y for fitting is included in X.)
  time_col : `str`
      Time column name in X.
  value_col : `str`
      Value column name in X.
  fit_params : `dict`
      Additional parameters supported by subclass `fit` or null model.
docstr_tok: ["Fits","a","model","to","training","data","Also","fits","the","null","model",",","if","specified",",","for","use","in","evaluating","the","`","score","`","function","Every","subclass","must","call","this",":",":","super","(",")",".fit","(","X",",","y=y",",","time_col=time_col",",","value_col=value_col",",","*","*","fit_params",")","Parameters","--","--","--","--","--","X",":","`","pandas.DataFrame","`","Input","timeseries",",","with","timestamp","column",",","value","column",",","and","any","additional","regressors",".","The","value","column","is","the","response",",","included","in","``","X","``","to","allow","transformation","by","`","sklearn.pipeline","`",".","y",":","ignored","The","original","timeseries","values",",","ignored",".","(","The","y","for","fitting","is","included","in","X",".",")","time_col",":","`","str","`","Time","column","name","in","X.","value_col",":","`","str","`","Value","column","name","in","X.","fit_params",":","`","dict","`","Additional","parameters","supported","by","subclass","`","fit","`","or","null","model","."]
code: def fit(
      self,
      X,
      y=None,
      time_col=cst.TIME_COL,
      value_col=cst.VALUE_COL,
      **fit_params,
  ):
      """Fits a model to training data
      Also fits the null model, if specified, for use in evaluating the `score` function
  
      Every subclass must call this::
          super().fit(X, y=y, time_col=time_col, value_col=value_col, **fit_params)
  
      Parameters
      ----------
      X : `pandas.DataFrame`
          Input timeseries, with timestamp column,
          value column, and any additional regressors.
          The value column is the response, included in
          ``X`` to allow transformation by `sklearn.pipeline`.
      y : ignored
          The original timeseries values, ignored.
          (The y for fitting is included in X.)
      time_col : `str`
          Time column name in X.
      value_col : `str`
          Value column name in X.
      fit_params : `dict`
          Additional parameters supported by subclass `fit` or null model.
      """
      self.time_col_ = (
          time_col  # to be used in `predict` to select proper column
      )
      self.value_col_ = value_col
      # Null model must be initialized here, otherwise scikit-learn
      # grid search will not be able to set the parameters.
      # See https://scikit-learn.org/stable/developers/develop.html#instantiation.
      if self.null_model_params is not None:
          # Adds score function to null model parameters, and initializes null model
          self.null_model_params["score_func"] = self.score_func
          self.null_model = DummyEstimator(**self.null_model_params)
          # Passes `sample_weight` rather than `**fit_params` to avoid unexpected keyword argument from the main
          #   estimator's parameters
          sample_weight = fit_params.get("sample_weight")
          self.null_model.fit(
              X,
              y=y,
              time_col=time_col,
              value_col=value_col,
              sample_weight=sample_weight,
          )
  
      # Clears the cached result, because it is no longer valid for the updated model
      self.last_predicted_X_ = None
      self.cached_predictions_ = None
  
imports: from abc import ABC
  from abc import abstractmethod
  from typing import Optional
  import pandas
  from sklearn.base import BaseEstimator
  from sklearn.base import RegressorMixin
  from sklearn.metrics import mean_squared_error
  from greykite.common import constants
  from greykite.common.evaluation import r2_null_model_score
  from greykite.common.logging import LoggingLevelEnum
  from greykite.common.logging import log_message
  from greykite.sklearn.estimator.null_model import DummyEstimator
  from greykite.sklearn.uncertainty.exceptions import UncertaintyError
  from greykite.sklearn.uncertainty.uncertainty_methods import UncertaintyMethodEnum
label_desc: Use image node_id 2 for calling the BaseForecastEstimator obj's underlying member method code with example usage: obj.fit(X, y, time_col, value_col) without return types