Skip to main content
StatsForecast offers a wide variety of statistical forecasting models grouped into the following categories:
  • 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

AutoARIMA(
    d=None,
    D=None,
    max_p=5,
    max_q=5,
    max_P=2,
    max_Q=2,
    max_order=5,
    max_d=2,
    max_D=1,
    start_p=2,
    start_q=2,
    start_P=1,
    start_Q=1,
    stationary=False,
    seasonal=True,
    ic="aicc",
    stepwise=True,
    nmodels=94,
    trace=False,
    approximation=False,
    method=None,
    truncate=None,
    test="kpss",
    test_kwargs=None,
    seasonal_test="seas",
    seasonal_test_kwargs=None,
    allowdrift=True,
    allowmean=True,
    blambda=None,
    biasadj=False,
    season_length=1,
    alias="AutoARIMA",
    prediction_intervals=None,
)
Bases: _TS AutoARIMA model. Automatically selects the best ARIMA (AutoRegressive Integrated Moving Average) model using an information criterion. Default is Akaike Information Criterion (AICc). Parameters:
NameTypeDescriptionDefault
dOptional[int]Order of first-differencing.None
DOptional[int]Order of seasonal-differencing.None
max_pint, default=5Max autorregresives p.5
max_qint, default=5Max moving averages q.5
max_Pint, default=2Max seasonal autorregresives P.2
max_Qint, default=2Max seasonal moving averages Q.2
max_orderint, default=5Max p+q+P+Q value if not stepwise selection.5
max_dint, default=2Max non-seasonal differences.2
max_Dint, default=1Max seasonal differences.1
start_pint, default=2Starting value of p in stepwise procedure.2
start_qint, default=2Starting value of q in stepwise procedure.2
start_Pint, default=1Starting value of P in stepwise procedure.1
start_Qint, default=1Starting value of Q in stepwise procedure.1
stationarybool, default=FalseIf True, restricts search to stationary models.False
seasonalbool, default=TrueIf False, restricts search to non-seasonal models.True
icstr, default=“aicc”Information criterion to be used in model selection.‘aicc’
stepwisebool, default=TrueIf True, will do stepwise selection (faster).True
nmodelsint, default=94Number of models considered in stepwise search.94
tracebool, default=FalseIf True, the searched ARIMA models is reported.False
approximationOptional[bool], default=FalseIf True, conditional sums-of-squares estimation, final MLE.False
methodOptional[str]Fitting method between maximum likelihood or sums-of-squares.None
truncateOptional[bool]Observations truncated series used in model selection.None
teststr, default=“kpss”Unit root test to use. See ndiffs for details.‘kpss’
test_kwargsOptional[str]Unit root test additional arguments.None
seasonal_teststr, default=“seas”Selection method for seasonal differences.‘seas’
seasonal_test_kwargsOptional[dict]Seasonal unit root test arguments.None
allowdriftbool, default=TrueIf True, drift models terms considered.True
allowmeanbool, default=TrueIf True, non-zero mean models considered.True
blambdaOptional[float]Box-Cox transformation parameter.None
biasadjbool, default=FalseUse adjusted back-transformed mean Box-Cox.False
season_lengthint, default=1Number of observations per unit of time. Ex: 24 Hourly data.1
aliasstr, default=“AutoARIMA”Custom name of the model.‘AutoARIMA’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None
AutoARIMA.fit
fit(y, X=None)
Fit the AutoARIMA model. Fit an AutoARIMA to a time series (numpy array) y and optionally exogenous variables (numpy array) X. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeOptional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
AutoARIMAAutoARIMA fitted model.
AutoARIMA.predict
predict(h, X=None, level=None)
Predict with fitted AutoArima. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
AutoARIMA.predict_in_sample
predict_in_sample(level=None)
Access fitted AutoArima insample predictions. Parameters:
NameTypeDescriptionDefault
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
AutoARIMA.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient AutoARIMA predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n, ).required
hintForecast horizon.required
Xarray - likeOptional insample exogenpus of shape (t, n_x).None
X_futurearray - likeOptional exogenous of shape (h, n_x) optional exogenous.None
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedbool, default=FalseWhether or not returns insample predictions.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

AutoETS

AutoETS

AutoETS(
    season_length=1,
    model="ZZZ",
    damped=None,
    phi=None,
    alias="AutoETS",
    prediction_intervals=None,
)
Bases: _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 MM multiplicative, AA additive, ZZ optimized or NN ommited components. The model string parameter defines the ETS equations: E in [M,A,ZM, A, Z], T in [N,A,M,ZN, A, M, Z], and S in [N,A,M,ZN, A, M, Z]. 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:
NameTypeDescriptionDefault
season_lengthint, default=1Number of observations per unit of time. Ex: 24 Hourly data.1
modelstr, default=“ZZZ”Controlling state-space-equations.‘ZZZ’
dampedboolA parameter that ‘dampens’ the trend.None
phifloatSmoothing parameter for trend damping. Only used when damped=True.None
aliasstr, default=“AutoETS”Custom name of the model.‘AutoETS’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None
AutoETS.fit
fit(y, X=None)
Fit the Exponential Smoothing model. Fit an Exponential Smoothing model to a time series (numpy array) y and optionally exogenous variables (numpy array) X. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeOptional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
AutoETSExponential Smoothing fitted model.
AutoETS.predict
predict(h, X=None, level=None)
Predict with fitted Exponential Smoothing. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeOptional exogenpus of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
AutoETS.predict_in_sample
predict_in_sample(level=None)
Access fitted Exponential Smoothing insample predictions. Parameters:
NameTypeDescriptionDefault
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
AutoETS.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient Exponential Smoothing predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n, ).required
hintForecast horizon.required
Xarray - likeOptional insample exogenpus of shape (t, n_x).None
X_futurearray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedbool, default=FalseWhether or not returns insample predictions.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

AutoCES

AutoCES

AutoCES(season_length=1, model='Z', alias='CES', prediction_intervals=None)
Bases: _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 SS simple, PP parial, ZZ optimized or NN ommited components. The model string parameter defines the kind of CES model: NN for simple CES (withous seasonality), SS for simple seasonality (lagged CES), PP for partial seasonality (without complex part), FF 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:
NameTypeDescriptionDefault
season_lengthint, default=1Number of observations per unit of time. Ex: 24 Hourly data.1
modelstr, default=“Z”Controlling state-space-equations.‘Z’
aliasstr, default=“CES”Custom name of the model.‘CES’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None
AutoCES.fit
fit(y, X=None)
Fit the Complex Exponential Smoothing model. Fit the Complex Exponential Smoothing model to a time series (numpy array) y and optionally exogenous variables (numpy array) X. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeOptional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
AutoCESComplex Exponential Smoothing fitted model.
AutoCES.predict
predict(h, X=None, level=None)
Predict with fitted Exponential Smoothing. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
AutoCES.predict_in_sample
predict_in_sample(level=None)
Access fitted Exponential Smoothing insample predictions. Parameters:
NameTypeDescriptionDefault
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
AutoCES.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient Complex Exponential Smoothing predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n, ).required
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
X_futurearray - likeOptional exogenpus of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedbool, default=FalseWhether or not to return insample predictions.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

AutoTheta

AutoTheta

