Forecast

Autoregressive Moving Average (ARMA) Predictor

indsl.forecast.arma_predictor(data: Series, ar_order: int = 2, ma_order: int = 2, train_fraction: float = 0.8, method: MethodType = MethodType.ONESTEP, steps: int = 1) Series

ARMA predictor.

The ARMA predictor works by fitting constants to an auto regression (AR) and a moving average (MA) equation and extrapolating the results.

Parameters:
  • data – Time series.

  • ar_order – Number of AR terms.

  • ma_order – Number of MA terms.

  • train_fraction – Fraction. Fraction of the input data used for training the model.

  • method – Method. Type of prediction to perform. MULTISTEP involves forecasting several steps ahead of the training dataset, while ONESTEP involves incrementally going through the test dataset, and appending it to the training dataset by performing a one-step forecast.

  • steps – Steps. Number of steps to forecast ahead of the training dataset.

Returns:

Prediction Predicted data for the test fraction of the input data (e.g., 1 - train_fraction)

Return type:

pandas.Series

Raises:
  • UserRuntimeError – If an empty time series is passed into the function.

  • UserValueError – Incorrect values passed into keyword arguments. ar_order and ma_order should be integers, and train_fraction must be float between 0 and 1.

Triple Exponential Smoothing - Holt-Winters Predictor

indsl.forecast.holt_winters_predictor(data: Series, seasonal_periods: int, seasonality: Literal['add', 'mul'] = 'add', trend: Literal['add', 'mul'] = 'add', dampen_trend: bool = False, steps: int = 1, train_fraction: float = 0.8) Series

Triple exponential smoothing.

This technique (also known as Holt-Winters) can forecast time series data with a trend and seasonal variability. It works by utilizing exponential smoothing thrice - for the average value, the trend, and the seasonality. Values are predicted by combining the effects of these influences.

Parameters:
  • data – Time series.

  • seasonal_periods – Number of periods per cycle. The value for the seasonal periods is chosen to denote the number of timesteps within a period, e.g., 7*24 for hourly data with a weekly seasonality or 365 for daily data with a yearly pattern. Note! A time series that shows a spike every day, but not on Sunday, does not have a daily seasonality, but a weekly seasonality!

  • seasonality – Seasonality. Additive seasonality: Amount of adjustment is constant. Multiplicative seasonality: Amount of adjustment varies with the level of the series.

  • trend – Trend. Additive seasonality: Amount of adjustment is constant. Multiplicative seasonality: Amount of adjustment varies with the level of the series.

  • dampen_trend – Dampen the trend component. If the trend component shall be dampened. This method is useful to predict very far in the future, and it is reasonable to assume that the trend will not stay constant but flatten out.

  • steps – Steps. Number of steps to forecast ahead of the training dataset.

  • train_fraction – Fraction. Fraction of the input data used for training the model.

Returns:

Prediction. Predicted data for the test fraction of the input data (e.g., 1 - train_fraction).

Return type:

pandas.Series

Raises: