sktime.forecasting.theta

class sktime.forecasting.theta.ThetaForecaster(initial_level=None, deseasonalize=True, sp=1)[source]

Bases: sktime.forecasting.exp_smoothing.ExponentialSmoothing

Theta method of forecasting.

The theta method as defined in 1 is equivalent to simple exponential smoothing (SES) with drift. This is demonstrated in 2.

The series is tested for seasonality using the test outlined in A&N. If deemed seasonal, the series is seasonally adjusted using a classical multiplicative decomposition before applying the theta method. The resulting forecasts are then reseasonalised.

In cases where SES results in a constant forecast, the theta forecaster will revert to predicting the SES constant plus a linear trend derived from the training data.

Prediction intervals are computed using the underlying state space model.

Parameters
  • initial_level (float, optional) – The alpha value of the simple exponential smoothing, if the value is set then this will be used, otherwise it will be estimated from the data.

  • deseasonalize (bool, optional (default=True)) – If True, data is seasonally adjusted.

  • sp (int, optional (default=1)) – The number of observations that constitute a seasonal period for a multiplicative deseasonaliser, which is used if seasonality is detected in the training data. Ignored if a deseasonaliser transformer is provided. Default is 1 (no seasonality).

initial_level_[source]

The estimated alpha value of the SES fit.

Type

float

drift_[source]

The estimated drift of the fitted model.

Type

float

se_[source]

The standard error of the predictions. Used to calculate prediction intervals.

Type

float

References

1

`Assimakopoulos, V. and Nikolopoulos, K. The theta model: a

decomposition

approach to forecasting. International Journal of Forecasting 16, 521-530, 2000. <https://www.sciencedirect.com/science/article/pii /S0169207000000662>`_

2

Hyndman, Rob J., and Billah, Baki. Unmasking the Theta method. International J. Forecasting, 19, 287-290, 2003.

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.

update(y, X=None, update_params=True)[source]

Update cutoff value and, optionally, fitted parameters.

This is useful in an online learning setting where new data is observed as time moves on. Updating the cutoff value allows to generate new predictions from the most recent time point that was observed. Updating the fitted parameters allows to incrementally update the parameters without having to completely refit. However, note that if no estimator-specific update method has been implemented for updating parameters refitting is the default fall-back option.

Parameters
  • y (pd.Series) –

  • X (pd.DataFrame) –

  • update_params (bool, optional (default=True)) –

Returns

self

Return type

an instance of self