AutoTheta(
    season_length=1,
    decomposition_type="multiplicative",
    model=None,
    alias="AutoTheta",
    prediction_intervals=None,
)
Bases: _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:
NameTypeDescriptionDefault
season_lengthint, default=1Number of observations per unit of time. Ex: 24 Hourly data.1
decomposition_typestr, default=“multiplicative”Sesonal decomposition type, ‘multiplicative’ (default) or ‘additive’.‘multiplicative’
modelOptional[str]Controlling Theta Model. By default searchs the best model.None
aliasstr, default=“AutoTheta”Custom name of the model.‘AutoTheta’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None
AutoTheta.fit
fit(y, X=None)
Fit the AutoTheta model. Fit an AutoTheta model to a time series (numpy array) y and optionally exogenous variables (numpy array) X. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeOptional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
AutoThetaAutoTheta fitted model.
AutoTheta.predict
predict(h, X=None, level=None)
Predict with fitted AutoTheta. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
AutoTheta.predict_in_sample
predict_in_sample(level=None)
Access fitted AutoTheta insample predictions. Parameters:
NameTypeDescriptionDefault
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
AutoTheta.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient AutoTheta predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n, ).required
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
X_futurearray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedbool, default=FalseWhether or not returns insample predictions.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

AutoMFLES

AutoMFLES

AutoMFLES(
    test_size,
    season_length=None,
    n_windows=2,
    config=None,
    step_size=None,
    metric="smape",
    verbose=False,
    prediction_intervals=None,
    alias="AutoMFLES",
)
Bases: _TS AutoMFLES Parameters:
NameTypeDescriptionDefault
test_sizeintForecast horizon used during cross validation.required
season_lengthint or list of int, optional, default=NoneNumber of observations per unit of time. Ex: 24 Hourly data.None
n_windowsint, default=2Number of windows used for cross validation.2
configdict, optional, default=NoneMapping from parameter name (from the init arguments of MFLES) to a list of values to try. If None, will use defaults.None
step_sizeint, optional, default=NoneStep size between each cross validation window. If None will be set to test_size.None
metricstr, default=‘smape’Metric used to select the best model. Possible options are: ‘smape’, ‘mape’, ‘mse’ and ‘mae’.‘smape’
verbosebool, default=FalsePrint debugging information.False
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. This is required for generating future prediction intervals.None
aliasstr, default=‘AutoMFLES’Custom name of the model.‘AutoMFLES’
AutoMFLES.fit
fit(y, X=None)
Fit the model Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray-like, optional, default=NoneExogenous of shape (t, n_x).None
Returns:
NameTypeDescription
AutoMFLESAutoMFLESFitted AutoMFLES object.
AutoMFLES.predict
predict(h, X=None, level=None)
Predict with fitted AutoMFLES. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray-like, optional, default=NoneExogenous of shape (h, n_x).None
levelList[int]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDict[str, Any]Dictionary with entries mean for point predictions and level_* for probabilistic predictions.
AutoMFLES.predict_in_sample
predict_in_sample(level=None)
Access fitted AutoMFLES insample predictions. Parameters:
NameTypeDescriptionDefault
levelList[int]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDict[str, Any]Dictionary with entries fitted for point predictions and level_* for probabilistic predictions.
AutoMFLES.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient AutoMFLES predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
hintForecast horizon.required
Xarray - likeInsample exogenous of shape (t, n_x).None
X_futurearray - likeExogenous of shape (h, n_x).None
levelList[int]Confidence levels (0-100) for prediction intervals.None
fittedbool, default=FalseWhether or not to return insample predictions.False
Returns:
NameTypeDescription
dictDict[str, Any]Dictionary with entries mean for point predictions and level_* for probabilistic predictions.

AutoTBATS

AutoTBATS

AutoTBATS(
    season_length,
    use_boxcox=None,
    bc_lower_bound=0.0,
    bc_upper_bound=1.0,
    use_trend=None,
    use_damped_trend=None,
    use_arma_errors=True,
    alias="AutoTBATS",
)
Bases: _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:
NameTypeDescriptionDefault
seasonal_periodsint or list of intNumber of observations per unit of time. Ex: 24 Hourly data.required
use_boxcoxbool, default=NoneWhether or not to use a Box-Cox transformation. By default tries both.None
bc_lower_boundfloat, default=0.0Lower bound for the Box-Cox transformation.0.0
bc_upper_boundfloat, default=1.0Upper bound for the Box-Cox transformation.1.0
use_trendbool, default=NoneWhether or not to use a trend component. By default tries both.None
use_damped_trendbool, default=NoneWhether or not to dampen the trend component. By default tries both.None
use_arma_errorsbool, default=TrueWhether or not to use a ARMA errors. Default is True and this evaluates both models.True
aliasstrCustom name of the model.‘AutoTBATS’
AutoTBATS.fit
fit(y, X=None)
Fit TBATS model. Fit TBATS model to a time series (numpy array) y. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xnumpy.array, optional, default=NoneIgnoredNone
Returns:
NameTypeDescription
selfTBATS model.
AutoTBATS.predict
predict(h, X=None, level=None)
Predict with fitted TBATS model. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
forecastsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
AutoTBATS.predict_in_sample
predict_in_sample(level=None)
Access fitted TBATS model predictions. Parameters:
NameTypeDescriptionDefault
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
forecastsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
AutoTBATS.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient TBATS model. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n, ).required
hintForecast horizon.required
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedboolWhether or not returns insample predictions.False
Returns:
NameTypeDescription
forecastsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

ARIMA Family

ARIMA

ARIMA

ARIMA(
    order=(0, 0, 0),
    season_length=1,
    seasonal_order=(0, 0, 0),
    include_mean=True,
    include_drift=False,
    include_constant=None,
    blambda=None,
    biasadj=False,
    method="CSS-ML",
    fixed=None,
    alias="ARIMA",
    prediction_intervals=None,
)
Bases: _TS ARIMA model. AutoRegressive Integrated Moving Average model. Parameters:
NameTypeDescriptionDefault
ordertuple, 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_lengthint, default=1Number of observations per unit of time. Ex: 24 Hourly data.1
seasonal_ordertuple, 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_meanbool, default=TrueShould 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_driftbool, default=FalseShould the ARIMA model include a linear drift term? (i.e., a linear regression with ARIMA errors is fitted.)False
include_constantbool, optional, default=NoneIf 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
blambdafloat, optional, default=NoneBox-Cox transformation parameter.None
biasadjbool, default=FalseUse adjusted back-transformed mean Box-Cox.False
methodstr, 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’
fixeddict, optional, default=NoneDictionary 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
aliasstrCustom name of the model.‘ARIMA’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None
ARIMA.fit
fit(y, X=None)
Fit the model to a time series (numpy array) y and optionally exogenous variables (numpy array) X. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeOptional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
selfFitted model.
ARIMA.predict
predict(h, X=None, level=None)
Predict with fitted model. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
forecastsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
ARIMA.predict_in_sample
predict_in_sample(level=None)
Access fitted insample predictions. Parameters:
NameTypeDescriptionDefault
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
forecastsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
ARIMA.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory efficient predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n, ).required
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
X_futurearray - likeOptional exogenous of shape (h, n_x) optional exogenous.None
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedboolWhether or not returns insample predictions.False
Returns:
NameTypeDescription
forecastsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

AutoRegressive

AutoRegressive

