class_docstr: Base class for interfacing pmdarima.
class_docstr_tok: ["Base","class","for","interfacing","pmdarima","."]
docstr: Generate in sample predictions.
  
  Parameters
  ----------
  fh : array-like
      The forecasters horizon with the steps ahead to to predict.
      Default is
      one-step ahead forecast, i.e. np.array([1]).
  
  Returns
  -------
  y_pred : pandas.Series
      Returns series of predicted values.
docstr_tok: ["Generate","in","sample","predictions",".","Parameters","--","--","--","--","--","fh",":","array-like","The","forecasters","horizon","with","the","steps","ahead","to","to","predict",".","Default","is","one-step","ahead","forecast",",","i.e",".","np.array","(","[","1","]",")",".","Returns","--","--","--","-","y_pred",":","pandas.Series","Returns","series","of","predicted","values","."]
code: def _predict_in_sample(
      self, fh, X=None, return_pred_int=False, alpha=DEFAULT_ALPHA
  ):
      """Generate in sample predictions.
  
      Parameters
      ----------
      fh : array-like
          The forecasters horizon with the steps ahead to to predict.
          Default is
          one-step ahead forecast, i.e. np.array([1]).
  
      Returns
      -------
      y_pred : pandas.Series
          Returns series of predicted values.
      """
      if hasattr(self, "order"):
          diff_order = self.order[1]
      else:
          diff_order = self._forecaster.model_.order[1]
  
      # Initialize return objects
      fh_abs = fh.to_absolute(self.cutoff).to_numpy()
      fh_idx = fh.to_indexer(self.cutoff, from_cutoff=False)
      y_pred = pd.Series(index=fh_abs, dtype="float64")
  
      # for in-sample predictions, pmdarima requires zero-based integer indices
      start, end = fh.to_absolute_int(self._y.index[0], self.cutoff)[
          [0, -1]
      ]
      if start < 0:
          # Can't forecasts earlier to train starting point
          raise ValueError(
              "Can't make predictions earlier to train starting point"
          )
      elif start < diff_order:
          # Can't forecasts earlier to arima's differencing order
          # But we return NaN for these supposedly forecastable points
          start = diff_order
          if end < start:
              # since we might have forced `start` to surpass `end`
              end = diff_order
          # get rid of unforcastable points
          fh_abs = fh_abs[fh_idx >= diff_order]
          # reindex accordingly
          fh_idx = fh_idx[fh_idx >= diff_order] - diff_order
  
      result = self._forecaster.predict_in_sample(
          start=start,
          end=end,
          X=X,
          return_conf_int=False,
          alpha=DEFAULT_ALPHA,
      )
  
      if return_pred_int:
          pred_ints = []
          for a in alpha:
              pred_int = pd.DataFrame(
                  index=fh_abs, columns=["lower", "upper"]
              )
              result = self._forecaster.predict_in_sample(
                  start=start,
                  end=end,
                  X=X,
                  return_conf_int=return_pred_int,
                  alpha=a,
              )
              pred_int.loc[fh_abs] = result[1][fh_idx, :]
              pred_ints.append(pred_int)
          # unpack results
          result = pd.Series(result[0]).iloc[fh_idx]
          y_pred.loc[fh_abs] = result
          return y_pred, pred_ints
      else:
          result = pd.Series(result).iloc[fh_idx]
          y_pred.loc[fh_abs] = result
          return y_pred
  
file_path: sktime/sktime/forecasting/base/adapters/_pmdarima.py
imports: import pandas
  from sktime.datatypes._utilities import get_slice
  from sktime.forecasting.base import BaseForecaster
  from sktime.forecasting.base._base import DEFAULT_ALPHA
label_desc: Use image node_id 6 for calling the _PmdArimaAdapter obj's underlying member method code with example usage: obj._predict_in_sample(fh, X, return_pred_int, alpha) and returns: y_pred,  pred_ints, y_pred