class_docstr: Base forecaster template class.
  
  The base forecaster specifies the methods and method signatures that all forecasters
  have to implement.
  
  Specific implementations of these methods is deferred to concrete forecasters.
class_docstr_tok: ["Base","forecaster","template","class",".","The","base","forecaster","specifies","the","methods","and","method","signatures","that","all","forecasters","have","to","implement",".","Specific","implementations","of","these","methods","is","deferred","to","concrete","forecasters","."]
docstr: Fit forecaster to training data.
  
  State change:
      Changes state to "fitted".
  
  Writes to self:
      Sets self._is_fitted flag to True.
      Writes self._y and self._X with `y` and `X`, respectively.
      Sets self.cutoff and self._cutoff to last index seen in `y`.
      Sets fitted model attributes ending in "_".
      Stores fh to self.fh if fh is passed.
  
  Parameters
  ----------
  y : time series in sktime compatible data container format
          Time series to which to fit the forecaster.
      y can be in one of the following formats:
      Series scitype: pd.Series, pd.DataFrame, or np.ndarray (1D or 2D)
          for vanilla forecasting, one time series
      Panel scitype: pd.DataFrame with 2-level row MultiIndex,
          3D np.ndarray, list of Series pd.DataFrame, or nested pd.DataFrame
          for global or panel forecasting
      Hierarchical scitype: pd.DataFrame with 3 or more level row MultiIndex
          for hierarchical forecasting
      Number of columns admissible depend on the "scitype:y" tag:
          if self.get_tag("scitype:y")=="univariate":
              y must have a single column/variable
          if self.get_tag("scitype:y")=="multivariate":
              y must have 2 or more columns
          if self.get_tag("scitype:y")=="both": no restrictions on columns apply
      For further details:
          on usage, see forecasting tutorial examples/01_forecasting.ipynb
          on specification of formats, examples/AA_datatypes_and_datasets.ipynb
  fh : int, list, np.array or ForecastingHorizon, optional (default=None)
      The forecasting horizon encoding the time stamps to forecast at.
      if self.get_tag("requires-fh-in-fit"), must be passed, not optional
  X : time series in sktime compatible format, optional (default=None)
          Exogeneous time series to fit to
      Should be of same scitype (Series, Panel, or Hierarchical) as y
      if self.get_tag("X-y-must-have-same-index"), X.index must contain y.index
      there are no restrictions on number of columns (unlike for y)
  
  Returns
  -------
  self : Reference to self.