AutoRegressive(
    lags,
    include_mean=True,
    include_drift=False,
    blambda=None,
    biasadj=False,
    method="CSS-ML",
    fixed=None,
    alias="AutoRegressive",
    prediction_intervals=None,
)
Bases: ARIMA Simple Autoregressive model. Parameters:
NameTypeDescriptionDefault
lagsint or listNumber 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_meanbool, default=TrueShould 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_driftbool, default=FalseShould the AutoRegressive model include a linear drift term? (i.e., a linear regression with AutoRegressive errors is fitted.)False
blambdafloat, optional, default=NoneBox-Cox transformation parameter.None
biasadjbool, default=FalseUse adjusted back-transformed mean Box-Cox.False
methodstr, 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’
fixeddict, optional, default=NoneDictionary containing fixed coefficients for the AutoRegressive model. Example: {'ar1': 0.5, 'ar5': 0.75}. For autoregressive terms use the ar{i} keys.None
aliasstrCustom name of the model.‘AutoRegressive’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None
AutoRegressive.fit
fit(y, X=None)
Fit the model to a time series (numpy array) y and optionally exogenous variables (numpy array) X. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeOptional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
selfFitted model.
AutoRegressive.predict
predict(h, X=None, level=None)
Predict with fitted model. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
forecastsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
AutoRegressive.predict_in_sample
predict_in_sample(level=None)
Access fitted insample predictions. Parameters:
NameTypeDescriptionDefault
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
forecastsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
AutoRegressive.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory efficient predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n, ).required
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
X_futurearray - likeOptional exogenous of shape (h, n_x) optional exogenous.None
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedboolWhether or not returns insample predictions.False
Returns:
NameTypeDescription
forecastsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

Exponential Smoothing

SimpleExponentialSmoothing

SimpleExponentialSmoothing

SimpleExponentialSmoothing(alpha, alias='SES', prediction_intervals=None)
Bases: _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 tt observations, the one-step forecast is given by: hatyt+1=alphayt+(1alpha)hatyt1\\hat{y}_{t+1} = \\alpha y_t + (1-\\alpha) \\hat{y}_{t-1} The rate 0leqalphaleq10 \\leq \\alpha \\leq 1 at which the weights decrease is called the smoothing parameter. When alpha=1\\alpha = 1, SES is equal to the naive method. Parameters:
NameTypeDescriptionDefault
alphafloatSmoothing parameter.required
aliasstrCustom name of the model.‘SES’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None
SimpleExponentialSmoothing.fit
fit(y, X=None)
Fit the SimpleExponentialSmoothing model. Fit an SimpleExponentialSmoothing to a time series (numpy array) y and optionally exogenous variables (numpy array) X. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeOptional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
selfSimpleExponentialSmoothing fitted model.
SimpleExponentialSmoothing.predict
predict(h, X=None, level=None)
Predict with fitted SimpleExponentialSmoothing. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
SimpleExponentialSmoothing.predict_in_sample
predict_in_sample()
Access fitted SimpleExponentialSmoothing insample predictions. Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions.
SimpleExponentialSmoothing.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient SimpleExponentialSmoothing predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n, ).required
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
X_futurearray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedboolWhether or not to return insample predictions.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

SimpleExponentialSmoothingOptimized

SimpleExponentialSmoothingOptimized

SimpleExponentialSmoothingOptimized(alias='SESOpt', prediction_intervals=None)
Bases: _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 tt observations, the one-step forecast is given by: hatyt+1=alphayt+(1alpha)hatyt1\\hat{y}_{t+1} = \\alpha y_t + (1-\\alpha) \\hat{y}_{t-1} The smoothing parameter alpha\*\\alpha^\* is optimized by square error minimization. Parameters:
NameTypeDescriptionDefault
aliasstrCustom name of the model.‘SESOpt’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. This is required for generating future prediction intervals.None
SimpleExponentialSmoothingOptimized.fit
fit(y, X=None)
Fit the SimpleExponentialSmoothingOptimized model. Fit an SimpleExponentialSmoothingOptimized to a time series (numpy array) y and optionally exogenous variables (numpy array) X. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeOptional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
SimpleExponentialSmoothingOptimizedSimpleExponentialSmoothingOptimized fitted model.
SimpleExponentialSmoothingOptimized.predict
predict(h, X=None, level=None)
Predict with fitted SimpleExponentialSmoothingOptimized. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
SimpleExponentialSmoothingOptimized.predict_in_sample
predict_in_sample()
Access fitted SimpleExponentialSmoothingOptimized insample predictions. Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions.
SimpleExponentialSmoothingOptimized.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient SimpleExponentialSmoothingOptimized predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n, ).required
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
X_futurearray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedboolWhether or not to return insample predictions.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

SeasonalExponentialSmoothing

SeasonalExponentialSmoothing

SeasonalExponentialSmoothing(
    season_length, alpha, alias="SeasonalES", prediction_intervals=None
)
Bases: _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 tt observations and season ss, the one-step forecast is given by: hatyt+1,s=alphayt+(1alpha)hatyt1,s\\hat{y}_{t+1,s} = \\alpha y_t + (1-\\alpha) \\hat{y}_{t-1,s} Parameters:
NameTypeDescriptionDefault
alphafloatSmoothing parameter.required
season_lengthintNumber of observations per unit of time. Ex: 24 Hourly data.required
aliasstrCustom name of the model.‘SeasonalES’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. This is required for generating future prediction intervals.None
SeasonalExponentialSmoothing.fit
fit(y, X=None)
Fit the SeasonalExponentialSmoothing model. Fit an SeasonalExponentialSmoothing to a time series (numpy array) y and optionally exogenous variables (numpy array) X. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeOptional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
SeasonalExponentialSmoothingSeasonalExponentialSmoothing fitted model.
SeasonalExponentialSmoothing.predict
predict(h, X=None, level=None)
Predict with fitted SeasonalExponentialSmoothing. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
SeasonalExponentialSmoothing.predict_in_sample
predict_in_sample()
Access fitted SeasonalExponentialSmoothing insample predictions. Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions.
SeasonalExponentialSmoothing.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient SeasonalExponentialSmoothing predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n, ).required
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
X_futurearray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedboolWhether or not returns insample predictions.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

SeasonalExponentialSmoothingOptimized

SeasonalExponentialSmoothingOptimized

SeasonalExponentialSmoothingOptimized(
    season_length, alias="SeasESOpt", prediction_intervals=None
)
Bases: _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 tt observations and season ss, the one-step forecast is given by: hatyt+1,s=alphayt+(1alpha)hatyt1,s\\hat{y}_{t+1,s} = \\alpha y_t + (1-\\alpha) \\hat{y}_{t-1,s} The smoothing parameter alpha\*\\alpha^\* is optimized by square error minimization. Parameters:
NameTypeDescriptionDefault
season_lengthintNumber of observations per unit of time. Ex: 24 Hourly data.required
aliasstrCustom name of the model.‘SeasESOpt’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. This is required for generating future prediction intervals.None
SeasonalExponentialSmoothingOptimized.fit
fit(y, X=None)
Fit the SeasonalExponentialSmoothingOptimized model. Fit an SeasonalExponentialSmoothingOptimized to a time series (numpy array) y and optionally exogenous variables (numpy array) X. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeOptional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
SeasonalExponentialSmoothingOptimizedSeasonalExponentialSmoothingOptimized fitted model.
SeasonalExponentialSmoothingOptimized.predict
predict(h, X=None, level=None)
Predict with fitted SeasonalExponentialSmoothingOptimized. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
SeasonalExponentialSmoothingOptimized.predict_in_sample
predict_in_sample()
Access fitted SeasonalExponentialSmoothingOptimized insample predictions. Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions.
SeasonalExponentialSmoothingOptimized.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient SeasonalExponentialSmoothingOptimized predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n, ).required
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
X_futurearray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedboolWhether or not to return insample predictions.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

