MovingAverageModel

class MovingAverageModel(window: int = 5)[source]

Bases: etna.models.seasonal_ma.SeasonalMovingAverageModel

MovingAverageModel averages previous series values to forecast future one.

\[y_{t} = \frac{\sum_{i=1}^{n} y_{t-i} }{n},\]

where \(n\) is window size.

Notes

This model supports in-sample and out-of-sample prediction decomposition. Prediction components are corresponding target lags with weights of \(1/window\).

Init MovingAverageModel.

Parameters

window (int) – number of history points to average

Inherited-members

Methods

fit(ts)

Fit model.

forecast(ts, prediction_size[, ...])

Make autoregressive forecasts.

get_model()

Get internal model.

load(path)

Load an object.

params_to_tune()

Get default grid for tuning hyperparameters.

predict(ts, prediction_size[, return_components])

Make predictions using true values as autoregression context (teacher forcing).

save(path)

Save the object.

set_params(**params)

Return new object instance with modified parameters.

to_dict()

Collect all information about etna object in dict.

Attributes

context_size

Context size of the model.