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: Compute/return variance forecasts.
  
  State required:
      Requires state to be "fitted".
  
  Accesses in self:
      Fitted model attributes ending in "_".
      self.cutoff, self._is_fitted
  
  Writes to self:
      Stores fh to self.fh if fh is passed and has not been passed previously.
  
  Parameters
  ----------
  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"),
          X.index must contain fh.index and y.index both
  cov : bool, optional (default=False)
      if True, computes covariance matrix forecast.
      if False, computes marginal variance forecasts.
  
  Returns
  -------
  pred_var : pd.DataFrame, format dependent on `cov` variable
      If cov=False:
          Column names are exactly those of `y` passed in `fit`/`update`.
              For nameless formats, column index will be a RangeIndex.
          Row index is fh, with additional levels equal to instance levels,
              from y seen in fit, if y seen in fit was Panel or Hierarchical.
          Entries are variance forecasts, for var in col index.
          A variance forecast for given variable and fh index is a predicted
              variance for that variable and index, given observed data.
      If cov=True:
          Column index is a multiindex: 1st level is variable names (as above)
              2nd level is fh.
          Row index is fh, with additional levels equal to instance levels,
              from y seen in fit, if y seen in fit was Panel or Hierarchical.
          Entries are (co-)variance forecasts, for var in col index, and
              covariance between time index in row and col.
          Note: no covariance forecasts are returned between different variables.
docstr_tok: ["Compute\/return","variance","forecasts",".","State","required",":","Requires","state","to","be","``","fitted","''",".","Accesses","in","self",":","Fitted","model","attributes","ending","in","``","_","''",".","self.cutoff",",","self._is_fitted","Writes","to","self",":","Stores","fh","to","self.fh","if","fh","is","passed","and","has","not","been","passed","previously",".","Parameters","--","--","--","--","--","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","''",")",",","X.index","must","contain","fh.index","and","y.index","both","cov",":","bool",",","optional","(","default=False",")","if","True",",","computes","covariance","matrix","forecast",".","if","False",",","computes","marginal","variance","forecasts",".","Returns","--","--","--","-","pred_var",":","pd.DataFrame",",","format","dependent","on","`","cov","`","variable","If","cov=False",":","Column","names","are","exactly","those","of","`","y","`","passed","in","`","fit","`","\/","`","update","`",".","For","nameless","formats",",","column","index","will","be","a","RangeIndex",".","Row","index","is","fh",",","with","additional","levels","equal","to","instance","levels",",","from","y","seen","in","fit",",","if","y","seen","in","fit","was","Panel","or","Hierarchical",".","Entries","are","variance","forecasts",",","for","var","in","col","index",".","A","variance","forecast","for","given","variable","and","fh","index","is","a","predicted","variance","for","that","variable","and","index",",","given","observed","data",".","If","cov=True",":","Column","index","is","a","multiindex",":","1st","level","is","variable","names","(","as","above",")","2nd","level","is","fh",".","Row","index","is","fh",",","with","additional","levels","equal","to","instance","levels",",","from","y","seen","in","fit",",","if","y","seen","in","fit","was","Panel","or","Hierarchical",".","Entries","are","(","co-",")","variance","forecasts",",","for","var","in","col","index",",","and","covariance","between","time","index","in","row","and","col",".","Note",":","no","covariance","forecasts","are","returned","between","different","variables","."]
code: def predict_var(self, fh=None, X=None, cov=False):
      """Compute/return variance forecasts.
  
      State required:
          Requires state to be "fitted".
  
      Accesses in self:
          Fitted model attributes ending in "_".
          self.cutoff, self._is_fitted
  
      Writes to self:
          Stores fh to self.fh if fh is passed and has not been passed previously.
  
      Parameters
      ----------
      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"),
              X.index must contain fh.index and y.index both
      cov : bool, optional (default=False)
          if True, computes covariance matrix forecast.
          if False, computes marginal variance forecasts.
  
      Returns
      -------
      pred_var : pd.DataFrame, format dependent on `cov` variable
          If cov=False:
              Column names are exactly those of `y` passed in `fit`/`update`.
                  For nameless formats, column index will be a RangeIndex.
              Row index is fh, with additional levels equal to instance levels,
                  from y seen in fit, if y seen in fit was Panel or Hierarchical.
              Entries are variance forecasts, for var in col index.
              A variance forecast for given variable and fh index is a predicted
                  variance for that variable and index, given observed data.
          If cov=True:
              Column index is a multiindex: 1st level is variable names (as above)
                  2nd level is fh.
              Row index is fh, with additional levels equal to instance levels,
                  from y seen in fit, if y seen in fit was Panel or Hierarchical.
              Entries are (co-)variance forecasts, for var in col index, and
                  covariance between time index in row and col.
              Note: no covariance forecasts are returned between different variables.
      """
      if not self.get_tag("capability:pred_int"):
          raise NotImplementedError(
              f"{self.__class__.__name__} does not have the capability to return "
              "variance predictions. If you "
              "think this estimator should have the capability, please open "
              "an issue on sktime."
          )
      self.check_is_fitted()
      # input checks
      fh = self._check_fh(fh)
  
      # check and convert X
      X_inner = self._check_X(X=X)
  
      # we call the ordinary _predict_interval if no looping/vectorization needed
      if not self._is_vectorized:
          pred_var = self._predict_var(fh=fh, X=X_inner, cov=cov)
      else:
          # otherwise we call the vectorized version of predict_interval
          pred_var = self._vectorize(
              "predict_var", fh=fh, X=X_inner, cov=cov
          )
  
      return pred_var
  
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 12 for calling the BaseForecaster obj's underlying member method code with example usage: obj.predict_var(fh, X, cov) and returns: pred_var