Holt

Holt

Holt(season_length=1, error_type='A', alias='Holt', prediction_intervals=None)
Bases: 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:
NameTypeDescriptionDefault
season_lengthintNumber of observations per unit of time. Ex: 12 Monthly data.1
error_typestrThe type of error of the ETS model. Can be additive (A) or multiplicative (M).’A’
aliasstrCustom name of the model.‘Holt’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None

HoltWinters

HoltWinters

HoltWinters(
    season_length=1,
    error_type="A",
    alias="HoltWinters",
    prediction_intervals=None,
)
Bases: 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:
NameTypeDescriptionDefault
season_lengthintNumber of observations per unit of time. Ex: 12 Monthly data.1
error_typestrThe type of error of the ETS model. Can be additive (A) or multiplicative (M).’A’
aliasstrCustom name of the model.‘HoltWinters’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None

Baseline Models

HistoricAverage

HistoricAverage

HistoricAverage(alias='HistoricAverage', prediction_intervals=None)
Bases: _TS HistoricAverage model. Also known as mean method. Uses a simple average of all past observations. Assuming there are tt observations, the one-step forecast is given by: y^t+1=1tj=1tyj\hat{y}_{t+1} = \frac{1}{t} \sum_{j=1}^t y_j Parameters:
NameTypeDescriptionDefault
aliasstrCustom name of the model.‘HistoricAverage’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None
HistoricAverage.fit
fit(y, X=None)
Fit the HistoricAverage model. Fit an HistoricAverage to a time series (numpy array) y. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeOptional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
selfHistoricAverage fitted model.
r
HistoricAverage.predict
predict(h, X=None, level=None)
Predict with fitted HistoricAverage. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
XOptional[ndarray]Optional exogenous of shape (h, n_x). Defaults to None.None
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
HistoricAverage.predict_in_sample
predict_in_sample(level=None)
Access fitted HistoricAverage insample predictions. Parameters:
NameTypeDescriptionDefault
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions.
HistoricAverage.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient HistoricAverage predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yndarrayClean time series of shape (n, ).required
hintForecast horizon.required
XOptional[ndarray]Optional insample exogenous of shape (t, n_x). Defaults to None.None
X_futureOptional[ndarray]Optional exogenous of shape (h, n_x). Defaults to None.None
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
fittedboolWhether or not to return insample predictions. Defaults to False.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

Naive

Naive

Naive(alias='Naive', prediction_intervals=None)
Bases: _TS Naive model. All forecasts have the value of the last observation: haty_t+1=yt\\hat{y}\_{t+1} = y_t for all tt Parameters:
NameTypeDescriptionDefault
aliasstrCustom name of the model. Defaults to “Naive”.’Naive’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. Defaults to None.None
Naive.fit
fit(y, X=None)
Fit the Naive model. Fit an Naive to a time series (numpy.array) y. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeOptional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
selfNaive fitted model.
Naive.predict
predict(h, X=None, level=None)
Predict with fitted Naive. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
Naive.predict_in_sample
predict_in_sample(level=None)
Access fitted Naive insample predictions. Parameters:
NameTypeDescriptionDefault
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions.
Naive.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient Naive predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n,).required
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
X_futurearray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedboolWhether or not to return insample predictions.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

RandomWalkWithDrift

RandomWalkWithDrift

RandomWalkWithDrift(alias='RWD', prediction_intervals=None)
Bases: _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. y^t+1=yt+1t1j=1t(yjyj1)=yt+yty1t1\hat{y}_{t+1} = y_t+\frac{1}{t-1}\sum_{j=1}^t (y_j-y_{j-1}) = y_t+ \frac{y_t-y_1}{t-1} From the previous equation, we can see that this is equivalent to extrapolating a line between the first and the last observation. Parameters:
NameTypeDescriptionDefault
aliasstrCustom name of the model.‘RWD’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None
RandomWalkWithDrift.fit
fit(y, X=None)
Fit the RandomWalkWithDrift model. Fit an RandomWalkWithDrift to a time series (numpy array) y. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Returns:
NameTypeDescription
selfRandomWalkWithDrift fitted model.
r
RandomWalkWithDrift.predict
predict(h, X=None, level=None)
Predict with fitted RandomWalkWithDrift. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
RandomWalkWithDrift.predict_in_sample
predict_in_sample(level=None)
Access fitted RandomWalkWithDrift insample predictions. Parameters:
NameTypeDescriptionDefault
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
RandomWalkWithDrift.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient RandomWalkWithDrift predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n,).required
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
X_futurearray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedboolWhether or not to return insample predictions.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

SeasonalNaive

SeasonalNaive

SeasonalNaive(season_length, alias='SeasonalNaive', prediction_intervals=None)
Bases: _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:
NameTypeDescriptionDefault
season_lengthintNumber of observations per unit of time. Ex: 24 Hourly data.required
aliasstrCustom name of the model.‘SeasonalNaive’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None
SeasonalNaive.fit
fit(y, X=None)
Fit the SeasonalNaive model. Fit an SeasonalNaive to a time series (numpy array) y. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeOptional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
selfSeasonalNaive fitted model.
r
SeasonalNaive.predict
predict(h, X=None, level=None)
Predict with fitted Naive. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
SeasonalNaive.predict_in_sample
predict_in_sample(level=None)
Access fitted SeasonalNaive insample predictions. Parameters:
NameTypeDescriptionDefault
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
r
SeasonalNaive.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient SeasonalNaive predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n, ).required
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
X_futurearray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedboolWhether or not to return insample predictions.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

WindowAverage

WindowAverage

WindowAverage(window_size, alias='WindowAverage', prediction_intervals=None)
Bases: _TS WindowAverage model. Uses the average of the last kk observations, with kk 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:
NameTypeDescriptionDefault
window_sizeintSize of truncated series on which average is estimated.required
aliasstrCustom name of the model.‘WindowAverage’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. This is required for generating future prediction intervals.None
r
WindowAverage.fit
fit(y, X=None)
Fit the WindowAverage model. Fit an WindowAverage to a time series (numpy array) y and optionally exogenous variables (numpy array) X. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeOptional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
selfWindowAverage fitted model.
WindowAverage.predict
predict(h, X=None, level=None)
Predict with fitted WindowAverage. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
XarrayOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
WindowAverage.predict_in_sample
predict_in_sample()
Access fitted WindowAverage insample predictions. Parameters:
NameTypeDescriptionDefault
levelList[float]Confidence levels (0-100) for prediction intervals.required
Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
WindowAverage.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient WindowAverage predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yndarrayClean time series of shape (n, ).required
hintForecast horizon.required
XOptional[ndarray]Optional insample exogenous of shape (t, n_x).None
X_futureOptional[ndarray]Optional exogenous of shape (h, n_x).None
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals.None
fittedboolWhether or not to return insample predictions.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

SeasonalWindowAverage

SeasonalWindowAverage

