- Auto Forecast: Automatic forecasting tools that search for the best parameters and select the best possible model. Useful for large collections of univariate time series. Includes: AutoARIMA, AutoETS, AutoTheta, AutoCES, AutoMFLES, AutoTBATS.
- ARIMA Family: AutoRegressive Integrated Moving Average models for capturing autocorrelations in time series data.
- Exponential Smoothing: Uses weighted averages of past observations where weights decrease exponentially into the past. Suitable for data with clear trend and/or seasonality.
- Baseline Models: Classical models for establishing baselines: HistoricAverage, Naive, RandomWalkWithDrift, SeasonalNaive, WindowAverage, SeasonalWindowAverage.
- Sparse or Intermittent: Models suited for series with very few non-zero observations: ADIDA, CrostonClassic, CrostonOptimized, CrostonSBA, IMAPA, TSB.
- Multiple Seasonalities: Models suited for signals with more than one clear seasonality. Useful for low-frequency data like electricity and logs: MSTL, MFLES, TBATS.
- Theta Models: Fit two theta lines to a deseasonalized time series using different techniques: Theta, OptimizedTheta, DynamicTheta, DynamicOptimizedTheta.
- ARCH/GARCH Family: Models for time series exhibiting non-constant volatility over time. Commonly used in finance.
- Machine Learning: Wrapper for scikit-learn models to be used with StatsForecast.
Automatic Forecasting
AutoARIMA
AutoARIMA
_TS
AutoARIMA model.
Automatically selects the best ARIMA (AutoRegressive Integrated Moving Average)
model using an information criterion. Default is Akaike Information Criterion (AICc).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d | Optional[int] | Order of first-differencing. | None |
D | Optional[int] | Order of seasonal-differencing. | None |
max_p | int, default=5 | Max autorregresives p. | 5 |
max_q | int, default=5 | Max moving averages q. | 5 |
max_P | int, default=2 | Max seasonal autorregresives P. | 2 |
max_Q | int, default=2 | Max seasonal moving averages Q. | 2 |
max_order | int, default=5 | Max p+q+P+Q value if not stepwise selection. | 5 |
max_d | int, default=2 | Max non-seasonal differences. | 2 |
max_D | int, default=1 | Max seasonal differences. | 1 |
start_p | int, default=2 | Starting value of p in stepwise procedure. | 2 |
start_q | int, default=2 | Starting value of q in stepwise procedure. | 2 |
start_P | int, default=1 | Starting value of P in stepwise procedure. | 1 |
start_Q | int, default=1 | Starting value of Q in stepwise procedure. | 1 |
stationary | bool, default=False | If True, restricts search to stationary models. | False |
seasonal | bool, default=True | If False, restricts search to non-seasonal models. | True |
ic | str, default=“aicc” | Information criterion to be used in model selection. | ‘aicc’ |
stepwise | bool, default=True | If True, will do stepwise selection (faster). | True |
nmodels | int, default=94 | Number of models considered in stepwise search. | 94 |
trace | bool, default=False | If True, the searched ARIMA models is reported. | False |
approximation | Optional[bool], default=False | If True, conditional sums-of-squares estimation, final MLE. | False |
method | Optional[str] | Fitting method between maximum likelihood or sums-of-squares. | None |
truncate | Optional[bool] | Observations truncated series used in model selection. | None |
test | str, default=“kpss” | Unit root test to use. See ndiffs for details. | ‘kpss’ |
test_kwargs | Optional[str] | Unit root test additional arguments. | None |
seasonal_test | str, default=“seas” | Selection method for seasonal differences. | ‘seas’ |
seasonal_test_kwargs | Optional[dict] | Seasonal unit root test arguments. | None |
allowdrift | bool, default=True | If True, drift models terms considered. | True |
allowmean | bool, default=True | If True, non-zero mean models considered. | True |
blambda | Optional[float] | Box-Cox transformation parameter. | None |
biasadj | bool, default=False | Use adjusted back-transformed mean Box-Cox. | False |
season_length | int, default=1 | Number of observations per unit of time. Ex: 24 Hourly data. | 1 |
alias | str, default=“AutoARIMA” | Custom name of the model. | ‘AutoARIMA’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
AutoARIMA.fit
y
and optionally exogenous variables (numpy array) X.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
AutoARIMA | AutoARIMA fitted model. |
AutoARIMA.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
AutoARIMA.predict_in_sample
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
AutoARIMA.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | array - like | Optional insample exogenpus of shape (t, n_x). | None |
X_future | array - like | Optional exogenous of shape (h, n_x) optional exogenous. | None |
level | List[float] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool, default=False | Whether or not returns insample predictions. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
AutoETS
AutoETS
_TS
Automatic Error, Trend, Seasonal Model.
Automatically selects the best ETS (Error, Trend, Seasonality)
model using an information criterion. Default is Akaike Information Criterion (AICc), while particular models are estimated using maximum likelihood.
The state-space equations can be determined based on their multiplicative, additive,
optimized or ommited components. The model string parameter defines the ETS equations:
E in [], T in [], and S in [].
For example when model=‘ANN’ (additive error, no trend, and no seasonality), ETS will
explore only a simple exponential smoothing.
If the component is selected as ‘Z’, it operates as a placeholder to ask the AutoETS model
to figure out the best parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_length | int, default=1 | Number of observations per unit of time. Ex: 24 Hourly data. | 1 |
model | str, default=“ZZZ” | Controlling state-space-equations. | ‘ZZZ’ |
damped | bool | A parameter that ‘dampens’ the trend. | None |
phi | float | Smoothing parameter for trend damping. Only used when damped=True. | None |
alias | str, default=“AutoETS” | Custom name of the model. | ‘AutoETS’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
AutoETS.fit
y
and optionally exogenous variables (numpy array) X.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
AutoETS | Exponential Smoothing fitted model. |
AutoETS.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
AutoETS.predict_in_sample
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
AutoETS.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | array - like | Optional insample exogenpus of shape (t, n_x). | None |
X_future | array - like | Optional exogenous of shape (h, n_x). | None |
level | List[float] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool, default=False | Whether or not returns insample predictions. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
AutoCES
AutoCES
_TS
Complex Exponential Smoothing model.
Automatically selects the best Complex Exponential Smoothing
model using an information criterion. Default is Akaike Information Criterion (AICc), while particular
models are estimated using maximum likelihood.
The state-space equations can be determined based on their simple, parial,
optimized or ommited components. The model string parameter defines the
kind of CES model: for simple CES (withous seasonality), for simple seasonality (lagged CES),
for partial seasonality (without complex part), for full seasonality (lagged CES
with real and complex seasonal parts).
If the component is selected as ‘Z’, it operates as a placeholder to ask the AutoCES model
to figure out the best parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_length | int, default=1 | Number of observations per unit of time. Ex: 24 Hourly data. | 1 |
model | str, default=“Z” | Controlling state-space-equations. | ‘Z’ |
alias | str, default=“CES” | Custom name of the model. | ‘CES’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
AutoCES.fit
y
and optionally exogenous variables (numpy array) X.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
AutoCES | Complex Exponential Smoothing fitted model. |
AutoCES.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
AutoCES.predict_in_sample
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
AutoCES.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | array - like | Optional insample exogenous of shape (t, n_x). | None |
X_future | array - like | Optional exogenpus of shape (h, n_x). | None |
level | List[float] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool, default=False | Whether or not to return insample predictions. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
AutoTheta
AutoTheta
_TS
AutoTheta model.
Automatically selects the best Theta (Standard Theta Model (‘STM’),
Optimized Theta Model (‘OTM’), Dynamic Standard Theta Model (‘DSTM’),
Dynamic Optimized Theta Model (‘DOTM’)) model using mse.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_length | int, default=1 | Number of observations per unit of time. Ex: 24 Hourly data. | 1 |
decomposition_type | str, default=“multiplicative” | Sesonal decomposition type, ‘multiplicative’ (default) or ‘additive’. | ‘multiplicative’ |
model | Optional[str] | Controlling Theta Model. By default searchs the best model. | None |
alias | str, default=“AutoTheta” | Custom name of the model. | ‘AutoTheta’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
AutoTheta.fit
y
and optionally exogenous variables (numpy array) X.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
AutoTheta | AutoTheta fitted model. |
AutoTheta.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
AutoTheta.predict_in_sample
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
AutoTheta.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | array - like | Optional insample exogenous of shape (t, n_x). | None |
X_future | array - like | Optional exogenous of shape (h, n_x). | None |
level | List[float] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool, default=False | Whether or not returns insample predictions. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
AutoMFLES
AutoMFLES
_TS
AutoMFLES
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
test_size | int | Forecast horizon used during cross validation. | required |
season_length | int or list of int, optional, default=None | Number of observations per unit of time. Ex: 24 Hourly data. | None |
n_windows | int, default=2 | Number of windows used for cross validation. | 2 |
config | dict, optional, default=None | Mapping from parameter name (from the init arguments of MFLES) to a list of values to try. If None, will use defaults. | None |
step_size | int, optional, default=None | Step size between each cross validation window. If None will be set to test_size. | None |
metric | str, default=‘smape’ | Metric used to select the best model. Possible options are: ‘smape’, ‘mape’, ‘mse’ and ‘mae’. | ‘smape’ |
verbose | bool, default=False | Print debugging information. | False |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. This is required for generating future prediction intervals. | None |
alias | str, default=‘AutoMFLES’ | Custom name of the model. | ‘AutoMFLES’ |
AutoMFLES.fit
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (t, ). | required |
X | array-like, optional, default=None | Exogenous of shape (t, n_x). | None |
| Name | Type | Description |
|---|---|---|
AutoMFLES | AutoMFLES | Fitted AutoMFLES object. |
AutoMFLES.predict
Returns:
AutoMFLES.predict_in_sample
AutoMFLES.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (t, ). | required |
h | int | Forecast horizon. | required |
X | array - like | Insample exogenous of shape (t, n_x). | None |
X_future | array - like | Exogenous of shape (h, n_x). | None |
level | List[int] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool, default=False | Whether or not to return insample predictions. | False |
AutoTBATS
AutoTBATS
_TS
AutoTBATS model.
Automatically selects the best TBATS model from all feasible combinations of the parameters use_boxcox, use_trend, use_damped_trend, and use_arma_errors.
Selection is made using the AIC.
Default value for use_arma_errors is True since this enables the evaluation of models with and without ARMA errors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seasonal_periods | int or list of int | Number of observations per unit of time. Ex: 24 Hourly data. | required |
use_boxcox | bool, default=None | Whether or not to use a Box-Cox transformation. By default tries both. | None |
bc_lower_bound | float, default=0.0 | Lower bound for the Box-Cox transformation. | 0.0 |
bc_upper_bound | float, default=1.0 | Upper bound for the Box-Cox transformation. | 1.0 |
use_trend | bool, default=None | Whether or not to use a trend component. By default tries both. | None |
use_damped_trend | bool, default=None | Whether or not to dampen the trend component. By default tries both. | None |
use_arma_errors | bool, default=True | Whether or not to use a ARMA errors. Default is True and this evaluates both models. | True |
alias | str | Custom name of the model. | ‘AutoTBATS’ |
AutoTBATS.fit
y.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (t, ). | required |
X | numpy.array, optional, default=None | Ignored | None |
| Name | Type | Description |
|---|---|---|
self | TBATS model. |
AutoTBATS.predict
Returns:
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
AutoTBATS.predict_in_sample
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
AutoTBATS.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
ARIMA Family
ARIMA
ARIMA
_TS
ARIMA model.
AutoRegressive Integrated Moving Average model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order | tuple, default=(0, 0, 0) | A specification of the non-seasonal part of the ARIMA model: the three components (p, d, q) are the AR order, the degree of differencing, and the MA order. | (0, 0, 0) |
season_length | int, default=1 | Number of observations per unit of time. Ex: 24 Hourly data. | 1 |
seasonal_order | tuple, default=(0, 0, 0) | A specification of the seasonal part of the ARIMA model. (P, D, Q) for the AR order, the degree of differencing, the MA order. | (0, 0, 0) |
include_mean | bool, default=True | Should the ARIMA model include a mean term? The default is True for undifferenced series, False for differenced ones (where a mean would not affect the fit nor predictions). | True |
include_drift | bool, default=False | Should the ARIMA model include a linear drift term? (i.e., a linear regression with ARIMA errors is fitted.) | False |
include_constant | bool, optional, default=None | If True, then includ_mean is set to be True for undifferenced series and include_drift is set to be True for differenced series. Note that if there is more than one difference taken, no constant is included regardless of the value of this argument. This is deliberate as otherwise quadratic and higher order polynomial trends would be induced. | None |
blambda | float, optional, default=None | Box-Cox transformation parameter. | None |
biasadj | bool, default=False | Use adjusted back-transformed mean Box-Cox. | False |
method | str, default=‘CSS-ML’ | Fitting method: maximum likelihood or minimize conditional sum-of-squares. The default (unless there are missing values) is to use conditional-sum-of-squares to find starting values, then maximum likelihood. | ‘CSS-ML’ |
fixed | dict, optional, default=None | Dictionary containing fixed coefficients for the arima model. Example: {'ar1': 0.5, 'ma2': 0.75}. For autoregressive terms use the ar{i} keys. For its seasonal version use sar{i}. For moving average terms use the ma{i} keys. For its seasonal version use sma{i}. For intercept and drift use the intercept and drift keys. For exogenous variables use the ex_{i} keys. | None |
alias | str | Custom name of the model. | ‘ARIMA’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
ARIMA.fit
y
and optionally exogenous variables (numpy array) X.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
self | Fitted model. |
ARIMA.predict
Returns:
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
ARIMA.predict_in_sample
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
ARIMA.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | array - like | Optional insample exogenous of shape (t, n_x). | None |
X_future | array - like | Optional exogenous of shape (h, n_x) optional exogenous. | None |
level | List[float] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool | Whether or not returns insample predictions. | False |
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
AutoRegressive
AutoRegressive
ARIMA
Simple Autoregressive model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lags | int or list | Number of lags to include in the model. If an int is passed then all lags up to lags are considered. If a list, only the elements of the list are considered as lags. | required |
include_mean | bool, default=True | Should the AutoRegressive model include a mean term? The default is True for undifferenced series, False for differenced ones (where a mean would not affect the fit nor predictions). | True |
include_drift | bool, default=False | Should the AutoRegressive model include a linear drift term? (i.e., a linear regression with AutoRegressive errors is fitted.) | False |
blambda | float, optional, default=None | Box-Cox transformation parameter. | None |
biasadj | bool, default=False | Use adjusted back-transformed mean Box-Cox. | False |
method | str, default=‘CSS-ML’ | Fitting method: maximum likelihood or minimize conditional sum-of-squares. The default (unless there are missing values) is to use conditional-sum-of-squares to find starting values, then maximum likelihood. | ‘CSS-ML’ |
fixed | dict, optional, default=None | Dictionary containing fixed coefficients for the AutoRegressive model. Example: {'ar1': 0.5, 'ar5': 0.75}. For autoregressive terms use the ar{i} keys. | None |
alias | str | Custom name of the model. | ‘AutoRegressive’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
AutoRegressive.fit
y
and optionally exogenous variables (numpy array) X.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
self | Fitted model. |
AutoRegressive.predict
Returns:
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
AutoRegressive.predict_in_sample
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
AutoRegressive.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | array - like | Optional insample exogenous of shape (t, n_x). | None |
X_future | array - like | Optional exogenous of shape (h, n_x) optional exogenous. | None |
level | List[float] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool | Whether or not returns insample predictions. | False |
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
Exponential Smoothing
SimpleExponentialSmoothing
SimpleExponentialSmoothing
_TS
SimpleExponentialSmoothing model.
Uses a weighted average of all past observations where the weights decrease exponentially into the past.
Suitable for data with no clear trend or seasonality.
Assuming there are observations, the one-step forecast is given by:
The rate at which the weights decrease is called the smoothing parameter. When , SES is equal to the naive method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha | float | Smoothing parameter. | required |
alias | str | Custom name of the model. | ‘SES’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
SimpleExponentialSmoothing.fit
y
and optionally exogenous variables (numpy array) X.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
self | SimpleExponentialSmoothing fitted model. |
SimpleExponentialSmoothing.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
SimpleExponentialSmoothing.predict_in_sample
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions. |
SimpleExponentialSmoothing.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | array - like | Optional insample exogenous of shape (t, n_x). | None |
X_future | array - like | Optional exogenous of shape (h, n_x). | None |
level | List[float] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool | Whether or not to return insample predictions. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
SimpleExponentialSmoothingOptimized
SimpleExponentialSmoothingOptimized
_TS
SimpleExponentialSmoothing model.
Uses a weighted average of all past observations where the weights decrease exponentially into the past.
Suitable for data with no clear trend or seasonality.
Assuming there are observations, the one-step forecast is given by:
The smoothing parameter is optimized by square error minimization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alias | str | Custom name of the model. | ‘SESOpt’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. This is required for generating future prediction intervals. | None |
SimpleExponentialSmoothingOptimized.fit
y
and optionally exogenous variables (numpy array) X.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
SimpleExponentialSmoothingOptimized | SimpleExponentialSmoothingOptimized fitted model. |
SimpleExponentialSmoothingOptimized.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
SimpleExponentialSmoothingOptimized.predict_in_sample
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions. |
SimpleExponentialSmoothingOptimized.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | array - like | Optional insample exogenous of shape (t, n_x). | None |
X_future | array - like | Optional exogenous of shape (h, n_x). | None |
level | List[float] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool | Whether or not to return insample predictions. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
SeasonalExponentialSmoothing
SeasonalExponentialSmoothing
_TS
SeasonalExponentialSmoothing model.
Uses a weighted average of all past observations where the weights decrease exponentially into the past.
Suitable for data with no clear trend or seasonality.
Assuming there are observations and season , the one-step forecast is given by:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha | float | Smoothing parameter. | required |
season_length | int | Number of observations per unit of time. Ex: 24 Hourly data. | required |
alias | str | Custom name of the model. | ‘SeasonalES’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. This is required for generating future prediction intervals. | None |
SeasonalExponentialSmoothing.fit
y
and optionally exogenous variables (numpy array) X.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
SeasonalExponentialSmoothing | SeasonalExponentialSmoothing fitted model. |
SeasonalExponentialSmoothing.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
SeasonalExponentialSmoothing.predict_in_sample
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions. |
SeasonalExponentialSmoothing.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | array - like | Optional insample exogenous of shape (t, n_x). | None |
X_future | array - like | Optional exogenous of shape (h, n_x). | None |
level | List[float] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool | Whether or not returns insample predictions. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
SeasonalExponentialSmoothingOptimized
SeasonalExponentialSmoothingOptimized
_TS
SeasonalExponentialSmoothingOptimized model.
Uses a weighted average of all past observations where the weights decrease exponentially into the past.
Suitable for data with no clear trend or seasonality.
Assuming there are observations and season , the one-step forecast is given by:
The smoothing parameter is optimized by square error minimization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_length | int | Number of observations per unit of time. Ex: 24 Hourly data. | required |
alias | str | Custom name of the model. | ‘SeasESOpt’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. This is required for generating future prediction intervals. | None |
SeasonalExponentialSmoothingOptimized.fit
y
and optionally exogenous variables (numpy array) X.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
SeasonalExponentialSmoothingOptimized | SeasonalExponentialSmoothingOptimized fitted model. |
SeasonalExponentialSmoothingOptimized.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
SeasonalExponentialSmoothingOptimized.predict_in_sample
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions. |
SeasonalExponentialSmoothingOptimized.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | array - like | Optional insample exogenous of shape (t, n_x). | None |
X_future | array - like | Optional exogenous of shape (h, n_x). | None |
level | List[float] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool | Whether or not to return insample predictions. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
Holt
Holt
AutoETS
Holt’s method.
Also known as double exponential smoothing, Holt’s method is an extension of exponential smoothing for series with a trend.
This implementation returns the corresponding ETS model with additive (A) or multiplicative (M) errors (so either ‘AAN’ or ‘MAN’).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_length | int | Number of observations per unit of time. Ex: 12 Monthly data. | 1 |
error_type | str | The type of error of the ETS model. Can be additive (A) or multiplicative (M). | ’A’ |
alias | str | Custom name of the model. | ‘Holt’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
HoltWinters
HoltWinters
AutoETS
Holt-Winters’ method.
Also known as triple exponential smoothing, Holt-Winters’ method is an extension of exponential smoothing for series that contain both trend and seasonality.
This implementation returns the corresponding ETS model with additive (A) or multiplicative (M) errors (so either ‘AAA’ or ‘MAM’).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_length | int | Number of observations per unit of time. Ex: 12 Monthly data. | 1 |
error_type | str | The type of error of the ETS model. Can be additive (A) or multiplicative (M). | ’A’ |
alias | str | Custom name of the model. | ‘HoltWinters’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
Baseline Models
HistoricAverage
HistoricAverage
_TS
HistoricAverage model.
Also known as mean method. Uses a simple average of all past observations.
Assuming there are observations, the one-step forecast is given by:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alias | str | Custom name of the model. | ‘HistoricAverage’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
HistoricAverage.fit
y.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
self | HistoricAverage fitted model. |
HistoricAverage.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
HistoricAverage.predict_in_sample
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions. |
HistoricAverage.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | ndarray | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | Optional[ndarray] | Optional insample exogenous of shape (t, n_x). Defaults to None. | None |
X_future | Optional[ndarray] | Optional exogenous of shape (h, n_x). Defaults to None. | None |
level | Optional[List[int]] | Confidence levels (0-100) for prediction intervals. Defaults to None. | None |
fitted | bool | Whether or not to return insample predictions. Defaults to False. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
Naive
Naive
_TS
Naive model.
All forecasts have the value of the last observation:
for all
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alias | str | Custom name of the model. Defaults to “Naive”. | ’Naive’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. Defaults to None. | None |
Naive.fit
y.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
self | Naive fitted model. |
Naive.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
Naive.predict_in_sample
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions. |
Naive.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (n,). | required |
h | int | Forecast horizon. | required |
X | array - like | Optional insample exogenous of shape (t, n_x). | None |
X_future | array - like | Optional exogenous of shape (h, n_x). | None |
level | List[float] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool | Whether or not to return insample predictions. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
RandomWalkWithDrift
RandomWalkWithDrift
_TS
RandomWalkWithDrift model.
A variation of the naive method allows the forecasts to change over time.
The amout of change, called drift, is the average change seen in the historical data.
From the previous equation, we can see that this is equivalent to extrapolating a line between
the first and the last observation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alias | str | Custom name of the model. | ‘RWD’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
RandomWalkWithDrift.fit
y.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (t, ). | required |
| Name | Type | Description |
|---|---|---|
self | RandomWalkWithDrift fitted model. |
RandomWalkWithDrift.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
RandomWalkWithDrift.predict_in_sample
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
RandomWalkWithDrift.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (n,). | required |
h | int | Forecast horizon. | required |
X | array - like | Optional insample exogenous of shape (t, n_x). | None |
X_future | array - like | Optional exogenous of shape (h, n_x). | None |
level | List[float] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool | Whether or not to return insample predictions. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
SeasonalNaive
SeasonalNaive
_TS
Seasonal naive model.
A method similar to the naive, but uses the last known observation of the same period (e.g. the same month of the previous year) in order to capture seasonal variations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_length | int | Number of observations per unit of time. Ex: 24 Hourly data. | required |
alias | str | Custom name of the model. | ‘SeasonalNaive’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
SeasonalNaive.fit
y.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
self | SeasonalNaive fitted model. |
SeasonalNaive.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
SeasonalNaive.predict_in_sample
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
SeasonalNaive.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | array - like | Optional insample exogenous of shape (t, n_x). | None |
X_future | array - like | Optional exogenous of shape (h, n_x). | None |
level | List[float] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool | Whether or not to return insample predictions. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
WindowAverage
WindowAverage
_TS
WindowAverage model.
Uses the average of the last observations, with the length of the window.
Wider windows will capture global trends, while narrow windows will reveal local trends.
The length of the window selected should take into account the importance of past
observations and how fast the series changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window_size | int | Size of truncated series on which average is estimated. | required |
alias | str | Custom name of the model. | ‘WindowAverage’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. This is required for generating future prediction intervals. | None |
WindowAverage.fit
y
and optionally exogenous variables (numpy array) X.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
self | WindowAverage fitted model. |
WindowAverage.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
WindowAverage.predict_in_sample
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
WindowAverage.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | ndarray | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | Optional[ndarray] | Optional insample exogenous of shape (t, n_x). | None |
X_future | Optional[ndarray] | Optional exogenous of shape (h, n_x). | None |
level | Optional[List[int]] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool | Whether or not to return insample predictions. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
SeasonalWindowAverage
SeasonalWindowAverage
_TS
SeasonalWindowAverage model.
An average of the last observations of the same period, with the length of the window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_length | int | Number of observations per unit of time. Ex: 24 Hourly data. | required |
window_size | int | Size of truncated series on which average is estimated. | required |
alias | str | Custom name of the model. | ‘SeasWA’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. This is required for generating future prediction intervals. | None |
SeasonalWindowAverage.fit
y
and optionally exogenous variables (numpy array) X.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
SeasonalWindowAverage | SeasonalWindowAverage fitted model. |
SeasonalWindowAverage.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
SeasonalWindowAverage.predict_in_sample
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
SeasonalWindowAverage.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | ndarray | Clean time series of shape (n,). | required |
h | int | Forecast horizon. | required |
X | Optional[ndarray] | Optional insample exogenous of shape (t, n_x). Defaults to None. | None |
X_future | Optional[ndarray] | Optional exogenous of shape (h, n_x). Defaults to None. | None |
level | Optional[List[int]] | Confidence levels for prediction intervals. Defaults to None. | None |
fitted | bool | Whether or not to return insample predictions. Defaults to False. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
Sparse or Intermittent Models
ADIDA
ADIDA
_TS
ADIDA model.
Aggregate-Dissagregate Intermittent Demand Approach: Uses temporal aggregation to reduce the
number of zero observations. Once the data has been agregated, it uses the optimized SES to
generate the forecasts at the new level. It then breaks down the forecast to the original
level using equal weights.
ADIDA specializes on sparse or intermittent series are series with very few non-zero observations.
They are notoriously hard to forecast, and so, different methods have been developed
especifically for them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alias | str | Custom name of the model. Defaults to “ADIDA”. | ’ADIDA’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. Defaults to None. | None |
ADIDA.fit
y.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
ADIDA | ADIDA fitted model. |
ADIDA.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
ADIDA.predict_in_sample
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
ADIDA.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | ndarray | Clean time series of shape (n,). | required |
h | int | Forecast horizon. | required |
X | Optional[ndarray] | Optional insample exogenous of shape (t, n_x). Defaults to None. | None |
X_future | Optional[ndarray] | Optional exogenous of shape (h, n_x). Defaults to None. | None |
level | Optional[List[int]] | Confidence levels (0-100) for prediction intervals. Defaults to None. | None |
fitted | bool | Whether or not to return insample predictions. Defaults to False. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
CrostonClassic
CrostonClassic
_TS
CrostonClassic model.
A method to forecast time series that exhibit intermittent demand.
It decomposes the original time series into a non-zero demand size and
inter-demand intervals . Then the forecast is given by:
where and are forecasted using SES. The smoothing parameter
of both components is set equal to 0.1
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alias | str | Custom name of the model. Defaults to “CrostonClassic”. | ’CrostonClassic’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. Defaults to None. | None |
CrostonClassic.fit
y.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
CrostonClassic | CrostonClassic fitted model. |
CrostonClassic.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
CrostonClassic.predict_in_sample
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
CrostonClassic.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | ndarray | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | Optional[ndarray] | Optional insample exogenous of shape (t, n_x). Defaults to None. | None |
X_future | Optional[ndarray] | Optional exogenous of shape (h, n_x). Defaults to None. | None |
level | Optional[List[int]] | Confidence levels (0-100) for prediction intervals. Defaults to None. | None |
fitted | bool | Whether or not returns insample predictions. Defaults to False. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
CrostonOptimized
CrostonOptimized
_TS
CrostonOptimized model.
A method to forecast time series that exhibit intermittent demand.
It decomposes the original time series into a non-zero demand size and
inter-demand intervals . Then the forecast is given by:
A variation of the classic Croston’s method where the smooting paramater is optimally
selected from the range . Both the non-zero demand and the inter-demand
intervals are smoothed separately, so their smoothing parameters can be different.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alias | str | Custom name of the model. Defaults to “CrostonOptimized”. | ’CrostonOptimized’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. This is required for generating future prediction intervals. Defaults to None. | None |
CrostonOptimized.fit
y.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
CrostonOptimized | CrostonOptimized fitted model. |
CrostonOptimized.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
CrostonOptimized.predict_in_sample
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
CrostonOptimized.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | ndarray | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | Optional[ndarray] | Optional insample exogenous of shape (t, n_x). Defaults to None. | None |
X_future | Optional[ndarray] | Optional exogenous of shape (h, n_x). Defaults to None. | None |
level | Optional[List[int]] | Confidence levels (0-100) for prediction intervals. Defaults to None. | None |
fitted | bool | Whether or not returns insample predictions. Defaults to False. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
CrostonSBA
CrostonSBA
_TS
CrostonSBA model.
A method to forecast time series that exhibit intermittent demand.
It decomposes the original time series into a non-zero demand size and
inter-demand intervals . Then the forecast is given by:
A variation of the classic Croston’s method that uses a debiasing factor, so that the
forecast is given by:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alias | str | Custom name of the model. Defaults to “CrostonSBA”. | ’CrostonSBA’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. Defaults to None. | None |
CrostonSBA.fit
y.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
CrostonSBA | CrostonSBA fitted model. |
CrostonSBA.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
CrostonSBA.predict_in_sample
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
CrostonSBA.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | ndarray | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | Optional[ndarray] | Optional insample exogenous of shape (t, n_x). Defaults to None. | None |
X_future | Optional[ndarray] | Optional exogenous of shape (h, n_x). Defaults to None. | None |
level | Optional[List[int]] | Confidence levels (0-100) for prediction intervals. Defaults to None. | None |
fitted | bool | Whether or not to return insample predictions. Defaults to False. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
IMAPA
IMAPA
_TS
IMAPA model.
Intermittent Multiple Aggregation Prediction Algorithm: Similar to ADIDA, but instead of
using a single aggregation level, it considers multiple in order to capture different
dynamics of the data. Uses the optimized SES to generate the forecasts at the new levels
and then combines them using a simple average.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alias | str | Custom name of the model. Defaults to “IMAPA”. | ’IMAPA’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. Defaults to None. | None |
IMAPA.fit
y.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
IMAPA | IMAPA fitted model. |
IMAPA.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
IMAPA.predict_in_sample
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
IMAPA.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | ndarray | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | Optional[ndarray] | Optional insample exogenous of shape (t, n_x). Defaults to None. | None |
X_future | Optional[ndarray] | Optional exogenous of shape (h, n_x). Defaults to None. | None |
level | Optional[List[int]] | Confidence levels (0-100) for prediction intervals. Defaults to None. | None |
fitted | bool | Whether or not to return insample predictions. Defaults to False. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
TSB
TSB
_TS
TSB model.
Teunter-Syntetos-Babai: A modification of Croston’s method that replaces the inter-demand
intervals with the demand probability , which is defined as follows.
Hence, the forecast is given by
Both and are forecasted using SES. The smooting paramaters of each may differ,
like in the optimized Croston’s method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha_d | float | Smoothing parameter for demand. | required |
alpha_p | float | Smoothing parameter for probability. | required |
alias | str | Custom name of the model. Defaults to “TSB”. | ’TSB’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. This is required for generating future prediction intervals. Defaults to None. | None |
TSB.fit
y.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
TSB | TSB fitted model. |
TSB.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
TSB.predict_in_sample
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
TSB.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
Multiple Seasonalities
MSTL
MSTL
_TS
MSTL model.
The MSTL (Multiple Seasonal-Trend decomposition using LOESS) decomposes the time series
in multiple seasonalities using LOESS. Then forecasts the trend using
a custom non-seaonal model and each seasonality using a SeasonalNaive model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_length | Union[int, List[int]] | Number of observations per unit of time. For multiple seasonalities use a list. | required |
trend_forecaster | model, default=AutoETS(model=‘ZZN’) | StatsForecast model used to forecast the trend component. | AutoETS(model=‘ZZN’) |
stl_kwargs | dict | Extra arguments to pass to statsmodels.tsa.seasonal.STL. The period and seasonal arguments are reserved. | None |
alias | str | Custom name of the model. | ‘MSTL’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
MSTL.fit
y.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
self | MSTL fitted model. |
MSTL.predict
Returns:
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
MSTL.predict_in_sample
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
MSTL.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (n, ). | required |
h | int | Forecast horizon. | required |
X | array - like | Optional insample exogenous of shape (t, n_x). | None |
X_future | array - like | Optional exogenous of shape (h, n_x). | None |
level | List[float] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool | Whether or not to return insample predictions. | False |
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
MFLES
MFLES
_TS
MFLES model.
A method to forecast time series based on Gradient Boosted Time Series Decomposition
which treats traditional decomposition as the base estimator in the boosting
process. Unlike normal gradient boosting, slight learning rates are applied at the
component level (trend/seasonality/exogenous).
The method derives its name from some of the underlying estimators that can
enter into the boosting procedure, specifically: a simple Median, Fourier
functions for seasonality, a simple/piecewise Linear trend, and Exponential
Smoothing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_length | int or list of int | Number of observations per unit of time. Ex: 24 Hourly data. Default None. | None |
fourier_order | int | How many fourier sin/cos pairs to create, the larger the number the more complex of a seasonal pattern can be fitted. A lower number leads to smoother results. This is auto-set based on seasonal_period. Default None. | None |
max_rounds | int | The max number of boosting rounds. The boosting will auto-stop but depending on other parameters such as rs_lr you may want more rounds. Generally more rounds means a smoother fit. Default 50. | 50 |
ma | int | The moving average order to use, this is auto-set based on internal logic. Passing 4 would fit a 4 period moving average on the residual component. Default None. | None |
alpha | float | The alpha which is used in fitting the underlying LASSO when using piecewise functions. Default 1.0. | 1.0 |
decay | float | Effects the slopes of the piecewise-linear basis function. Default -1.0. | -1.0 |
changepoints | boolean | Whether to fit for changepoints if all other logic allows for it. If False, MFLES will not ever fit a piecewise trend. Default True. | True |
n_changepoints | int or float | Number (if int) or proportion (if float) of changepoint knots to place. The default of 0.25 will place 0.25 * (series length) number of knots. Default 0.25. | 0.25 |
seasonal_lr | float | A shrinkage parameter (0 < seasonal_lr <= 1) which penalizes the seasonal fit. A value of 0.9 will flatly multiply the seasonal fit by 0.9 each boosting round, this can be used to allow more signal to the exogenous component. Default 0.9. | 0.9 |
trend_lr | float | A shrinkage parameter (0 < trend_lr <= 1) which penalizes the linear trend fit A value of 0.9 will flatly multiply the linear fit by 0.9 each boosting round, this can be used to allow more signal to the seasonality or exogenous components. Default 0.9. | 0.9 |
exogenous_lr | float | The shrinkage parameter (0 < exogenous_lr <= 1) which controls how much of the exogenous signal is carried to the next round. Default 1.0. | 1.0 |
residuals_lr | float | A shrinkage parameter (0 < residuals_lr <= 1) which penalizes the residual smoothing. A value of 0.9 will flatly multiply the residual fit by 0.9 each boosting round, this can be used to allow more signal to the seasonality or linear components. Default 1.0. | 1.0 |
cov_threshold | float | The deseasonalized cov is used to auto-set some logic, lowering the cov_threshold will result in simpler and less complex residual smoothing. If you pass something like 1000 then there will be no safeguards applied. Default 0.7. | 0.7 |
moving_medians | bool | The default behavior is to fit an initial median to the time series. If True, then it will fit a median per seasonal period. Default False. | False |
min_alpha | float | The minimum alpha in the SES ensemble. Default 0.05. | 0.05 |
max_alpha | float | The maximum alpha used in the SES ensemble. Default 1.0. | 1.0 |
trend_penalty | bool | Whether to apply a simple penalty to the linear trend component, very useful for dealing with the potentially dangerous piecewise trend. Default True. | True |
multiplicative | bool | Auto-set based on internal logic. If True, it will simply take the log of the time series. Default None. | None |
smoother | bool | If True, then a simple exponential ensemble will be used rather than auto settings. Default False. | False |
robust | bool | If True then MFLES will fit using more reserved methods, i.e. not using piecewise trend or moving average residual smoother. Auto-set based on internal logic. Default None. | None |
verbose | bool | Print debugging information. Default False. | False |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. This is required for generating future prediction intervals. | None |
alias | str | Custom name of the model. Default ‘MFLES’. | ‘MFLES’ |
MFLES.fit
Returns:
| Name | Type | Description |
|---|---|---|
self | MFLES | Fitted MFLES object. |
MFLES.predict
Returns:
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
MFLES.predict_in_sample
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
MFLES.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (t, ). | required |
h | int | Forecast horizon. | required |
X | array - like | Insample exogenous of shape (t, n_x). | None |
X_future | array - like | Exogenous of shape (h, n_x). | None |
level | List[int] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool | Whether or not to return insample predictions. Default False. | False |
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
TBATS
TBATS
AutoTBATS
Trigonometric Box-Cox transform, ARMA errors, Trend and Seasonal components (TBATS) model.
TBATS is an innovations state space model framework used for forecasting time series with multiple seasonalities. It uses a Box-Cox tranformation, ARMA errors, and a trigonometric representation of the seasonal patterns based on Fourier series.
The name TBATS is an acronym for the key features of the model: Trigonometric, Box-Cox transform, ARMA errors, Trend, and Seasonal components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_length | Union[int, List[int]] | Number of observations per unit of time. Ex: 24 Hourly data. | required |
use_boxcox | Optional[bool] | Whether or not to use a Box-Cox transformation. Default True. | True |
bc_lower_bound | float | Lower bound for the Box-Cox transformation. Default 0.0. | 0.0 |
bc_upper_bound | float | Upper bound for the Box-Cox transformation. Default 1.0. | 1.0 |
use_trend | Optional[bool] | Whether or not to use a trend component. Default True. | True |
use_damped_trend | Optional[bool] | Whether or not to dampen the trend component. Default False. | False |
use_arma_errors | bool | Whether or not to use a ARMA errors. Default False. | False |
alias | str | Custom name of the model. Default ‘TBATS’. | ‘TBATS’ |
Theta Family
Theta
Theta
AutoTheta
Standard Theta Method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_length | int | Number of observations per unit of time. Ex: 24 Hourly data. Default 1. | 1 |
decomposition_type | str | Sesonal decomposition type, ‘multiplicative’ (default) or ‘additive’. Default ‘multiplicative’. | ‘multiplicative’ |
alias | str | Custom name of the model. Default ‘Theta’. | ‘Theta’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. Default None. | None |
OptimizedTheta
OptimizedTheta
AutoTheta
Optimized Theta Method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_length | int | Number of observations per unit of time. Ex: 24 Hourly data. Default 1. | 1 |
decomposition_type | str | Sesonal decomposition type, ‘multiplicative’ (default) or ‘additive’. Default ‘multiplicative’. | ‘multiplicative’ |
alias | str | Custom name of the model. Default ‘OptimizedTheta’. | ‘OptimizedTheta’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. Default None. | None |
DynamicTheta
DynamicTheta
AutoTheta
Dynamic Standard Theta Method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_length | int | Number of observations per unit of time. Ex: 24 Hourly data. | 1 |
decomposition_type | str | Sesonal decomposition type, ‘multiplicative’ (default) or ‘additive’. | ‘multiplicative’ |
alias | str | Custom name of the model. | ‘DynamicTheta’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
DynamicOptimizedTheta
DynamicOptimizedTheta
AutoTheta
Dynamic Optimized Theta Method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season_length | int | Number of observations per unit of time. Ex: 24 Hourly data. | 1 |
decomposition_type | str | Sesonal decomposition type, ‘multiplicative’ (default) or ‘additive’. | ‘multiplicative’ |
alias | str | Custom name of the model. | ‘DynamicOptimizedTheta’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
ARCH/GARCH Family
GARCH
GARCH
_TS
Generalized Autoregressive Conditional Heteroskedasticity (GARCH) model.
A method for modeling time series that exhibit non-constant volatility over time.
The GARCH model assumes that at time , is given by:
with
Here is a sequence of iid random variables with zero mean and unit variance.
The coefficients , , , and , must satisfy the following conditions:
- and for all and .
- . Here it is assumed that for and for .
| Name | Type | Description | Default |
|---|---|---|---|
p | int | Number of lagged versions of the series. | 1 |
q | int | Number of lagged versions of the volatility. | 1 |
alias | str | Custom name of the model. | ‘GARCH’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
GARCH.fit
y.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (t, ). | required |
| Name | Type | Description |
|---|---|---|
self | GARCH model. |
GARCH.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
GARCH.predict_in_sample
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
GARCH.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
forecasts | dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
ARCH
ARCH
GARCH
Autoregressive Conditional Heteroskedasticity (ARCH) model.
A particular case of the GARCH(p,q) model where .
It assumes that at time , is given by:
with
Here is a sequence of iid random variables with zero mean and unit variance.
The coefficients and , must be nonnegative and .
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p | int | Number of lagged versions of the series. | 1 |
alias | str | Custom name of the model. | ‘ARCH’ |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. | None |
Machine Learning
SklearnModel
SklearnModel
_TS
scikit-learn model wrapper
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model | BaseEstimator | scikit-learn estimator | required |
prediction_intervals | Optional[ConformalIntervals] | Information to compute conformal prediction intervals. This is required for generating future prediction intervals. | None |
alias | str | Custom name of the model. If None will use the model’s class. | None |
SklearnModel.fit
Returns:
| Name | Type | Description |
|---|---|---|
SklearnModel | SklearnModel | Fitted SklearnModel object. |
SklearnModel.predict
Returns:
SklearnModel.predict_in_sample
SklearnModel.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (t, ). | required |
h | int | Forecast horizon. | required |
X | array - like | Insample exogenous of shape (t, n_x). | required |
X_future | array - like | Exogenous of shape (h, n_x). | required |
level | List[int] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool | Whether or not to return insample predictions. | False |
Fallback Models
These models are used as fallbacks when other models fail during forecasting.ConstantModel
ConstantModel
_TS
Constant Model.
Returns Constant values.
Parameters:
ConstantModel.fit
y.
Parameters:
Returns:
| Name | Type | Description |
|---|---|---|
ConstantModel | Constant fitted model. |
ConstantModel.predict
Returns:
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
ConstantModel.predict_in_sample
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries fitted for point predictions and level_* for probabilistic predictions. |
ConstantModel.forecast
fit_predict without storing information.
It assumes you know the forecast horizon in advance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y | array | Clean time series of shape (n,). | required |
h | int | Forecast horizon. | required |
X | array - like | Optional insample exogenous of shape (t, n_x). | None |
X_future | array - like | Optional exogenous of shape (h, n_x). | None |
level | List[float] | Confidence levels (0-100) for prediction intervals. | None |
fitted | bool | Whether or not to return insample predictions. | False |
| Name | Type | Description |
|---|---|---|
dict | Dictionary with entries mean for point predictions and level_* for probabilistic predictions. |
ZeroModel
ZeroModel
ConstantModel
Returns Zero forecasts.
Returns Zero values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alias | str | Custom name of the model. | ‘ZeroModel’ |
NaNModel
NaNModel
ConstantModel
NaN Model.
Returns NaN values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alias | str | Custom name of the model. | ‘NaNModel’ |
Usage Examples
Basic Model Usage
Using Multiple Models
Model with Prediction Intervals
Sparse/Intermittent Data
Multiple Seasonalities
ARCH/GARCH for Volatility
Using Scikit-learn Models
Model Selection Tips
- For automatic selection: Start with
AutoARIMAorAutoETS - For baseline comparison: Use
Naive,SeasonalNaive, orHistoricAverage - For seasonal data: Use models with
season_lengthparameter - For sparse data: Use Croston family or ADIDA
- For multiple seasonalities: Use MSTL or TBATS
- For volatile data: Use GARCH or ARCH
- For ensemble approaches: Combine multiple models and compare performance

