sktime.forecasting.naive

class sktime.forecasting.naive.NaiveForecaster(strategy='last', window_length=None, sp=1)[source]

Bases: sktime.forecasting.base._sktime._OptionalForecastingHorizonMixin, sktime.forecasting.base._sktime._BaseWindowForecaster

NaiveForecaster is a forecaster that makes forecasts using simple strategies.

Parameters
  • strategy (str{"last", "mean", "drift"}, optional (default="last")) –

    Strategy used to make forecasts:

    • ”last”forecast the last value in the

      training series when sp is 1. When sp is not 1, last value of each season in the last window will be forecasted for each season.

    • ”mean”forecast the mean of last window

      of training series when sp is 1. When sp is not 1, mean of all values in a season from last window will be forecasted for each season.

    • ”drift”: forecast by fitting a line between the
      first and last point of the window and

      extrapolating it into the future

  • sp (int, optional (default=1)) – Seasonal periodicity to use in the seasonal forecasting.

  • window_length (int or None, optional (default=None)) –

    Window length to use in the mean strategy. If None, entire training

    series will be used.

fit(y, X=None, fh=None)[source]

Fit to training data.

Parameters
  • y (pd.Series) – Target time series to which to fit the forecaster.

  • fh (int, list or np.array, optional (default=None)) – The forecasters horizon with the steps ahead to to predict.

  • X (pd.DataFrame, optional (default=None)) – Exogenous variables are ignored

Returns

self

Return type

returns an instance of self.