SeasonalWindowAverage(
    season_length, window_size, alias="SeasWA", prediction_intervals=None
)
Bases: _TS SeasonalWindowAverage model. An average of the last kk observations of the same period, with kk the length of the window. Parameters:
NameTypeDescriptionDefault
season_lengthintNumber of observations per unit of time. Ex: 24 Hourly data.required
window_sizeintSize of truncated series on which average is estimated.required
aliasstrCustom name of the model.‘SeasWA’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. This is required for generating future prediction intervals.None
r
SeasonalWindowAverage.fit
fit(y, X=None)
Fit the SeasonalWindowAverage model. Fit an SeasonalWindowAverage to a time series (numpy array) y and optionally exogenous variables (numpy array) X. Parameters:
NameTypeDescriptionDefault
yndarrayClean time series of shape (t, ).required
XOptional[ndarray]Optional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
SeasonalWindowAverageSeasonalWindowAverage fitted model.
SeasonalWindowAverage.predict
predict(h, X=None, level=None)
Predict with fitted SeasonalWindowAverage. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
XOptional[ndarray]Optional insample exogenous of shape (t, n_x).None
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
SeasonalWindowAverage.predict_in_sample
predict_in_sample()
Access fitted SeasonalWindowAverage insample predictions. Parameters:
NameTypeDescriptionDefault
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals.required
Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
SeasonalWindowAverage.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient SeasonalWindowAverage predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yndarrayClean time series of shape (n,).required
hintForecast horizon.required
XOptional[ndarray]Optional insample exogenous of shape (t, n_x). Defaults to None.None
X_futureOptional[ndarray]Optional exogenous of shape (h, n_x). Defaults to None.None
levelOptional[List[int]]Confidence levels for prediction intervals. Defaults to None.None
fittedboolWhether or not to return insample predictions. Defaults to False.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

Sparse or Intermittent Models

ADIDA

ADIDA

ADIDA(alias='ADIDA', prediction_intervals=None)
Bases: _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:
NameTypeDescriptionDefault
aliasstrCustom name of the model. Defaults to “ADIDA”.’ADIDA’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. Defaults to None.None
ADIDA.fit
fit(y, X=None)
Fit the ADIDA model. Fit an ADIDA to a time series (numpy array) y. Parameters:
NameTypeDescriptionDefault
yndarrayClean time series of shape (t, ).required
XOptional[ndarray]Optional exogenous variables. Defaults to None.None
Returns:
NameTypeDescription
ADIDAADIDA fitted model.
ADIDA.predict
predict(h, X=None, level=None)
Predict with fitted ADIDA. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
XOptional[ndarray]Optional exogenous of shape (h, n_x). Defaults to None.None
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
ADIDA.predict_in_sample
predict_in_sample(level=None)
Access fitted ADIDA insample predictions. Parameters:
NameTypeDescriptionDefault
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
ADIDA.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient ADIDA predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yndarrayClean time series of shape (n,).required
hintForecast horizon.required
XOptional[ndarray]Optional insample exogenous of shape (t, n_x). Defaults to None.None
X_futureOptional[ndarray]Optional exogenous of shape (h, n_x). Defaults to None.None
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
fittedboolWhether or not to return insample predictions. Defaults to False.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

CrostonClassic

CrostonClassic

CrostonClassic(alias='CrostonClassic', prediction_intervals=None)
Bases: _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 ztz_t and inter-demand intervals ptp_t. Then the forecast is given by: y^t=z^tp^t\hat{y}_t = \frac{\hat{z}_t}{\hat{p}_t} where hatz_t\\hat{z}\_t and hatp_t\\hat{p}\_t are forecasted using SES. The smoothing parameter of both components is set equal to 0.1 Parameters:
NameTypeDescriptionDefault
aliasstrCustom name of the model. Defaults to “CrostonClassic”.’CrostonClassic’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. Defaults to None.None
CrostonClassic.fit
fit(y, X=None)
Fit the CrostonClassic model. Fit an CrostonClassic to a time series (numpy array) y. Parameters:
NameTypeDescriptionDefault
yndarrayClean time series of shape (t, ).required
XOptional[ndarray]Optional exogenous variables. Defaults to None.None
Returns:
NameTypeDescription
CrostonClassicCrostonClassic fitted model.
CrostonClassic.predict
predict(h, X=None, level=None)
Predict with fitted CrostonClassic. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
XOptional[ndarray]Optional exogenous of shape (h, n_x). Defaults to None.None
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
CrostonClassic.predict_in_sample
predict_in_sample(level=None)
Access fitted CrostonClassic insample predictions. Parameters:
NameTypeDescriptionDefault
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
CrostonClassic.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient CrostonClassic predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yndarrayClean time series of shape (n, ).required
hintForecast horizon.required
XOptional[ndarray]Optional insample exogenous of shape (t, n_x). Defaults to None.None
X_futureOptional[ndarray]Optional exogenous of shape (h, n_x). Defaults to None.None
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
fittedboolWhether or not returns insample predictions. Defaults to False.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

CrostonOptimized

CrostonOptimized

CrostonOptimized(alias='CrostonOptimized', prediction_intervals=None)
Bases: _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 ztz_t and inter-demand intervals ptp_t. Then the forecast is given by: y^t=z^tp^t\hat{y}_t = \frac{\hat{z}_t}{\hat{p}_t} A variation of the classic Croston’s method where the smooting paramater is optimally selected from the range [0.1,0.3][0.1,0.3]. Both the non-zero demand ztz_t and the inter-demand intervals ptp_t are smoothed separately, so their smoothing parameters can be different. Parameters:
NameTypeDescriptionDefault
aliasstrCustom name of the model. Defaults to “CrostonOptimized”.’CrostonOptimized’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. This is required for generating future prediction intervals. Defaults to None.None
CrostonOptimized.fit
fit(y, X=None)
Fit the CrostonOptimized model. Fit an CrostonOptimized to a time series (numpy array) y. Parameters:
NameTypeDescriptionDefault
yndarrayClean time series of shape (t, ).required
XOptional[ndarray]Optional exogenous variables. Defaults to None.None
Returns:
NameTypeDescription
CrostonOptimizedCrostonOptimized fitted model.
CrostonOptimized.predict
predict(h, X=None, level=None)
Predict with fitted CrostonOptimized. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
XOptional[ndarray]Optional insample exogenous of shape (t, n_x). Defaults to None.None
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
CrostonOptimized.predict_in_sample
predict_in_sample(level=None)
Access fitted CrostonOptimized insample predictions. Parameters:
NameTypeDescriptionDefault
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
CrostonOptimized.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient CrostonOptimized predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yndarrayClean time series of shape (n, ).required
hintForecast horizon.required
XOptional[ndarray]Optional insample exogenous of shape (t, n_x). Defaults to None.None
X_futureOptional[ndarray]Optional exogenous of shape (h, n_x). Defaults to None.None
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
fittedboolWhether or not returns insample predictions. Defaults to False.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

CrostonSBA

CrostonSBA

