class_docstr: Base class for interfacing prophet and neuralprophet.
class_docstr_tok: ["Base","class","for","interfacing","prophet","and","neuralprophet","."]
docstr: Compute/return prediction quantiles for a forecast.
  
  private _predict_interval containing the core logic,
      called from predict_interval and possibly predict_quantiles
  
  State required:
      Requires state to be "fitted".
  
  Accesses in self:
      Fitted model attributes ending in "_"
      self.cutoff
  
  Parameters
  ----------
  fh : int, list, np.array or ForecastingHorizon
      Forecasting horizon, default = y.index (in-sample forecast)
  X : pd.DataFrame, optional (default=None)
      Exogenous time series
  coverage : list of float (guaranteed not None and floats in [0,1] interval)
     nominal coverage(s) of predictive interval(s)
  
  Returns
  -------
  pred_int : pd.DataFrame
      Column has multi-index: first level is variable name from y in fit,
          second level coverage fractions for which intervals were computed.
              in the same order as in input `coverage`.
          Third level is string "lower" or "upper", for lower/upper interval end.
      Row index is fh. Entries are forecasts of lower/upper interval end,
          for var in col index, at nominal coverage in second col index,
          lower/upper depending on third col index, for the row index.
          Upper/lower interval end forecasts are equivalent to
          quantile forecasts at alpha = 0.5 - c/2, 0.5 + c/2 for c in coverage.
docstr_tok: ["Compute\/return","prediction","quantiles","for","a","forecast",".","private","_predict_interval","containing","the","core","logic",",","called","from","predict_interval","and","possibly","predict_quantiles","State","required",":","Requires","state","to","be","``","fitted","''",".","Accesses","in","self",":","Fitted","model","attributes","ending","in","``","_","''","self.cutoff","Parameters","--","--","--","--","--","fh",":","int",",","list",",","np.array","or","ForecastingHorizon","Forecasting","horizon",",","default","=","y.index","(","in-sample","forecast",")","X",":","pd.DataFrame",",","optional","(","default=None",")","Exogenous","time","series","coverage",":","list","of","float","(","guaranteed","not","None","and","floats","in","[","0,1","]","interval",")","nominal","coverage","(","s",")","of","predictive","interval","(","s",")","Returns","--","--","--","-","pred_int",":","pd.DataFrame","Column","has","multi-index",":","first","level","is","variable","name","from","y","in","fit",",","second","level","coverage","fractions","for","which","intervals","were","computed",".","in","the","same","order","as","in","input","`","coverage","`",".","Third","level","is","string","``","lower","''","or","``","upper","''",",","for","lower\/upper","interval","end",".","Row","index","is","fh",".","Entries","are","forecasts","of","lower\/upper","interval","end",",","for","var","in","col","index",",","at","nominal","coverage","in","second","col","index",",","lower\/upper","depending","on","third","col","index",",","for","the","row","index",".","Upper\/lower","interval","end","forecasts","are","equivalent","to","quantile","forecasts","at","alpha","=","0.5","-","c\/2",",","0.5","+","c\/2","for","c","in","coverage","."]
code: def _predict_interval(self, fh, X, coverage):
      """Compute/return prediction quantiles for a forecast.
  
      private _predict_interval containing the core logic,
          called from predict_interval and possibly predict_quantiles
  
      State required:
          Requires state to be "fitted".
  
      Accesses in self:
          Fitted model attributes ending in "_"
          self.cutoff
  
      Parameters
      ----------
      fh : int, list, np.array or ForecastingHorizon
          Forecasting horizon, default = y.index (in-sample forecast)
      X : pd.DataFrame, optional (default=None)
          Exogenous time series
      coverage : list of float (guaranteed not None and floats in [0,1] interval)
         nominal coverage(s) of predictive interval(s)
  
      Returns
      -------
      pred_int : pd.DataFrame
          Column has multi-index: first level is variable name from y in fit,
              second level coverage fractions for which intervals were computed.
                  in the same order as in input `coverage`.
              Third level is string "lower" or "upper", for lower/upper interval end.
          Row index is fh. Entries are forecasts of lower/upper interval end,
              for var in col index, at nominal coverage in second col index,
              lower/upper depending on third col index, for the row index.
              Upper/lower interval end forecasts are equivalent to
              quantile forecasts at alpha = 0.5 - c/2, 0.5 + c/2 for c in coverage.
      """
      fh = self._get_prophet_fh()
  
      X = self._convert_X_for_exog(X, fh)
  
      # prepare the return DataFrame - empty with correct cols
      var_names = self._get_varnames()
      var_name = var_names[0]
  
      int_idx = pd.MultiIndex.from_product(
          [var_names, coverage, ["lower", "upper"]]
      )
      pred_int = pd.DataFrame(columns=int_idx)
  
      # prepare the DataFrame to pass to prophet
      df = pd.DataFrame({"ds": fh}, index=fh)
      if X is not None:
          df, X = _merge_X(df, X)
  
      for c in coverage:
          # override parameters in prophet - this is fine since only called in predict
          self._forecaster.interval_width = c
          self._forecaster.uncertainty_samples = (
              self.uncertainty_samples
          )
  
          # call wrapped prophet, get prediction
          out_prophet = self._forecaster.predict(df)
          # put the index (in ds column) back in the index
          out_prophet.set_index("ds", inplace=True)
          out_prophet.index.name = None
          out_prophet = out_prophet[["yhat_lower", "yhat_upper"]]
  
          # retrieve lower/upper and write in pred_int return frame
          # instead of writing lower to lower, upper to upper
          #  we take the min/max for lower and upper
          #  because prophet (erroneously?) uses MC independent for upper/lower
          #  so if coverage is small, it can happen that upper < lower in prophet
          pred_int[(var_name, c, "lower")] = out_prophet.min(axis=1)
          pred_int[(var_name, c, "upper")] = out_prophet.max(axis=1)
  
      if self.y_index_was_int_ or self.y_index_was_period_:
          pred_int.index = self.fh.to_absolute_index(cutoff=self.cutoff)
  
      return pred_int
  
imports: import os
  import pandas
  from sktime.forecasting.base import BaseForecaster
label_desc: Use image node_id 8 for calling the _ProphetAdapter obj's underlying member method code with example usage: obj._predict_interval(fh, X, coverage) and returns: pred_int