docstr_tok: ["Fit","forecaster","to","training","data",".","State","change",":","Changes","state","to","``","fitted","''",".","Writes","to","self",":","Sets","self._is_fitted","flag","to","True",".","Writes","self._y","and","self._X","with","`","y","`","and","`","X","`",",","respectively",".","Sets","self.cutoff","and","self._cutoff","to","last","index","seen","in","`","y","`",".","Sets","fitted","model","attributes","ending","in","``","_","''",".","Stores","fh","to","self.fh","if","fh","is","passed",".","Parameters","--","--","--","--","--","y",":","time","series","in","sktime","compatible","data","container","format","Time","series","to","which","to","fit","the","forecaster",".","y","can","be","in","one","of","the","following","formats",":","Series","scitype",":","pd.Series",",","pd.DataFrame",",","or","np.ndarray","(","1D","or","2D",")","for","vanilla","forecasting",",","one","time","series","Panel","scitype",":","pd.DataFrame","with","2-level","row","MultiIndex",",","3D","np.ndarray",",","list","of","Series","pd.DataFrame",",","or","nested","pd.DataFrame","for","global","or","panel","forecasting","Hierarchical","scitype",":","pd.DataFrame","with","3","or","more","level","row","MultiIndex","for","hierarchical","forecasting","Number","of","columns","admissible","depend","on","the","``","scitype",":","y","''","tag",":","if","self.get_tag","(","``","scitype",":","y","''",")","==","''","univariate","''",":","y","must","have","a","single","column\/variable","if","self.get_tag","(","``","scitype",":","y","''",")","==","''","multivariate","''",":","y","must","have","2","or","more","columns","if","self.get_tag","(","``","scitype",":","y","''",")","==","''","both","''",":","no","restrictions","on","columns","apply","For","further","details",":","on","usage",",","see","forecasting","tutorial","examples\/01_forecasting.ipynb","on","specification","of","formats",",","examples\/AA_datatypes_and_datasets.ipynb","fh",":","int",",","list",",","np.array","or","ForecastingHorizon",",","optional","(","default=None",")","The","forecasting","horizon","encoding","the","time","stamps","to","forecast","at",".","if","self.get_tag","(","``","requires-fh-in-fit","''",")",",","must","be","passed",",","not","optional","X",":","time","series","in","sktime","compatible","format",",","optional","(","default=None",")","Exogeneous","time","series","to","fit","to","Should","be","of","same","scitype","(","Series",",","Panel",",","or","Hierarchical",")","as","y","if","self.get_tag","(","``","X-y-must-have-same-index","''",")",",","X.index","must","contain","y.index","there","are","no","restrictions","on","number","of","columns","(","unlike","for","y",")","Returns","--","--","--","-","self",":","Reference","to","self","."]
code: def fit(self, y, X=None, fh=None):
      """Fit forecaster to training data.
  
      State change:
          Changes state to "fitted".
  
      Writes to self:
          Sets self._is_fitted flag to True.
          Writes self._y and self._X with `y` and `X`, respectively.
          Sets self.cutoff and self._cutoff to last index seen in `y`.
          Sets fitted model attributes ending in "_".
          Stores fh to self.fh if fh is passed.
  
      Parameters
      ----------
      y : time series in sktime compatible data container format
              Time series to which to fit the forecaster.
          y can be in one of the following formats:
          Series scitype: pd.Series, pd.DataFrame, or np.ndarray (1D or 2D)
              for vanilla forecasting, one time series
          Panel scitype: pd.DataFrame with 2-level row MultiIndex,
              3D np.ndarray, list of Series pd.DataFrame, or nested pd.DataFrame
              for global or panel forecasting
          Hierarchical scitype: pd.DataFrame with 3 or more level row MultiIndex
              for hierarchical forecasting
          Number of columns admissible depend on the "scitype:y" tag:
              if self.get_tag("scitype:y")=="univariate":
                  y must have a single column/variable
              if self.get_tag("scitype:y")=="multivariate":
                  y must have 2 or more columns
              if self.get_tag("scitype:y")=="both": no restrictions on columns apply
          For further details:
              on usage, see forecasting tutorial examples/01_forecasting.ipynb
              on specification of formats, examples/AA_datatypes_and_datasets.ipynb
      fh : int, list, np.array or ForecastingHorizon, optional (default=None)
          The forecasting horizon encoding the time stamps to forecast at.
          if self.get_tag("requires-fh-in-fit"), must be passed, not optional
      X : time series in sktime compatible format, optional (default=None)
              Exogeneous time series to fit to
          Should be of same scitype (Series, Panel, or Hierarchical) as y
          if self.get_tag("X-y-must-have-same-index"), X.index must contain y.index
          there are no restrictions on number of columns (unlike for y)
  
      Returns
      -------
      self : Reference to self.
      """
      # check y is not None
      assert y is not None, "y cannot be None, but found None"
  
      # if fit is called, estimator is reset, including fitted state
      self.reset()
  
      # check and convert X/y
      X_inner, y_inner = self._check_X_y(X=X, y=y)
  
      # set internal X/y to the new X/y
      # this also updates cutoff from y
      self._update_y_X(y_inner, X_inner)
  
      # check forecasting horizon and coerce to ForecastingHorizon object
      fh = self._check_fh(fh)
  
      # checks and conversions complete, pass to inner fit
      #####################################################
      vectorization_needed = isinstance(y_inner, VectorizedDF)
      self._is_vectorized = vectorization_needed
      # we call the ordinary _fit if no looping/vectorization needed
      if not vectorization_needed:
          self._fit(y=y_inner, X=X_inner, fh=fh)
      else:
          # otherwise we call the vectorized version of fit
          self._vectorize("fit", y=y_inner, X=X_inner, fh=fh)
  
      # this should happen last
      self._is_fitted = True
  
      return self
  
imports: from copy import deepcopy
  from itertools import product
  import numpy
  import pandas
  from sktime.base import BaseEstimator
  from sktime.datatypes import VectorizedDF, check_is_scitype, convert_to, get_cutoff, mtype_to_scitype, scitype_to_mtype, update_data
  from sktime.forecasting.base._fh import ForecastingHorizon
  from sktime.utils.datetime import _shift
  from sktime.utils.validation._dependencies import _check_estimator_deps
  from sktime.utils.validation.forecasting import check_alpha, check_cv, check_fh, check_X
  from sktime.utils.validation.series import check_equal_time_index
  from sktime.utils.warnings import warn
label_desc: Use image node_id 7 for calling the BaseForecaster obj's underlying member method code with example usage: obj.fit(y, X, fh) and returns: self