CrostonSBA(alias='CrostonSBA', prediction_intervals=None)
Bases: _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 ztz_t and inter-demand intervals ptp_t. Then the forecast is given by: y^t=z^tp^t\hat{y}_t = \frac{\hat{z}_t}{\hat{p}_t} A variation of the classic Croston’s method that uses a debiasing factor, so that the forecast is given by: y^t=0.95z^tp^t\hat{y}_t = 0.95 \frac{\hat{z}_t}{\hat{p}_t} Parameters:
NameTypeDescriptionDefault
aliasstrCustom name of the model. Defaults to “CrostonSBA”.’CrostonSBA’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. Defaults to None.None
CrostonSBA.fit
fit(y, X=None)
Fit the CrostonSBA model. Fit an CrostonSBA to a time series (numpy array) y. Parameters:
NameTypeDescriptionDefault
yndarrayClean time series of shape (t, ).required
XOptional[ndarray]Optional exogenous variables. Defaults to None.None
Returns:
NameTypeDescription
CrostonSBACrostonSBA fitted model.
CrostonSBA.predict
predict(h, X=None, level=None)
Predict with fitted CrostonSBA. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
XOptional[ndarray]Optional exogenous of shape (h, n_x). Defaults to None.None
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
CrostonSBA.predict_in_sample
predict_in_sample(level=None)
Access fitted CrostonSBA insample predictions. Parameters:
NameTypeDescriptionDefault
levelOptional[List[int]]Confidence levels (0-100) prediction intervals. Defaults to None.None
Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
CrostonSBA.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient CrostonSBA predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yndarrayClean time series of shape (n, ).required
hintForecast horizon.required
XOptional[ndarray]Optional insample exogenous of shape (t, n_x). Defaults to None.None
X_futureOptional[ndarray]Optional exogenous of shape (h, n_x). Defaults to None.None
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
fittedboolWhether or not to return insample predictions. Defaults to False.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

IMAPA

IMAPA

IMAPA(alias='IMAPA', prediction_intervals=None)
Bases: _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:
NameTypeDescriptionDefault
aliasstrCustom name of the model. Defaults to “IMAPA”.’IMAPA’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. Defaults to None.None
IMAPA.fit
fit(y, X=None)
Fit the IMAPA model. Fit an IMAPA to a time series (numpy array) y. Parameters:
NameTypeDescriptionDefault
yndarrayClean time series of shape (t, ).required
XOptional[ndarray]Optional exogenous variables. Defaults to None.None
Returns:
NameTypeDescription
IMAPAIMAPA fitted model.
IMAPA.predict
predict(h, X=None, level=None)
Predict with fitted IMAPA. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
XOptional[ndarray]Optional exogenous of shape (h, n_x). Defaults to None.None
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
IMAPA.predict_in_sample
predict_in_sample(level=None)
Access fitted IMAPA insample predictions. Parameters:
NameTypeDescriptionDefault
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
IMAPA.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient IMAPA predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yndarrayClean time series of shape (n, ).required
hintForecast horizon.required
XOptional[ndarray]Optional insample exogenous of shape (t, n_x). Defaults to None.None
X_futureOptional[ndarray]Optional exogenous of shape (h, n_x). Defaults to None.None
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
fittedboolWhether or not to return insample predictions. Defaults to False.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

TSB

TSB

TSB(alpha_d, alpha_p, alias='TSB', prediction_intervals=None)
Bases: _TS TSB model. Teunter-Syntetos-Babai: A modification of Croston’s method that replaces the inter-demand intervals with the demand probability dtd_t, which is defined as follows. dt={1if demand occurs at time t0otherwise.d_t = \begin{cases} 1 & \text{if demand occurs at time t} \\ 0 & \text{otherwise.} \end{cases} Hence, the forecast is given by y^t=d^tzt^\hat{y}_t= \hat{d}_t\hat{z_t} Both dtd_t and ztz_t are forecasted using SES. The smooting paramaters of each may differ, like in the optimized Croston’s method. Parameters:
NameTypeDescriptionDefault
alpha_dfloatSmoothing parameter for demand.required
alpha_pfloatSmoothing parameter for probability.required
aliasstrCustom name of the model. Defaults to “TSB”.’TSB’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. This is required for generating future prediction intervals. Defaults to None.None
TSB.fit
fit(y, X=None)
Fit the TSB model. Fit an TSB to a time series (numpy array) y. Parameters:
NameTypeDescriptionDefault
yndarrayClean time series of shape (t, ).required
XOptional[ndarray]Optional exogenous variables. Defaults to None.None
Returns:
NameTypeDescription
TSBTSB fitted model.
TSB.predict
predict(h, X=None, level=None)
Predict with fitted TSB. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
XOptional[ndarray]Optional exogenous of shape (h, n_x). Defaults to None.None
levelOptional[List[int]]Confidence levels (0-100) for prediction intervals. Defaults to None.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
TSB.predict_in_sample
predict_in_sample(level=None)
Access fitted TSB insample predictions. Parameters:
NameTypeDescriptionDefault
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
forecastsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
TSB.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient TSB predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n, ).required
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
X_futurearray - likeOptional exogenous of shape (h, n_x).None
fittedboolWhether or not returns insample predictions.False
Returns:
NameTypeDescription
forecastsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

Multiple Seasonalities

MSTL

MSTL

MSTL(
    season_length,
    trend_forecaster=AutoETS(model="ZZN"),
    stl_kwargs=None,
    alias="MSTL",
    prediction_intervals=None,
)
Bases: _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:
NameTypeDescriptionDefault
season_lengthUnion[int, List[int]]Number of observations per unit of time. For multiple seasonalities use a list.required
trend_forecastermodel, default=AutoETS(model=‘ZZN’)StatsForecast model used to forecast the trend component.AutoETS(model=‘ZZN’)
stl_kwargsdictExtra arguments to pass to statsmodels.tsa.seasonal.STL. The period and seasonal arguments are reserved.None
aliasstrCustom name of the model.‘MSTL’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None
MSTL.fit
fit(y, X=None)
Fit the MSTL model. Fit MSTL to a time series (numpy array) y. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeOptional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
selfMSTL fitted model.
MSTL.predict
predict(h, X=None, level=None)
Predict with fitted MSTL. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
forecastsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
MSTL.predict_in_sample
predict_in_sample(level=None)
Access fitted MSTL insample predictions. Parameters:
NameTypeDescriptionDefault
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
forecastsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
MSTL.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient MSTL predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n, ).required
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
X_futurearray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedboolWhether or not to return insample predictions.False
Returns:
NameTypeDescription
forecastsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

MFLES

MFLES

