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 and forecast time series at future horizon.
  
  Same as ``fit(y, X, fh).predict(X_pred)``.
  If ``X_pred`` is not passed, same as
  ``fit(y, fh, X).predict(X)``.
  
  State change:
      Changes state to "fitted".
  
  Writes to self:
      Sets 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.
  
  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 (not optional)
      The forecasting horizon encoding the time stamps to forecast at.
      if has not been passed 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 in fit
      If ``self.get_tag("X-y-must-have-same-index")`` is True,
      X.index must contain y.index.
      If, in addition, X_pred is not passed, X must also contain fh.index.
  X_pred : time series in sktime compatible format, optional (default=None)
      Exogeneous time series to use in predict
      If passed, will be used in predict instead of X.
      If ``self.get_tag("X-y-must-have-same-index")`` is True,
      X_pred.index must contain fh.index.
  
  Returns
  -------
  y_pred : time series in sktime compatible data container format
      Point forecasts at fh, with same index as fh
      y_pred has same type as the y that has been passed most recently:
          Series, Panel, Hierarchical scitype, same format (see above)
docstr_tok: ["Fit","and","forecast","time","series","at","future","horizon",".","Same","as","``","fit","(","y",",","X",",","fh",")",".predict","(","X_pred",")","``",".","If","``","X_pred","``","is","not","passed",",","same","as","``","fit","(","y",",","fh",",","X",")",".predict","(","X",")","``",".","State","change",":","Changes","state","to","``","fitted","''",".","Writes","to","self",":","Sets","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",".","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","(","not","optional",")","The","forecasting","horizon","encoding","the","time","stamps","to","forecast","at",".","if","has","not","been","passed","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","in","fit","If","``","self.get_tag","(","``","X-y-must-have-same-index","''",")","``","is","True",",","X.index","must","contain","y.index",".","If",",","in","addition",",","X_pred","is","not","passed",",","X","must","also","contain","fh.index",".","X_pred",":","time","series","in","sktime","compatible","format",",","optional","(","default=None",")","Exogeneous","time","series","to","use","in","predict","If","passed",",","will","be","used","in","predict","instead","of","X",".","If","``","self.get_tag","(","``","X-y-must-have-same-index","''",")","``","is","True",",","X_pred.index","must","contain","fh.index",".","Returns","--","--","--","-","y_pred",":","time","series","in","sktime","compatible","data","container","format","Point","forecasts","at","fh",",","with","same","index","as","fh","y_pred","has","same","type","as","the","y","that","has","been","passed","most","recently",":","Series",",","Panel",",","Hierarchical","scitype",",","same","format","(","see","above",")"]
code: def fit_predict(self, y, X=None, fh=None, X_pred=None):
      """Fit and forecast time series at future horizon.
  
      Same as ``fit(y, X, fh).predict(X_pred)``.
      If ``X_pred`` is not passed, same as
      ``fit(y, fh, X).predict(X)``.
  
      State change:
          Changes state to "fitted".
  
      Writes to self:
          Sets 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.
  
      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 (not optional)
          The forecasting horizon encoding the time stamps to forecast at.
          if has not been passed 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 in fit
          If ``self.get_tag("X-y-must-have-same-index")`` is True,
          X.index must contain y.index.
          If, in addition, X_pred is not passed, X must also contain fh.index.
      X_pred : time series in sktime compatible format, optional (default=None)
          Exogeneous time series to use in predict
          If passed, will be used in predict instead of X.
          If ``self.get_tag("X-y-must-have-same-index")`` is True,
          X_pred.index must contain fh.index.
  
      Returns
      -------
      y_pred : time series in sktime compatible data container format
          Point forecasts at fh, with same index as fh
          y_pred has same type as the y that has been passed most recently:
              Series, Panel, Hierarchical scitype, same format (see above)
      """
      # if X_pred is passed, run fit/predict with different X
      if X_pred is not None:
          return self.fit(y=y, X=X, fh=fh).predict(X=X_pred)
      # otherwise, we use the same X for fit and predict
      # below code carries out conversion and checks for X only once
  
      # if fit is called, fitted state is re-set
      self._is_fitted = False
  
      # 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)
  
      fh = self._check_fh(fh)
  
      # apply fit and then predict
      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)
  
      self._is_fitted = True
      # call the public predict to avoid duplicating output conversions
      #  input conversions are skipped since we are using X_inner
      return self.predict(fh=fh, X=X_inner)
  
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 9 for calling the BaseForecaster obj's underlying member method code with example usage: obj.fit_predict(y, X, fh, X_pred) and returns: self, self