Skip to main content
The core methods of StatsForecast are:
source

StatsForecast

*The StatsForecast class allows you to efficiently fit multiple StatsForecast models for large sets of time series. It operates on a DataFrame df with at least three columns ids, times and targets. The class has memory-efficient StatsForecast.forecast method that avoids storing partial model outputs. While the StatsForecast.fit and StatsForecast.predict methods with Scikit-learn interface store the fitted models. The StatsForecast class offers parallelization utilities with Dask, Spark and Ray back-ends. See distributed computing example here.*

source

StatsForecast.fit

*Fit statistical models. Fit models to a large set of time series from DataFrame df and store fitted models for later inspection.*
source

SatstForecast.predict

*Predict statistical models. Use stored fitted models to predict large set of time series from DataFrame df.*
source

StatsForecast.fit_predict

*Fit and Predict with statistical models. This method avoids memory burden due from object storage. It is analogous to Scikit-Learn fit_predict without storing information. It requires the forecast horizon h in advance. In contrast to StatsForecast.forecast this method stores partial models outputs.*
source

StatsForecast.forecast

*Memory Efficient predictions. This method avoids memory burden due from object storage. It is analogous to Scikit-Learn fit_predict without storing information. It requires the forecast horizon h in advance.*

source

StatsForecast.forecast_fitted_values

*Access insample predictions. After executing StatsForecast.forecast, you can access the insample prediction values for each model. To get them, you need to pass fitted=True to the StatsForecast.forecast method and then use the StatsForecast.forecast_fitted_values method.*

source

StatsForecast.cross_validation

*Temporal Cross-Validation. Efficiently fits a list of StatsForecast models through multiple training windows, in either chained or rolled manner. StatsForecast.models’ speed allows to overcome this evaluation technique high computational costs. Temporal cross-validation provides better model’s generalization measurements by increasing the test’s length and diversity.*

source

StatsForecast.cross_validation_fitted_values

*Access insample cross validated predictions. After executing StatsForecast.cross_validation, you can access the insample prediction values for each model and window. To get them, you need to pass fitted=True to the StatsForecast.cross_validation method and then use the StatsForecast.cross_validation_fitted_values method.*

source

StatsForecast.plot

Plot forecasts and insample values.
source

StatsForecast.save

Function that will save StatsForecast class with certain settings to make it reproducible.
source

StatsForecast.load

Automatically loads the model into ready StatsForecast.

Misc

Integer datestamp

The StatsForecast class can also receive integers as datestamp, the following example shows how to do it.

External regressors

Every column after y is considered an external regressor and will be passed to the models that allow them. If you use them you must supply the future values to the StatsForecast.forecast method.

Prediction intervals

You can pass the argument level to the StatsForecast.forecast method to calculate prediction intervals. Not all models can calculate them at the moment, so we will only obtain the intervals of those models that have it implemented.

Conformal Prediction intervals

You can also add conformal intervals using the following code.
You can also compute conformal intervals for all the models that support them, using the following,