MFLES(
    season_length=None,
    fourier_order=None,
    max_rounds=50,
    ma=None,
    alpha=1.0,
    decay=-1.0,
    changepoints=True,
    n_changepoints=0.25,
    seasonal_lr=0.9,
    trend_lr=0.9,
    exogenous_lr=1.0,
    residuals_lr=1.0,
    cov_threshold=0.7,
    moving_medians=False,
    min_alpha=0.05,
    max_alpha=1.0,
    trend_penalty=True,
    multiplicative=None,
    smoother=False,
    robust=None,
    verbose=False,
    prediction_intervals=None,
    alias="MFLES",
)
Bases: _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:
NameTypeDescriptionDefault
season_lengthint or list of intNumber of observations per unit of time. Ex: 24 Hourly data. Default None.None
fourier_orderintHow 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_roundsintThe 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
maintThe 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
alphafloatThe alpha which is used in fitting the underlying LASSO when using piecewise functions. Default 1.0.1.0
decayfloatEffects the slopes of the piecewise-linear basis function. Default -1.0.-1.0
changepointsbooleanWhether 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_changepointsint or floatNumber (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_lrfloatA 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_lrfloatA 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_lrfloatThe 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_lrfloatA 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_thresholdfloatThe 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_mediansboolThe 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_alphafloatThe minimum alpha in the SES ensemble. Default 0.05.0.05
max_alphafloatThe maximum alpha used in the SES ensemble. Default 1.0.1.0
trend_penaltyboolWhether to apply a simple penalty to the linear trend component, very useful for dealing with the potentially dangerous piecewise trend. Default True.True
multiplicativeboolAuto-set based on internal logic. If True, it will simply take the log of the time series. Default None.None
smootherboolIf True, then a simple exponential ensemble will be used rather than auto settings. Default False.False
robustboolIf 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
verboseboolPrint debugging information. Default False.False
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. This is required for generating future prediction intervals.None
aliasstrCustom name of the model. Default ‘MFLES’.‘MFLES’
MFLES.fit
fit(y, X=None)
Fit the model Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeExogenous of shape (t, n_x). Default None.None
Returns:
NameTypeDescription
selfMFLESFitted MFLES object.
MFLES.predict
predict(h, X=None, level=None)
Predict with fitted MFLES. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeExogenous of shape (h, n_x). Default None.None
levelList[int]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
forecastsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
MFLES.predict_in_sample
predict_in_sample(level=None)
Access fitted SklearnModel insample predictions. Parameters:
NameTypeDescriptionDefault
levelList[int]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
forecastsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
MFLES.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient MFLES predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
hintForecast horizon.required
Xarray - likeInsample exogenous of shape (t, n_x).None
X_futurearray - likeExogenous of shape (h, n_x).None
levelList[int]Confidence levels (0-100) for prediction intervals.None
fittedboolWhether or not to return insample predictions. Default False.False
Returns:
NameTypeDescription
forecastsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

TBATS

TBATS

TBATS(
    season_length,
    use_boxcox=True,
    bc_lower_bound=0.0,
    bc_upper_bound=1.0,
    use_trend=True,
    use_damped_trend=False,
    use_arma_errors=False,
    alias="TBATS",
)
Bases: 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:
NameTypeDescriptionDefault
season_lengthUnion[int, List[int]]Number of observations per unit of time. Ex: 24 Hourly data.required
use_boxcoxOptional[bool]Whether or not to use a Box-Cox transformation. Default True.True
bc_lower_boundfloatLower bound for the Box-Cox transformation. Default 0.0.0.0
bc_upper_boundfloatUpper bound for the Box-Cox transformation. Default 1.0.1.0
use_trendOptional[bool]Whether or not to use a trend component. Default True.True
use_damped_trendOptional[bool]Whether or not to dampen the trend component. Default False.False
use_arma_errorsboolWhether or not to use a ARMA errors. Default False.False
aliasstrCustom name of the model. Default ‘TBATS’.‘TBATS’

Theta Family

Theta

Theta

Theta(
    season_length=1,
    decomposition_type="multiplicative",
    alias="Theta",
    prediction_intervals=None,
)
Bases: AutoTheta Standard Theta Method. Parameters:
NameTypeDescriptionDefault
season_lengthintNumber of observations per unit of time. Ex: 24 Hourly data. Default 1.1
decomposition_typestrSesonal decomposition type, ‘multiplicative’ (default) or ‘additive’. Default ‘multiplicative’.‘multiplicative’
aliasstrCustom name of the model. Default ‘Theta’.‘Theta’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. Default None.None

OptimizedTheta

OptimizedTheta

OptimizedTheta(
    season_length=1,
    decomposition_type="multiplicative",
    alias="OptimizedTheta",
    prediction_intervals=None,
)
Bases: AutoTheta Optimized Theta Method. Parameters:
NameTypeDescriptionDefault
season_lengthintNumber of observations per unit of time. Ex: 24 Hourly data. Default 1.1
decomposition_typestrSesonal decomposition type, ‘multiplicative’ (default) or ‘additive’. Default ‘multiplicative’.‘multiplicative’
aliasstrCustom name of the model. Default ‘OptimizedTheta’.‘OptimizedTheta’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals. Default None.None

DynamicTheta

DynamicTheta

DynamicTheta(
    season_length=1,
    decomposition_type="multiplicative",
    alias="DynamicTheta",
    prediction_intervals=None,
)
Bases: AutoTheta Dynamic Standard Theta Method. Parameters:
NameTypeDescriptionDefault
season_lengthintNumber of observations per unit of time. Ex: 24 Hourly data.1
decomposition_typestrSesonal decomposition type, ‘multiplicative’ (default) or ‘additive’.‘multiplicative’
aliasstrCustom name of the model.‘DynamicTheta’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None

DynamicOptimizedTheta

DynamicOptimizedTheta

DynamicOptimizedTheta(
    season_length=1,
    decomposition_type="multiplicative",
    alias="DynamicOptimizedTheta",
    prediction_intervals=None,
)
Bases: AutoTheta Dynamic Optimized Theta Method. Parameters:
NameTypeDescriptionDefault
season_lengthintNumber of observations per unit of time. Ex: 24 Hourly data.1
decomposition_typestrSesonal decomposition type, ‘multiplicative’ (default) or ‘additive’.‘multiplicative’
aliasstrCustom name of the model.‘DynamicOptimizedTheta’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None

ARCH/GARCH Family

GARCH

GARCH

GARCH(p=1, q=1, alias='GARCH', prediction_intervals=None)
Bases: _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 tt, yty_t is given by: yt=vtσty_t = v_t \sigma_t with σt2=w+i=1paiyti2+j=1qbjσtj2.\sigma_t^2 = w + \sum_{i=1}^p a_i y_{t-i}^2 + \sum_{j=1}^q b_j \sigma_{t-j}^2. Here vtv_t is a sequence of iid random variables with zero mean and unit variance. The coefficients ww, aia_i, i=1,...,pi=1,...,p, and bjb_j, j=1,...,qj=1,...,q must satisfy the following conditions:
  1. w>0w > 0 and ai,bjgeq0a_i, b_j \\geq 0 for all ii and jj.
  2. sum_k=1max(p,q)ak+bk<1\\sum\_{k=1}^{max(p,q)} a_k + b_k < 1. Here it is assumed that ai=0a_i=0 for i>pi>p and bj=0b_j=0 for j>qj>q.
The ARCH model is a particular case of the GARCH model when q=0q=0. Parameters:
NameTypeDescriptionDefault
pintNumber of lagged versions of the series.1
qintNumber of lagged versions of the volatility.1
aliasstrCustom name of the model.‘GARCH’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None
GARCH.fit
fit(y, X=None)
Fit GARCH model. Fit GARCH model to a time series (numpy array) y. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Returns:
NameTypeDescription
selfGARCH model.
GARCH.predict
predict(h, X=None, level=None)
Predict with fitted GARCH model. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
GARCH.predict_in_sample
predict_in_sample(level=None)
Access fitted GARCH model predictions. Parameters:
NameTypeDescriptionDefault
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
forecastsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
GARCH.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient GARCH model. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n, ).required
hintForecast horizon.required
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedboolWhether or not returns insample predictions.False
Returns:
NameTypeDescription
forecastsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

ARCH

ARCH

ARCH(p=1, alias='ARCH', prediction_intervals=None)
Bases: GARCH Autoregressive Conditional Heteroskedasticity (ARCH) model. A particular case of the GARCH(p,q) model where q=0q=0. It assumes that at time tt, yty_t is given by: yt=ϵtσty_t = \epsilon_t \sigma_t with σt2=w0+i=1paiyti2\sigma_t^2 = w0 + \sum_{i=1}^p a_i y_{t-i}^2 Here epsilont\\epsilon_t is a sequence of iid random variables with zero mean and unit variance. The coefficients ww and aia_i, i=1,...,pi=1,...,p must be nonnegative and sum_k=1pak<1\\sum\_{k=1}^p a_k < 1. Parameters:
NameTypeDescriptionDefault
pintNumber of lagged versions of the series.1
aliasstrCustom name of the model.‘ARCH’
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.None

