_SeasonalMovingAverageModel¶
- class _SeasonalMovingAverageModel(window: int = 5, seasonality: int = 7)[source]¶
Bases:
object
Seasonal moving average.
where
is seasonality, is window size (how many history values are taken for forecast).Initialize seasonal moving average model.
Length of the context is
window * seasonality
.- Parameters
window (int) – Number of values taken for forecast for each point.
seasonality (int) – Lag between values taken for forecast.
- Inherited-members
Methods
fit
(df, regressors)Fit SeasonalMovingAverage model.
forecast
(df, prediction_size)Compute autoregressive forecasts.
predict
(df, prediction_size)Compute predictions using true target data as context.
- fit(df: pandas.core.frame.DataFrame, regressors: List[str]) etna.models.seasonal_ma._SeasonalMovingAverageModel [source]¶
Fit SeasonalMovingAverage model.
- Parameters
df (pandas.core.frame.DataFrame) – Data to fit on
regressors (List[str]) – List of the columns with regressors(ignored in this model)
- Returns
Fitted model
- Return type
- forecast(df: pandas.core.frame.DataFrame, prediction_size: int) numpy.ndarray [source]¶
Compute autoregressive forecasts.
- Parameters
df (pandas.core.frame.DataFrame) – Features dataframe.
prediction_size (int) – Number of last timestamps to leave after making prediction. Previous timestamps will be used as a context for models that require it.
- Returns
Array with predictions.
- Raises
ValueError: – if context isn’t big enough
ValueError: – if forecast context contains NaNs
- Return type
numpy.ndarray
- predict(df: pandas.core.frame.DataFrame, prediction_size: int) numpy.ndarray [source]¶
Compute predictions using true target data as context.
- Parameters
df (pandas.core.frame.DataFrame) – Features dataframe.
prediction_size (int) – Number of last timestamps to leave after making prediction. Previous timestamps will be used as a context for models that require it.
- Returns
Array with predictions.
- Raises
ValueError: – if context isn’t big enough
ValueError: – if there are NaNs in a target column on timestamps that are required to make predictions
- Return type
numpy.ndarray