Machine Learning

SklearnModel

SklearnModel

SklearnModel(model, prediction_intervals=None, alias=None)
Bases: _TS scikit-learn model wrapper Parameters:
NameTypeDescriptionDefault
modelBaseEstimatorscikit-learn estimatorrequired
prediction_intervalsOptional[ConformalIntervals]Information to compute conformal prediction intervals. This is required for generating future prediction intervals.None
aliasstrCustom name of the model. If None will use the model’s class.None
SklearnModel.fit
fit(y, X)
Fit the model. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeExogenous of shape (t, n_x).required
Returns:
NameTypeDescription
SklearnModelSklearnModelFitted SklearnModel object.
SklearnModel.predict
predict(h, X, level=None)
Predict with fitted SklearnModel. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeExogenous of shape (h, n_x).required
levelList[int]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDict[str, Any]Dictionary with entries mean for point predictions and level_* for probabilistic predictions.
SklearnModel.predict_in_sample
predict_in_sample(level=None)
Access fitted SklearnModel insample predictions. Parameters:
NameTypeDescriptionDefault
levelList[int]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDict[str, Any]Dictionary with entries fitted for point predictions and level_* for probabilistic predictions.
SklearnModel.forecast
forecast(y, h, X, X_future, level=None, fitted=False)
Memory Efficient SklearnModel predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
hintForecast horizon.required
Xarray - likeInsample exogenous of shape (t, n_x).required
X_futurearray - likeExogenous of shape (h, n_x).required
levelList[int]Confidence levels (0-100) for prediction intervals.None
fittedboolWhether or not to return insample predictions.False
Returns:
NameTypeDescription
dictDict[str, Any]Dictionary with entries mean for point predictions and level_* for probabilistic predictions.

Fallback Models

These models are used as fallbacks when other models fail during forecasting.

ConstantModel

ConstantModel

ConstantModel(constant, alias='ConstantModel')
Bases: _TS Constant Model. Returns Constant values. Parameters:
NameTypeDescriptionDefault
constantfloatCustom value to return as forecast.required
aliasstrCustom name of the model.‘ConstantModel’
ConstantModel.fit
fit(y, X=None)
Fit the Constant model. Fit an Constant Model to a time series (numpy.array) y. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (t, ).required
Xarray - likeOptional exogenous of shape (t, n_x).None
Returns:
NameTypeDescription
ConstantModelConstant fitted model.
ConstantModel.predict
predict(h, X=None, level=None)
Predict with fitted ConstantModel. Parameters:
NameTypeDescriptionDefault
hintForecast horizon.required
Xarray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
ConstantModel.predict_in_sample
predict_in_sample(level=None)
Access fitted Constant Model insample predictions. Parameters:
NameTypeDescriptionDefault
levelList[float]Confidence levels (0-100) for prediction intervals.None
Returns:
NameTypeDescription
dictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
ConstantModel.forecast
forecast(y, h, X=None, X_future=None, level=None, fitted=False)
Memory Efficient Constant Model predictions. This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance. Parameters:
NameTypeDescriptionDefault
yarrayClean time series of shape (n,).required
hintForecast horizon.required
Xarray - likeOptional insample exogenous of shape (t, n_x).None
X_futurearray - likeOptional exogenous of shape (h, n_x).None
levelList[float]Confidence levels (0-100) for prediction intervals.None
fittedboolWhether or not to return insample predictions.False
Returns:
NameTypeDescription
dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

ZeroModel

ZeroModel

ZeroModel(alias='ZeroModel')
Bases: ConstantModel Returns Zero forecasts. Returns Zero values. Parameters:
NameTypeDescriptionDefault
aliasstrCustom name of the model.‘ZeroModel’

NaNModel

NaNModel

NaNModel(alias='NaNModel')
Bases: ConstantModel NaN Model. Returns NaN values. Parameters:
NameTypeDescriptionDefault
aliasstrCustom name of the model.‘NaNModel’

Usage Examples

Basic Model Usage

from statsforecast import StatsForecast
from statsforecast.models import AutoARIMA, Naive
from statsforecast.utils import generate_series

# Generate example data
df = generate_series(n_series=10)

# Create StatsForecast instance with models
sf = StatsForecast(
    models=[
        AutoARIMA(season_length=7),
        Naive()
    ],
    freq='D'
)

# Forecast
forecasts = sf.forecast(df=df, h=7)

Using Multiple Models

from statsforecast import StatsForecast
from statsforecast.models import (
    AutoARIMA,
    AutoETS,
    SeasonalNaive,
    Theta,
    HistoricAverage
)

# Combine multiple models for comparison
models = [
    AutoARIMA(season_length=12),
    AutoETS(season_length=12),
    SeasonalNaive(season_length=12),
    Theta(season_length=12),
    HistoricAverage()
]

sf = StatsForecast(models=models, freq='M', n_jobs=-1)
forecasts = sf.forecast(df=df, h=12, level=[80, 95])

Model with Prediction Intervals

from statsforecast import StatsForecast
from statsforecast.models import AutoARIMA
from statsforecast.utils import ConformalIntervals

# Create model with conformal prediction intervals
model = AutoARIMA(
    season_length=12,
    prediction_intervals=ConformalIntervals(n_windows=2, h=12),
    alias='ConformalAutoARIMA'
)

sf = StatsForecast(models=[model], freq='M')
forecasts = sf.forecast(df=df, h=12, level=[80, 95])

Sparse/Intermittent Data

from statsforecast import StatsForecast
from statsforecast.models import (
    CrostonOptimized,
    ADIDA,
    IMAPA,
    TSB
)

# Models specialized for sparse/intermittent data
sparse_models = [
    CrostonOptimized(),
    ADIDA(),
    IMAPA(),
    TSB(alpha_d=0.2, alpha_p=0.2)
]

sf = StatsForecast(models=sparse_models, freq='D')
forecasts = sf.forecast(df=sparse_df, h=30)

Multiple Seasonalities

from statsforecast import StatsForecast
from statsforecast.models import MSTL, AutoTBATS

# For data with multiple seasonal patterns
models = [
    MSTL(season_length=[24, 168]),  # Hourly with daily and weekly seasonality
    AutoTBATS(season_length=[24, 168])
]

sf = StatsForecast(models=models, freq='H')
forecasts = sf.forecast(df=hourly_df, h=168)

ARCH/GARCH for Volatility

from statsforecast import StatsForecast
from statsforecast.models import GARCH, ARCH

# Models for financial data with volatility
volatility_models = [
    GARCH(p=1, q=1),
    ARCH(p=1)
]

sf = StatsForecast(models=volatility_models, freq='D')
forecasts = sf.forecast(df=financial_df, h=30)

Using Scikit-learn Models

from statsforecast import StatsForecast
from statsforecast.models import SklearnModel
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import Ridge

# Wrap scikit-learn models
models = [
    SklearnModel(RandomForestRegressor(n_estimators=100), alias='RF'),
    SklearnModel(Ridge(alpha=1.0), alias='Ridge')
]

sf = StatsForecast(models=models, freq='D')
forecasts = sf.forecast(df=df, h=14)

Model Selection Tips

  • For automatic selection: Start with AutoARIMA or AutoETS
  • For baseline comparison: Use Naive, SeasonalNaive, or HistoricAverage
  • For seasonal data: Use models with season_length parameter
  • 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

References

For detailed information on the statistical models and algorithms, please refer to the source code and the original academic papers referenced in the docstrings.