StatsForecast offers a wide variety of models grouped in the following categories:

  • Auto Forecast: Automatic forecasting tools search for the best parameters and select the best possible model for a series of time series. These tools are useful for large collections of univariate time series. Includes automatic versions of: Arima, ETS, Theta, CES.

  • Exponential Smoothing: Uses a weighted average of all past observations where the weights decrease exponentially into the past. Suitable for data with clear trend and/or seasonality. Use the SimpleExponential family for data with no clear trend or seasonality. Examples: SES, Holt’s Winters, SSO.

  • Benchmark models: classical models for establishing baselines. Examples: Mean, Naive, Random Walk

  • Intermittent or Sparse models: suited for series with very few non-zero observations. Examples: CROSTON, ADIDA, IMAPA

  • Multiple Seasonalities: suited for signals with more than one clear seasonality. Useful for low-frequency data like electricity and logs. Examples: MSTL and TBATS.

  • Theta Models: fit two theta lines to a deseasonalized time series, using different techniques to obtain and combine the two theta lines to produce the final forecasts. Examples: Theta, DynamicTheta

  • GARCH Model: suited for modeling time series that exhibit non-constant volatility over time. Commonly used in finance to model stock prices, exchange rates, interest rates, and other financial instruments. The ARCH model is a particular case of GARCH.

Automatic Forecasting

AutoARIMA


source

AutoARIMA

 AutoARIMA (d:Optional[int]=None, D:Optional[int]=None, max_p:int=5,
            max_q:int=5, max_P:int=2, max_Q:int=2, max_order:int=5,
            max_d:int=2, max_D:int=1, start_p:int=2, start_q:int=2,
            start_P:int=1, start_Q:int=1, stationary:bool=False,
            seasonal:bool=True, ic:str='aicc', stepwise:bool=True,
            nmodels:int=94, trace:bool=False,
            approximation:Optional[bool]=False, method:Optional[str]=None,
            truncate:Optional[bool]=None, test:str='kpss',
            test_kwargs:Optional[str]=None, seasonal_test:str='seas',
            seasonal_test_kwargs:Optional[Dict]=None,
            allowdrift:bool=True, allowmean:bool=True,
            blambda:Optional[float]=None, biasadj:bool=False,
            season_length:int=1, alias:str='AutoARIMA', prediction_interva
            ls:Optional[statsforecast.utils.ConformalIntervals]=None)

*AutoARIMA model.

Automatically selects the best ARIMA (AutoRegressive Integrated Moving Average) model using an information criterion. Default is Akaike Information Criterion (AICc).*

TypeDefaultDetails
dOptionalNoneOrder of first-differencing.
DOptionalNoneOrder of seasonal-differencing.
max_pint5Max autorregresives p.
max_qint5Max moving averages q.
max_Pint2Max seasonal autorregresives P.
max_Qint2Max seasonal moving averages Q.
max_orderint5Max p+q+P+Q value if not stepwise selection.
max_dint2Max non-seasonal differences.
max_Dint1Max seasonal differences.
start_pint2Starting value of p in stepwise procedure.
start_qint2Starting value of q in stepwise procedure.
start_Pint1Starting value of P in stepwise procedure.
start_Qint1Starting value of Q in stepwise procedure.
stationaryboolFalseIf True, restricts search to stationary models.
seasonalboolTrueIf False, restricts search to non-seasonal models.
icstraiccInformation criterion to be used in model selection.
stepwiseboolTrueIf True, will do stepwise selection (faster).
nmodelsint94Number of models considered in stepwise search.
traceboolFalseIf True, the searched ARIMA models is reported.
approximationOptionalFalseIf True, conditional sums-of-squares estimation, final MLE.
methodOptionalNoneFitting method between maximum likelihood or sums-of-squares.
truncateOptionalNoneObservations truncated series used in model selection.
teststrkpssUnit root test to use. See ndiffs for details.
test_kwargsOptionalNoneUnit root test additional arguments.
seasonal_teststrseasSelection method for seasonal differences.
seasonal_test_kwargsOptionalNoneSeasonal unit root test arguments.
allowdriftboolTrueIf True, drift models terms considered.
allowmeanboolTrueIf True, non-zero mean models considered.
blambdaOptionalNoneBox-Cox transformation parameter.
biasadjboolFalseUse adjusted back-transformed mean Box-Cox.
season_lengthint1Number of observations per unit of time. Ex: 24 Hourly data.
aliasstrAutoARIMACustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

AutoARIMA.fit

 AutoARIMA.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the AutoARIMA model.

Fit an AutoARIMA to a time series (numpy array) y and optionally exogenous variables (numpy array) X.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsAutoARIMA fitted model.

source

AutoARIMA.predict

 AutoARIMA.predict (h:int, X:Optional[numpy.ndarray]=None,
                    level:Optional[List[int]]=None)

Predict with fitted AutoArima.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

AutoARIMA.predict_in_sample

 AutoARIMA.predict_in_sample (level:Optional[List[int]]=None)

Access fitted AutoArima insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

AutoARIMA.forecast

 AutoARIMA.forecast (y:numpy.ndarray, h:int,
                     X:Optional[numpy.ndarray]=None,
                     X_future:Optional[numpy.ndarray]=None,
                     level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenpus of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x) optional exogenous.
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

AutoARIMA.forward

 AutoARIMA.forward (y:numpy.ndarray, h:int,
                    X:Optional[numpy.ndarray]=None,
                    X_future:Optional[numpy.ndarray]=None,
                    level:Optional[List[int]]=None, fitted:bool=False)

Apply fitted ARIMA model to a new time series.

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import AutoARIMA
from statsforecast.utils import AirPassengers as ap
# AutoARIMA's usage example
arima = AutoARIMA(season_length=4)
arima = arima.fit(y=ap)
y_hat_dict = arima.predict(h=4, level=[80])
y_hat_dict

AutoETS


source

AutoETS

 AutoETS (season_length:int=1, model:str='ZZZ',
          damped:Optional[bool]=None, phi:Optional[float]=None,
          alias:str='AutoETS', prediction_intervals:Optional[statsforecast
          .utils.ConformalIntervals]=None)

*Automatic Exponential Smoothing 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.*

TypeDefaultDetails
season_lengthint1Number of observations per unit of time. Ex: 24 Hourly data.
modelstrZZZControlling state-space-equations.
dampedOptionalNoneA parameter that ‘dampens’ the trend.
phiOptionalNoneSmoothing parameter for trend damping. Only used when damped=True.
aliasstrAutoETSCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

AutoETS.fit

 AutoETS.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=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.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsExponential Smoothing fitted model.

source

AutoETS.predict

 AutoETS.predict (h:int, X:Optional[numpy.ndarray]=None,
                  level:Optional[List[int]]=None)

Predict with fitted Exponential Smoothing.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenpus of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

AutoETS.predict_in_sample

 AutoETS.predict_in_sample (level:Optional[List[int]]=None)

Access fitted Exponential Smoothing insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

AutoETS.forecast

 AutoETS.forecast (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                   X_future:Optional[numpy.ndarray]=None,
                   level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenpus of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

AutoETS.forward

 AutoETS.forward (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                  X_future:Optional[numpy.ndarray]=None,
                  level:Optional[List[int]]=None, fitted:bool=False)

Apply fitted Exponential Smoothing model to a new time series.

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenpus of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import AutoETS
from statsforecast.utils import AirPassengers as ap
# AutoETS' usage example
# Multiplicative trend, optimal error and seasonality
autoets = AutoETS(model='ZMZ', season_length=4)
autoets = autoets.fit(y=ap)
y_hat_dict = autoets.predict(h=4)
y_hat_dict

AutoCES


source

AutoCES

 AutoCES (season_length:int=1, model:str='Z', alias:str='CES', prediction_
          intervals:Optional[statsforecast.utils.ConformalIntervals]=None)

*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.*

TypeDefaultDetails
season_lengthint1Number of observations per unit of time. Ex: 24 Hourly data.
modelstrZControlling state-space-equations.
aliasstrCESCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

AutoCES.fit

 AutoCES.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=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.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsComplex Exponential Smoothing fitted model.

source

AutoCES.predict

 AutoCES.predict (h:int, X:Optional[numpy.ndarray]=None,
                  level:Optional[List[int]]=None)

Predict with fitted Exponential Smoothing.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNone
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

AutoCES.predict_in_sample

 AutoCES.predict_in_sample (level:Optional[List[int]]=None)

Access fitted Exponential Smoothing insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

AutoCES.forecast

 AutoCES.forecast (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                   X_future:Optional[numpy.ndarray]=None,
                   level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenpus of shape (h, n_x).
levelOptionalNone
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

AutoCES.forward

 AutoCES.forward (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                  X_future:Optional[numpy.ndarray]=None,
                  level:Optional[List[int]]=None, fitted:bool=False)

Apply fitted Complex Exponential Smoothing to a new time series.

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenpus of shape (h, n_x).
levelOptionalNone
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import AutoCES
from statsforecast.utils import AirPassengers as ap
# CES' usage example
# Multiplicative trend, optimal error and seasonality
ces = AutoCES(model='Z',  
              season_length=4)
ces = ces.fit(y=ap)
y_hat_dict = ces.predict(h=4)
y_hat_dict

AutoTheta


source

AutoTheta

 AutoTheta (season_length:int=1, decomposition_type:str='multiplicative',
            model:Optional[str]=None, alias:str='AutoTheta', prediction_in
            tervals:Optional[statsforecast.utils.ConformalIntervals]=None)

*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.*

TypeDefaultDetails
season_lengthint1Number of observations per unit of time. Ex: 24 Hourly data.
decomposition_typestrmultiplicativeSesonal decomposition type, ‘multiplicative’ (default) or ‘additive’.
modelOptionalNoneControlling Theta Model. By default searchs the best model.
aliasstrAutoThetaCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

AutoTheta.fit

 AutoTheta.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the AutoTheta model.

Fit an AutoTheta model to a time series (numpy array) y and optionally exogenous variables (numpy array) X.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsAutoTheta fitted model.

source

AutoTheta.predict

 AutoTheta.predict (h:int, X:Optional[numpy.ndarray]=None,
                    level:Optional[List[int]]=None)

Predict with fitted AutoTheta.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

AutoTheta.predict_in_sample

 AutoTheta.predict_in_sample (level:Optional[List[int]]=None)

Access fitted AutoTheta insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

AutoTheta.forecast

 AutoTheta.forecast (y:numpy.ndarray, h:int,
                     X:Optional[numpy.ndarray]=None,
                     X_future:Optional[numpy.ndarray]=None,
                     level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

AutoTheta.forward

 AutoTheta.forward (y:numpy.ndarray, h:int,
                    X:Optional[numpy.ndarray]=None,
                    X_future:Optional[numpy.ndarray]=None,
                    level:Optional[List[int]]=None, fitted:bool=False)

Apply fitted AutoTheta to a new time series.

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import AutoTheta
from statsforecast.utils import AirPassengers as ap
# AutoTheta's usage example
theta = AutoTheta(season_length=4)
theta = theta.fit(y=ap)
y_hat_dict = theta.predict(h=4)
y_hat_dict

AutoMFLES


source

AutoMFLES

 AutoMFLES (test_size:int,
            season_length:Union[int,List[int],NoneType]=None,
            n_windows:int=2, config:Optional[Dict[str,Any]]=None,
            step_size:Optional[int]=None, metric:str='smape',
            verbose:bool=False, prediction_intervals:Optional[statsforecas
            t.utils.ConformalIntervals]=None, alias:str='AutoMFLES')

AutoMFLES

TypeDefaultDetails
test_sizeintForecast horizon used during cross validation.
season_lengthUnionNoneNumber of observations per unit of time. Ex: 24 Hourly data.
n_windowsint2Number of windows used for cross validation.
configOptionalNoneMapping from parameter name (from the init arguments of MFLES) to a list of values to try.
If None, will use defaults.
step_sizeOptionalNoneStep size between each cross validation window. If None will be set to test_size.
metricstrsmapeMetric used to select the best model. Possible options are: ‘smape’, ‘mape’, ‘mse’ and ‘mae’.
verboseboolFalsePrint debugging information.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
This is required for generating future prediction intervals.
aliasstrAutoMFLESCustom name of the model.

source

AutoMFLES.fit

 AutoMFLES.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

Fit the model

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneExogenous of shape (t, n_x).
ReturnsAutoMFLESFitted AutoMFLES object.

source

AutoMFLES.predict

 AutoMFLES.predict (h:int, X:Optional[numpy.ndarray]=None,
                    level:Optional[List[int]]=None)

Predict with fitted AutoMFLES.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneExogenous of shape (h, n_x).
levelOptionalNone
ReturnsDictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

AutoMFLES.predict_in_sample

 AutoMFLES.predict_in_sample (level:Optional[List[int]]=None)

Access fitted AutoMFLES insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsDictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

AutoMFLES.forecast

 AutoMFLES.forecast (y:numpy.ndarray, h:int,
                     X:Optional[numpy.ndarray]=None,
                     X_future:Optional[numpy.ndarray]=None,
                     level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
hintForecast horizon.
XOptionalNoneInsample exogenous of shape (t, n_x).
X_futureOptionalNoneExogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsDictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

AutoTBATS


source

AutoTBATS

 AutoTBATS (season_length:Union[int,List[int]],
            use_boxcox:Optional[bool]=None, bc_lower_bound:float=0.0,
            bc_upper_bound:float=1.0, use_trend:Optional[bool]=None,
            use_damped_trend:Optional[bool]=None,
            use_arma_errors:bool=True, alias:str='AutoTBATS')

*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.*

TypeDefaultDetails
season_lengthUnion
use_boxcoxOptionalNoneWhether or not to use a Box-Cox transformation. By default tries both.
bc_lower_boundfloat0.0Lower bound for the Box-Cox transformation.
bc_upper_boundfloat1.0Upper bound for the Box-Cox transformation.
use_trendOptionalNoneWhether or not to use a trend component. By default tries both.
use_damped_trendOptionalNoneWhether or not to dampen the trend component. By default tries both.
use_arma_errorsboolTrueWhether or not to use a ARMA errors. Default is True and this evaluates both models.
aliasstrAutoTBATSCustom name of the model.

source

AutoTBATS.fit

 AutoTBATS.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit TBATS model.

Fit TBATS model to a time series (numpy array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneIgnored
ReturnsTBATS model.

source

AutoTBATS.predict

 AutoTBATS.predict (h:int, X:Optional[numpy.ndarray]=None,
                    level:Optional[List[int]]=None)

Predict with fitted TBATS model.

TypeDefaultDetails
hintForecast horizon.
XOptionalNone
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

AutoTBATS.predict_in_sample

 AutoTBATS.predict_in_sample (level:Optional[Tuple[int]]=None)

Access fitted TBATS model predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

AutoTBATS.forecast

 AutoTBATS.forecast (y:numpy.ndarray, h:int,
                     X:Optional[numpy.ndarray]=None,
                     X_future:Optional[numpy.ndarray]=None,
                     level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNone
X_futureOptionalNone
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

ARIMA family

ARIMA


source

ARIMA

 ARIMA (order:Tuple[int,int,int]=(0, 0, 0), season_length:int=1,
        seasonal_order:Tuple[int,int,int]=(0, 0, 0),
        include_mean:bool=True, include_drift:bool=False,
        include_constant:Optional[bool]=None,
        blambda:Optional[float]=None, biasadj:bool=False, method:str='CSS-
        ML', fixed:Optional[dict]=None, alias:str='ARIMA', prediction_inte
        rvals:Optional[statsforecast.utils.ConformalIntervals]=None)

*ARIMA model.

AutoRegressive Integrated Moving Average model.*

TypeDefaultDetails
orderTuple(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.
season_lengthint1Number of observations per unit of time. Ex: 24 Hourly data.
seasonal_orderTuple(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.
include_meanboolTrueShould 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).
include_driftboolFalseShould the ARIMA model include a linear drift term?
(i.e., a linear regression with ARIMA errors is fitted.)
include_constantOptionalNoneIf 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.
blambdaOptionalNoneBox-Cox transformation parameter.
biasadjboolFalseUse adjusted back-transformed mean Box-Cox.
methodstrCSS-MLFitting 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.
fixedOptionalNoneDictionary 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.
aliasstrARIMACustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

ARIMA.fit

 ARIMA.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

Fit the model to a time series (numpy array) y and optionally exogenous variables (numpy array) X.

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsFitted model.

source

ARIMA.predict

 ARIMA.predict (h:int, X:Optional[numpy.ndarray]=None,
                level:Optional[List[int]]=None)

Predict with fitted model.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

ARIMA.predict_in_sample

 ARIMA.predict_in_sample (level:Optional[List[int]]=None)

Access fitted insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

ARIMA.forecast

 ARIMA.forecast (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                 X_future:Optional[numpy.ndarray]=None,
                 level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x) optional exogenous.
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

ARIMA.forward

 ARIMA.forward (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                X_future:Optional[numpy.ndarray]=None,
                level:Optional[List[int]]=None, fitted:bool=False)

Apply fitted model to a new time series.

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import ARIMA
from statsforecast.utils import AirPassengers as ap
# ARIMA's usage example
arima = ARIMA(order=(1, 0, 0), season_length=12)
arima = arima.fit(y=ap)
y_hat_dict = arima.predict(h=4, level=[80])
y_hat_dict

AutoRegressive


source

AutoRegressive

 AutoRegressive (lags:Tuple[int,List], include_mean:bool=True,
                 include_drift:bool=False, blambda:Optional[float]=None,
                 biasadj:bool=False, method:str='CSS-ML',
                 fixed:Optional[dict]=None, alias:str='AutoRegressive', pr
                 ediction_intervals:Optional[statsforecast.utils.Conformal
                 Intervals]=None)

Simple Autoregressive model.

TypeDefaultDetails
lagsTupleNumber 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.
include_meanboolTrueShould 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).
include_driftboolFalseShould the AutoRegressive model include a linear drift term?
(i.e., a linear regression with AutoRegressive errors is fitted.)
blambdaOptionalNoneBox-Cox transformation parameter.
biasadjboolFalseUse adjusted back-transformed mean Box-Cox.
methodstrCSS-MLFitting 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.
fixedOptionalNoneDictionary containing fixed coefficients for the AutoRegressive model. Example: {'ar1': 0.5, 'ar5': 0.75}.
For autoregressive terms use the ar{i} keys.
aliasstrAutoRegressiveCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

AutoRegressive.fit

 AutoRegressive.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

Fit the model to a time series (numpy array) y and optionally exogenous variables (numpy array) X.

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsFitted model.

source

AutoRegressive.predict

 AutoRegressive.predict (h:int, X:Optional[numpy.ndarray]=None,
                         level:Optional[List[int]]=None)

Predict with fitted model.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

AutoRegressive.predict_in_sample

 AutoRegressive.predict_in_sample (level:Optional[List[int]]=None)

Access fitted insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

AutoRegressive.forecast

 AutoRegressive.forecast (y:numpy.ndarray, h:int,
                          X:Optional[numpy.ndarray]=None,
                          X_future:Optional[numpy.ndarray]=None,
                          level:Optional[List[int]]=None,
                          fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x) optional exogenous.
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

AutoRegressive.forward

 AutoRegressive.forward (y:numpy.ndarray, h:int,
                         X:Optional[numpy.ndarray]=None,
                         X_future:Optional[numpy.ndarray]=None,
                         level:Optional[List[int]]=None,
                         fitted:bool=False)

Apply fitted model to a new time series.

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import AutoRegressive
from statsforecast.utils import AirPassengers as ap
# AutoRegressive's usage example
ar = AutoRegressive(lags=[12])
ar = ar.fit(y=ap)
y_hat_dict = ar.predict(h=4, level=[80])
y_hat_dict

ExponentialSmoothing

SimpleSmooth


source

SimpleExponentialSmoothing

 SimpleExponentialSmoothing (alpha:float, alias:str='SES', prediction_inte
                             rvals:Optional[statsforecast.utils.ConformalI
                             ntervals]=None)

*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: y^t+1=αyt+(1α)y^t1\hat{y}_{t+1} = \alpha y_t + (1-\alpha) \hat{y}_{t-1}

The rate 0α10 \leq \alpha \leq 1 at which the weights decrease is called the smoothing parameter. When α=1\alpha = 1, SES is equal to the naive method.*

TypeDefaultDetails
alphafloatSmoothing parameter.
aliasstrSESCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

SimpleExponentialSmoothing.forecast

 SimpleExponentialSmoothing.forecast (y:numpy.ndarray, h:int,
                                      X:Optional[numpy.ndarray]=None, X_fu
                                      ture:Optional[numpy.ndarray]=None,
                                      level:Optional[List[int]]=None,
                                      fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

SimpleExponentialSmoothing.fit

 SimpleExponentialSmoothing.fit (y:numpy.ndarray,
                                 X:Optional[numpy.ndarray]=None)

*Fit the SimpleExponentialSmoothing model.

Fit an SimpleExponentialSmoothing to a time series (numpy array) y and optionally exogenous variables (numpy array) X.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsSimpleExponentialSmoothing fitted model.

source

SimpleExponentialSmoothing.predict

 SimpleExponentialSmoothing.predict (h:int,
                                     X:Optional[numpy.ndarray]=None,
                                     level:Optional[List[int]]=None)

Predict with fitted SimpleExponentialSmoothing.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

SimpleExponentialSmoothing.predict_in_sample

 SimpleExponentialSmoothing.predict_in_sample ()

Access fitted SimpleExponentialSmoothing insample predictions.

from statsforecast.models import SimpleExponentialSmoothing
from statsforecast.utils import AirPassengers as ap
# SimpleExponentialSmoothing's usage example
ses = SimpleExponentialSmoothing(alpha=0.5)
ses = ses.fit(y=ap)
y_hat_dict = ses.predict(h=4)
y_hat_dict

SimpleSmoothOptimized


source

SimpleExponentialSmoothingOptimized

 SimpleExponentialSmoothingOptimized (alias:str='SESOpt', prediction_inter
                                      vals:Optional[statsforecast.utils.Co
                                      nformalIntervals]=None)

*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: y^t+1=αyt+(1α)y^t1\hat{y}_{t+1} = \alpha y_t + (1-\alpha) \hat{y}_{t-1}

The smoothing parameter α\alpha^* is optimized by square error minimization.*

TypeDefaultDetails
aliasstrSESOpt
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
This is required for generating future prediction intervals.

source

SimpleExponentialSmoothingOptimized.fit

 SimpleExponentialSmoothingOptimized.fit (y:numpy.ndarray,
                                          X:Optional[numpy.ndarray]=None)

*Fit the SimpleExponentialSmoothingOptimized model.

Fit an SimpleExponentialSmoothingOptimized to a time series (numpy array) y and optionally exogenous variables (numpy array) X.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsSimpleExponentialSmoothingOptimized fitted model.

source

SimpleExponentialSmoothingOptimized.predict

 SimpleExponentialSmoothingOptimized.predict (h:int,
                                              X:Optional[numpy.ndarray]=No
                                              ne, level:Optional[List[int]
                                              ]=None)

Predict with fitted SimpleExponentialSmoothingOptimized.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

SimpleExponentialSmoothingOptimized.predict_in_sample

 SimpleExponentialSmoothingOptimized.predict_in_sample ()

Access fitted SimpleExponentialSmoothingOptimized insample predictions.


source

SimpleExponentialSmoothingOptimized.forecast

 SimpleExponentialSmoothingOptimized.forecast (y:numpy.ndarray, h:int,
                                               X:Optional[numpy.ndarray]=N
                                               one, X_future:Optional[nump
                                               y.ndarray]=None, level:Opti
                                               onal[List[int]]=None,
                                               fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import SimpleExponentialSmoothingOptimized
from statsforecast.utils import AirPassengers as ap
# SimpleExponentialSmoothingOptimized's usage example
seso = SimpleExponentialSmoothingOptimized()
seso = seso.fit(y=ap)
y_hat_dict = seso.predict(h=4)
y_hat_dict

SeasonalSmooth

plt.plot(np.concatenate([ap[6:], seas_es.forecast(ap[6:], h=12)['mean']]))

source

SeasonalExponentialSmoothing

 SeasonalExponentialSmoothing (season_length:int, alpha:float,
                               alias:str='SeasonalES', prediction_interval
                               s:Optional[statsforecast.utils.ConformalInt
                               ervals]=None)

*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: y^t+1,s=αyt+(1α)y^t1,s\hat{y}_{t+1,s} = \alpha y_t + (1-\alpha) \hat{y}_{t-1,s}*

TypeDefaultDetails
season_lengthintNumber of observations per unit of time. Ex: 24 Hourly data.
alphafloatSmoothing parameter.
aliasstrSeasonalESCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
This is required for generating future prediction intervals.

source

SeasonalExponentialSmoothing.fit

 SeasonalExponentialSmoothing.fit (y:numpy.ndarray,
                                   X:Optional[numpy.ndarray]=None)

*Fit the SeasonalExponentialSmoothing model.

Fit an SeasonalExponentialSmoothing to a time series (numpy array) y and optionally exogenous variables (numpy array) X.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsSeasonalExponentialSmoothing fitted model.

source

SeasonalExponentialSmoothing.predict

 SeasonalExponentialSmoothing.predict (h:int,
                                       X:Optional[numpy.ndarray]=None,
                                       level:Optional[List[int]]=None)

Predict with fitted SeasonalExponentialSmoothing.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

SeasonalExponentialSmoothing.predict_in_sample

 SeasonalExponentialSmoothing.predict_in_sample ()

Access fitted SeasonalExponentialSmoothing insample predictions.


source

SeasonalExponentialSmoothing.forecast

 SeasonalExponentialSmoothing.forecast (y:numpy.ndarray, h:int,
                                        X:Optional[numpy.ndarray]=None, X_
                                        future:Optional[numpy.ndarray]=Non
                                        e, level:Optional[List[int]]=None,
                                        fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import SeasonalExponentialSmoothing
from statsforecast.utils import AirPassengers as ap
# SeasonalExponentialSmoothing's usage example
model = SeasonalExponentialSmoothing(alpha=0.5, season_length=12)
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

SeasonalSmoothOptimized


source

SeasonalExponentialSmoothingOptimized

 SeasonalExponentialSmoothingOptimized (season_length:int,
                                        alias:str='SeasESOpt', prediction_
                                        intervals:Optional[statsforecast.u
                                        tils.ConformalIntervals]=None)

*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: y^t+1,s=αyt+(1α)y^t1,s\hat{y}_{t+1,s} = \alpha y_t + (1-\alpha) \hat{y}_{t-1,s}

The smoothing parameter α\alpha^* is optimized by square error minimization.*

TypeDefaultDetails
season_lengthintNumber of observations per unit of time. Ex: 24 Hourly data.
aliasstrSeasESOptCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
This is required for generating future prediction intervals.

source

SeasonalExponentialSmoothingOptimized.forecast

 SeasonalExponentialSmoothingOptimized.forecast (y:numpy.ndarray, h:int,
                                                 X:Optional[numpy.ndarray]
                                                 =None, X_future:Optional[
                                                 numpy.ndarray]=None, leve
                                                 l:Optional[List[int]]=Non
                                                 e, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

SeasonalExponentialSmoothingOptimized.fit

 SeasonalExponentialSmoothingOptimized.fit (y:numpy.ndarray,
                                            X:Optional[numpy.ndarray]=None
                                            )

*Fit the SeasonalExponentialSmoothingOptimized model.

Fit an SeasonalExponentialSmoothingOptimized to a time series (numpy array) y and optionally exogenous variables (numpy array) X.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsSeasonalExponentialSmoothingOptimized fitted model.

source

SeasonalExponentialSmoothingOptimized.predict

 SeasonalExponentialSmoothingOptimized.predict (h:int,
                                                X:Optional[numpy.ndarray]=
                                                None, level:Optional[List[
                                                int]]=None)

Predict with fitted SeasonalExponentialSmoothingOptimized.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

SeasonalExponentialSmoothingOptimized.predict_in_sample

 SeasonalExponentialSmoothingOptimized.predict_in_sample ()

Access fitted SeasonalExponentialSmoothingOptimized insample predictions.

from statsforecast.models import SeasonalExponentialSmoothingOptimized
from statsforecast.utils import AirPassengers as ap
# SeasonalExponentialSmoothingOptimized's usage example
model = SeasonalExponentialSmoothingOptimized(season_length=12)
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

Holt’s method


source

Holt

 Holt (season_length:int=1, error_type:str='A', alias:str='Holt', predicti
       on_intervals:Optional[statsforecast.utils.ConformalIntervals]=None)

*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’).*

TypeDefaultDetails
season_lengthint1Number of observations per unit of time. Ex: 12 Monthly data.
error_typestrAThe type of error of the ETS model. Can be additive (A) or multiplicative (M).
aliasstrHoltCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

Holt.forecast

 Holt.forecast (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                X_future:Optional[numpy.ndarray]=None,
                level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenpus of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

Holt.fit

 Holt.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=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.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsExponential Smoothing fitted model.

source

Holt.predict

 Holt.predict (h:int, X:Optional[numpy.ndarray]=None,
               level:Optional[List[int]]=None)

Predict with fitted Exponential Smoothing.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenpus of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

Holt.predict_in_sample

 Holt.predict_in_sample (level:Optional[List[int]]=None)

Access fitted Exponential Smoothing insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

Holt.forward

 Holt.forward (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
               X_future:Optional[numpy.ndarray]=None,
               level:Optional[List[int]]=None, fitted:bool=False)

Apply fitted Exponential Smoothing model to a new time series.

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenpus of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import Holt
from statsforecast.utils import AirPassengers as ap
# Holt's usage example
model = Holt(season_length=12, error_type='A')
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

Holt-Winters’ method


source

HoltWinters

 HoltWinters (season_length:int=1, error_type:str='A',
              alias:str='HoltWinters', prediction_intervals:Optional[stats
              forecast.utils.ConformalIntervals]=None)

*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’).*

TypeDefaultDetails
season_lengthint1season length
error_typestrAerror type
aliasstrHoltWintersCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

HoltWinters.forecast

 HoltWinters.forecast (y:numpy.ndarray, h:int,
                       X:Optional[numpy.ndarray]=None,
                       X_future:Optional[numpy.ndarray]=None,
                       level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenpus of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

HoltWinters.fit

 HoltWinters.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=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.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsExponential Smoothing fitted model.

source

HoltWinters.predict

 HoltWinters.predict (h:int, X:Optional[numpy.ndarray]=None,
                      level:Optional[List[int]]=None)

Predict with fitted Exponential Smoothing.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenpus of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

HoltWinters.predict_in_sample

 HoltWinters.predict_in_sample (level:Optional[List[int]]=None)

Access fitted Exponential Smoothing insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

HoltWinters.forward

 HoltWinters.forward (y:numpy.ndarray, h:int,
                      X:Optional[numpy.ndarray]=None,
                      X_future:Optional[numpy.ndarray]=None,
                      level:Optional[List[int]]=None, fitted:bool=False)

Apply fitted Exponential Smoothing model to a new time series.

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenpus of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import HoltWinters
from statsforecast.utils import AirPassengers as ap
# Holt-Winters' usage example
model = HoltWinters(season_length=12, error_type='A')
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

Baseline Models

HistoricAverage


source

HistoricAverage

 HistoricAverage (alias:str='HistoricAverage', prediction_intervals:Option
                  al[statsforecast.utils.ConformalIntervals]=None)

*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*

TypeDefaultDetails
aliasstrHistoricAverage
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

HistoricAverage.forecast

 HistoricAverage.forecast (y:numpy.ndarray, h:int,
                           X:Optional[numpy.ndarray]=None,
                           X_future:Optional[numpy.ndarray]=None,
                           level:Optional[List[int]]=None,
                           fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

HistoricAverage.fit

 HistoricAverage.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the HistoricAverage model.

Fit an HistoricAverage to a time series (numpy array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsselfHistoricAverage fitted model.

source

HistoricAverage.predict

 HistoricAverage.predict (h:int, X:Optional[numpy.ndarray]=None,
                          level:Optional[List[int]]=None)

Predict with fitted HistoricAverage.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

HistoricAverage.predict_in_sample

 HistoricAverage.predict_in_sample (level:Optional[List[int]]=None)

Access fitted HistoricAverage insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions.
from statsforecast.models import HistoricAverage
from statsforecast.utils import AirPassengers as ap
# HistoricAverage's usage example
model = HistoricAverage()
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

Naive


source

Naive

 Naive (alias:str='Naive', prediction_intervals:Optional[statsforecast.uti
        ls.ConformalIntervals]=None)

*Naive model.

All forecasts have the value of the last observation:
y^t+1=yt\hat{y}_{t+1} = y_t for all tt*

TypeDefaultDetails
aliasstrNaive
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

Naive.forecast

 Naive.forecast (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                 X_future:Optional[numpy.ndarray]=None,
                 level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n,).
hint
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

Naive.fit

 Naive.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the Naive model.

Fit an Naive to a time series (numpy.array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
Returnsself:Naive fitted model.

source

Naive.predict

 Naive.predict (h:int, X:Optional[numpy.ndarray]=None,
                level:Optional[List[int]]=None)

Predict with fitted Naive.

TypeDefaultDetails
hintforecasting horizon
XOptionalNoneexogenous regressors
levelOptionalNoneconfidence level
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

Naive.predict_in_sample

 Naive.predict_in_sample (level:Optional[List[int]]=None)

Access fitted Naive insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions.
from statsforecast.models import Naive
from statsforecast.utils import AirPassengers as ap
# Naive's usage example
model = Naive()
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

RandomWalkWithDrift


source

RandomWalkWithDrift

 RandomWalkWithDrift (alias:str='RWD', prediction_intervals:Optional[stats
                      forecast.utils.ConformalIntervals]=None)

*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.*

TypeDefaultDetails
aliasstrRWDCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

RandomWalkWithDrift.forecast

 RandomWalkWithDrift.forecast (y:numpy.ndarray, h:int,
                               X:Optional[numpy.ndarray]=None,
                               X_future:Optional[numpy.ndarray]=None,
                               level:Optional[List[int]]=None,
                               fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n,).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
Returnsforecasts: dictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

RandomWalkWithDrift.fit

 RandomWalkWithDrift.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the RandomWalkWithDrift model.

Fit an RandomWalkWithDrift to a time series (numpy array) y.*

TypeDefaultDetails
yndarray
XOptionalNone
ReturnsRandomWalkWithDrift fitted model.

source

RandomWalkWithDrift.predict

 RandomWalkWithDrift.predict (h:int, X:Optional[numpy.ndarray]=None,
                              level:Optional[List[int]]=None)

Predict with fitted RandomWalkWithDrift.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

RandomWalkWithDrift.predict_in_sample

 RandomWalkWithDrift.predict_in_sample (level:Optional[List[int]]=None)

Access fitted RandomWalkWithDrift insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
from statsforecast.models import RandomWalkWithDrift
from statsforecast.utils import AirPassengers as ap
# RandomWalkWithDrift's usage example
model = RandomWalkWithDrift()
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

SeasonalNaive


source

SeasonalNaive

 SeasonalNaive (season_length:int, alias:str='SeasonalNaive', prediction_i
                ntervals:Optional[statsforecast.utils.ConformalIntervals]=
                None)

*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.*

TypeDefaultDetails
season_lengthintNumber of observations per unit of time. Ex: 24 Hourly data.
aliasstrSeasonalNaiveCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

SeasonalNaive.forecast

 SeasonalNaive.forecast (y:numpy.ndarray, h:int,
                         X:Optional[numpy.ndarray]=None,
                         X_future:Optional[numpy.ndarray]=None,
                         level:Optional[List[int]]=None,
                         fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

SeasonalNaive.fit

 SeasonalNaive.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the SeasonalNaive model.

Fit an SeasonalNaive to a time series (numpy array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNone
ReturnsSeasonalNaive fitted model.

source

SeasonalNaive.predict

 SeasonalNaive.predict (h:int, X:Optional[numpy.ndarray]=None,
                        level:Optional[List[int]]=None)

Predict with fitted Naive.

TypeDefaultDetails
hintForecast horizon.
XOptionalNone
levelOptionalNone
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

SeasonalNaive.predict_in_sample

 SeasonalNaive.predict_in_sample (level:Optional[List[int]]=None)

Access fitted SeasonalNaive insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
from statsforecast.models import SeasonalNaive
from statsforecast.utils import AirPassengers as ap
# SeasonalNaive's usage example
model = SeasonalNaive(season_length=12)
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

WindowAverage


source

WindowAverage

 WindowAverage (window_size:int, alias:str='WindowAverage', prediction_int
                ervals:Optional[statsforecast.utils.ConformalIntervals]=No
                ne)

*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.*

TypeDefaultDetails
window_sizeintSize of truncated series on which average is estimated.
aliasstrWindowAverageCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
This is required for generating future prediction intervals.

source

WindowAverage.forecast

 WindowAverage.forecast (y:numpy.ndarray, h:int,
                         X:Optional[numpy.ndarray]=None,
                         X_future:Optional[numpy.ndarray]=None,
                         level:Optional[List[int]]=None,
                         fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

WindowAverage.fit

 WindowAverage.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the WindowAverage model.

Fit an WindowAverage to a time series (numpy array) y and optionally exogenous variables (numpy array) X.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsWindowAverage fitted model.

source

WindowAverage.predict

 WindowAverage.predict (h:int, X:Optional[numpy.ndarray]=None,
                        level:Optional[List[int]]=None)

Predict with fitted WindowAverage.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import WindowAverage
from statsforecast.utils import AirPassengers as ap
# WindowAverage's usage example
model = WindowAverage(window_size=12*4)
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

SeasonalWindowAverage


source

SeasonalWindowAverage

 SeasonalWindowAverage (season_length:int, window_size:int,
                        alias:str='SeasWA', prediction_intervals:Optional[
                        statsforecast.utils.ConformalIntervals]=None)

*SeasonalWindowAverage model.

An average of the last kk observations of the same period, with kk the length of the window.*

TypeDefaultDetails
season_lengthint
window_sizeintSize of truncated series on which average is estimated.
aliasstrSeasWACustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
This is required for generating future prediction intervals.

source

SeasonalWindowAverage.forecast

 SeasonalWindowAverage.forecast (y:numpy.ndarray, h:int,
                                 X:Optional[numpy.ndarray]=None,
                                 X_future:Optional[numpy.ndarray]=None,
                                 level:Optional[List[int]]=None,
                                 fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n,).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

SeasonalWindowAverage.fit

 SeasonalWindowAverage.fit (y:numpy.ndarray,
                            X:Optional[numpy.ndarray]=None)

*Fit the SeasonalWindowAverage model.

Fit an SeasonalWindowAverage to a time series (numpy array) y and optionally exogenous variables (numpy array) X.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenpus of shape (t, n_x).
ReturnsSeasonalWindowAverage fitted model.

source

SeasonalWindowAverage.predict

 SeasonalWindowAverage.predict (h:int, X:Optional[numpy.ndarray]=None,
                                level:Optional[List[int]]=None)

Predict with fitted SeasonalWindowAverage.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import SeasonalWindowAverage
from statsforecast.utils import AirPassengers as ap
# SeasonalWindowAverage's usage example
model = SeasonalWindowAverage(season_length=12, window_size=4)
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

Sparse or Intermittent

ADIDA


source

ADIDA

 ADIDA (alias:str='ADIDA', prediction_intervals:Optional[statsforecast.uti
        ls.ConformalIntervals]=None)

*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.*

TypeDefaultDetails
aliasstrADIDACustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

ADIDA.forecast

 ADIDA.forecast (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                 X_future:Optional[numpy.ndarray]=None,
                 level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n,).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

ADIDA.fit

 ADIDA.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the ADIDA model.

Fit an ADIDA to a time series (numpy array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNone
ReturnsADIDA fitted model.

source

ADIDA.predict

 ADIDA.predict (h:int, X:Optional[numpy.ndarray]=None,
                level:Optional[List[int]]=None)

Predict with fitted ADIDA.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import ADIDA
from statsforecast.utils import AirPassengers as ap
# ADIDA's usage example
model = ADIDA()
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

CrostonClassic


source

CrostonClassic

 CrostonClassic (alias:str='CrostonClassic', prediction_intervals:Optional
                 [statsforecast.utils.ConformalIntervals]=None)

*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 z^t\hat{z}_t and p^t\hat{p}_t are forecasted using SES. The smoothing parameter of both components is set equal to 0.1*

TypeDefaultDetails
aliasstrCrostonClassicCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

CrostonClassic.forecast

 CrostonClassic.forecast (y:numpy.ndarray, h:int,
                          X:Optional[numpy.ndarray]=None,
                          X_future:Optional[numpy.ndarray]=None,
                          level:Optional[List[int]]=None,
                          fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

CrostonClassic.fit

 CrostonClassic.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the CrostonClassic model.

Fit an CrostonClassic to a time series (numpy array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNone
ReturnsCrostonClassic fitted model.

source

CrostonClassic.predict

 CrostonClassic.predict (h:int, X:Optional[numpy.ndarray]=None,
                         level:Optional[List[int]]=None)

Predict with fitted CrostonClassic.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import CrostonClassic
from statsforecast.utils import AirPassengers as ap
# CrostonClassic's usage example
model = CrostonClassic()
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

CrostonOptimized


source

CrostonOptimized

 CrostonOptimized (alias:str='CrostonOptimized', prediction_intervals:Opti
                   onal[statsforecast.utils.ConformalIntervals]=None)

*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.*

TypeDefaultDetails
aliasstrCrostonOptimizedCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
This is required for generating future prediction intervals.

source

CrostonOptimized.forecast

 CrostonOptimized.forecast (y:numpy.ndarray, h:int,
                            X:Optional[numpy.ndarray]=None,
                            X_future:Optional[numpy.ndarray]=None,
                            level:Optional[List[int]]=None,
                            fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNone
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

CrostonOptimized.fit

 CrostonOptimized.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the CrostonOptimized model.

Fit an CrostonOptimized to a time series (numpy array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNone
ReturnsCrostonOptimized fitted model.

source

CrostonOptimized.predict

 CrostonOptimized.predict (h:int, X:Optional[numpy.ndarray]=None,
                           level:Optional[List[int]]=None)

Predict with fitted CrostonOptimized.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import CrostonOptimized
from statsforecast.utils import AirPassengers as ap
# CrostonOptimized's usage example
model = CrostonOptimized()
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

CrostonSBA


source

CrostonSBA

 CrostonSBA (alias:str='CrostonSBA', prediction_intervals:Optional[statsfo
             recast.utils.ConformalIntervals]=None)

*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}*

TypeDefaultDetails
aliasstrCrostonSBACustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

CrostonSBA.forecast

 CrostonSBA.forecast (y:numpy.ndarray, h:int,
                      X:Optional[numpy.ndarray]=None,
                      X_future:Optional[numpy.ndarray]=None,
                      level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

CrostonSBA.fit

 CrostonSBA.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the CrostonSBA model.

Fit an CrostonSBA to a time series (numpy array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNone
ReturnsCrostonSBA fitted model.

source

CrostonSBA.predict

 CrostonSBA.predict (h:int, X:Optional[numpy.ndarray]=None,
                     level:Optional[List[int]]=None)

Predict with fitted CrostonSBA.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import CrostonSBA
from statsforecast.utils import AirPassengers as ap
# CrostonSBA's usage example
model = CrostonSBA()
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

IMAPA


source

IMAPA

 IMAPA (alias:str='IMAPA', prediction_intervals:Optional[statsforecast.uti
        ls.ConformalIntervals]=None)

*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.*

TypeDefaultDetails
aliasstrIMAPACustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

IMAPA.forecast

 IMAPA.forecast (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                 X_future:Optional[numpy.ndarray]=None,
                 level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

IMAPA.fit

 IMAPA.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the IMAPA model.

Fit an IMAPA to a time series (numpy array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNone
ReturnsIMAPA fitted model.

source

IMAPA.predict

 IMAPA.predict (h:int, X:Optional[numpy.ndarray]=None,
                level:Optional[List[int]]=None)

Predict with fitted IMAPA.

TypeDefaultDetails
hintForecast horizon.
XOptionalNone
levelOptionalNone
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import IMAPA
from statsforecast.utils import AirPassengers as ap
# IMAPA's usage example
model = IMAPA()
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

TSB


source

TSB

 TSB (alpha_d:float, alpha_p:float, alias:str='TSB', prediction_intervals:
      Optional[statsforecast.utils.ConformalIntervals]=None)

*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.*

TypeDefaultDetails
alpha_dfloatSmoothing parameter for demand.
alpha_pfloatSmoothing parameter for probability.
aliasstrTSBCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
This is required for generating future prediction intervals.

source

TSB.forecast

 TSB.forecast (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
               X_future:Optional[numpy.ndarray]=None,
               level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNone
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

TSB.fit

 TSB.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the TSB model.

Fit an TSB to a time series (numpy array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNone
ReturnsTSB fitted model.

source

TSB.predict

 TSB.predict (h:int, X:Optional[numpy.ndarray]=None,
              level:Optional[List[int]]=None)

Predict with fitted TSB.

TypeDefaultDetails
hintForecast horizon.
XOptionalNone
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import TSB
from statsforecast.utils import AirPassengers as ap
# TSB's usage example
model = TSB(alpha_d=0.5, alpha_p=0.5)
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

Multiple Seasonalities

MSTL


source

MSTL

 MSTL (season_length:Union[int,List[int]], trend_forecaster=AutoETS,
       stl_kwargs:Optional[Dict]=None, alias:str='MSTL', prediction_interv
       als:Optional[statsforecast.utils.ConformalIntervals]=None)

*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.*

TypeDefaultDetails
season_lengthUnionNumber of observations per unit of time. For multiple seasonalities use a list.
trend_forecasterAutoETSAutoETSStatsForecast model used to forecast the trend component.
stl_kwargsOptionalNoneExtra arguments to pass to statsmodels.tsa.seasonal.STL.
The period and seasonal arguments are reserved.
aliasstrMSTLCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

MSTL.fit

 MSTL.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the MSTL model.

Fit MSTL to a time series (numpy array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNone
ReturnsMSTL fitted model.

source

MSTL.predict

 MSTL.predict (h:int, X:Optional[numpy.ndarray]=None,
               level:Optional[List[int]]=None)

Predict with fitted MSTL.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

MSTL.predict_in_sample

 MSTL.predict_in_sample (level:Optional[List[int]]=None)

Access fitted MSTL insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

MSTL.forecast

 MSTL.forecast (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                X_future:Optional[numpy.ndarray]=None,
                level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

MSTL.forward

 MSTL.forward (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
               X_future:Optional[numpy.ndarray]=None,
               level:Optional[List[int]]=None, fitted:bool=False)

Apply fitted MSTL model to a new time series.

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import MSTL
from statsforecast.utils import AirPassengers as ap
# MSTL's usage example
mstl_model = MSTL(season_length=[3, 12], trend_forecaster=AutoARIMA(prediction_intervals=ConformalIntervals(h=4, n_windows=2)))
mstl_model = mstl_model.fit(y=ap)
y_hat_dict = mstl_model.predict(h=4, level=[80])
y_hat_dict

MFLES


source

MFLES

 MFLES (season_length:Union[int,List[int],NoneType]=None,
        fourier_order:Optional[int]=None, max_rounds:int=50,
        ma:Optional[int]=None, alpha:float=1.0, decay:float=-1.0,
        changepoints:bool=True, n_changepoints:Union[float,int]=0.25,
        seasonal_lr:float=0.9, trend_lr:float=0.9, exogenous_lr:float=1.0,
        residuals_lr:float=1.0, cov_threshold:float=0.7,
        moving_medians:bool=False, min_alpha:float=0.05,
        max_alpha:float=1.0, trend_penalty:bool=True,
        multiplicative:Optional[bool]=None, smoother:bool=False,
        robust:Optional[bool]=None, verbose:bool=False, prediction_interva
        ls:Optional[statsforecast.utils.ConformalIntervals]=None,
        alias:str='MFLES')

*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.*

TypeDefaultDetails
season_lengthUnionNoneNumber of observations per unit of time. Ex: 24 Hourly data.
fourier_orderOptionalNoneHow 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.
max_roundsint50The 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.
maOptionalNoneThe 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.
alphafloat1.0The alpha which is used in fitting the underlying LASSO when using piecewise functions.
decayfloat-1.0Effects the slopes of the piecewise-linear basis function.
changepointsboolTrueWhether to fit for changepoints if all other logic allows for it. If False, MFLES will not ever fit a piecewise trend.
n_changepointsUnion0.25Number (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.
seasonal_lrfloat0.9A 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.
trend_lrfloat0.9A 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.
exogenous_lrfloat1.0The shrinkage parameter (0 < exogenous_lr <= 1) which controls how much of the exogenous signal is carried to the next round.
residuals_lrfloat1.0A 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.
cov_thresholdfloat0.7The 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.
moving_mediansboolFalseThe default behavior is to fit an initial median to the time series. If True, then it will fit a median per seasonal period.
min_alphafloat0.05The minimum alpha in the SES ensemble.
max_alphafloat1.0The maximum alpha used in the SES ensemble.
trend_penaltyboolTrueWhether to apply a simple penalty to the linear trend component, very useful for dealing with the potentially dangerous piecewise trend.
multiplicativeOptionalNoneAuto-set based on internal logic. If True, it will simply take the log of the time series.
smootherboolFalseIf True, then a simple exponential ensemble will be used rather than auto settings.
robustOptionalNoneIf 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.
verboseboolFalsePrint debugging information.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
This is required for generating future prediction intervals.
aliasstrMFLESCustom name of the model.

source

MFLES.fit

 MFLES.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

Fit the model

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneExogenous of shape (t, n_x).
ReturnsMFLESFitted MFLES object.

source

MFLES.predict

 MFLES.predict (h:int, X:Optional[numpy.ndarray]=None,
                level:Optional[List[int]]=None)

Predict with fitted MFLES.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneExogenous of shape (h, n_x).
levelOptionalNone
ReturnsDictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

MFLES.predict_in_sample

 MFLES.predict_in_sample (level:Optional[List[int]]=None)

Access fitted SklearnModel insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsDictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

MFLES.forecast

 MFLES.forecast (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                 X_future:Optional[numpy.ndarray]=None,
                 level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
hintForecast horizon.
XOptionalNoneInsample exogenous of shape (t, n_x).
X_futureOptionalNoneExogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsDictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

TBATS


source

TBATS

 TBATS (season_length:Union[int,List[int]],
        use_boxcox:Optional[bool]=True, bc_lower_bound:float=0.0,
        bc_upper_bound:float=1.0, use_trend:Optional[bool]=True,
        use_damped_trend:Optional[bool]=False, use_arma_errors:bool=False,
        alias:str='TBATS')

*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.*

TypeDefaultDetails
season_lengthUnionNumber of observations per unit of time. Ex: 24 Hourly data.
use_boxcoxOptionalTrueWhether or not to use a Box-Cox transformation.
bc_lower_boundfloat0.0Lower bound for the Box-Cox transformation.
bc_upper_boundfloat1.0Upper bound for the Box-Cox transformation.
use_trendOptionalTrueWhether or not to use a trend component.
use_damped_trendOptionalFalseWhether or not to dampen the trend component.
use_arma_errorsboolFalseWhether or not to use a ARMA errors.
aliasstrTBATSCustom name of the model.

source

TBATS.fit

 TBATS.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit TBATS model.

Fit TBATS model to a time series (numpy array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneIgnored
ReturnsTBATS model.

source

TBATS.predict

 TBATS.predict (h:int, X:Optional[numpy.ndarray]=None,
                level:Optional[List[int]]=None)

Predict with fitted TBATS model.

TypeDefaultDetails
hintForecast horizon.
XOptionalNone
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

TBATS.predict_in_sample

 TBATS.predict_in_sample (level:Optional[Tuple[int]]=None)

Access fitted TBATS model predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

TBATS.forecast

 TBATS.forecast (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                 X_future:Optional[numpy.ndarray]=None,
                 level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNone
X_futureOptionalNone
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

Theta Family

Standard Theta Method


source

Theta

 Theta (season_length:int=1, decomposition_type:str='multiplicative',
        alias:str='Theta', prediction_intervals:Optional[statsforecast.uti
        ls.ConformalIntervals]=None)

Standard Theta Method.

TypeDefaultDetails
season_lengthint1Number of observations per unit of time. Ex: 24 Hourly data.
decomposition_typestrmultiplicativeSesonal decomposition type, ‘multiplicative’ (default) or ‘additive’.
aliasstrThetaCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

Theta.forecast

 Theta.forecast (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                 X_future:Optional[numpy.ndarray]=None,
                 level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

Theta.fit

 Theta.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the AutoTheta model.

Fit an AutoTheta model to a time series (numpy array) y and optionally exogenous variables (numpy array) X.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsAutoTheta fitted model.

source

Theta.predict

 Theta.predict (h:int, X:Optional[numpy.ndarray]=None,
                level:Optional[List[int]]=None)

Predict with fitted AutoTheta.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

Theta.predict_in_sample

 Theta.predict_in_sample (level:Optional[List[int]]=None)

Access fitted AutoTheta insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

Theta.forward

 Theta.forward (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                X_future:Optional[numpy.ndarray]=None,
                level:Optional[List[int]]=None, fitted:bool=False)

Apply fitted AutoTheta to a new time series.

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import Theta
from statsforecast.utils import AirPassengers as ap
# Theta's usage example
model = Theta(season_length=12)
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

Optimized Theta Method


source

OptimizedTheta

 OptimizedTheta (season_length:int=1,
                 decomposition_type:str='multiplicative',
                 alias:str='OptimizedTheta', prediction_intervals:Optional
                 [statsforecast.utils.ConformalIntervals]=None)

Optimized Theta Method.

TypeDefaultDetails
season_lengthint1Number of observations per unit of time. Ex: 24 Hourly data.
decomposition_typestrmultiplicativeSesonal decomposition type, ‘multiplicative’ (default) or ‘additive’.
aliasstrOptimizedThetaCustom name of the model. Default OptimizedTheta.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

OptimizedTheta.forecast

 OptimizedTheta.forecast (y:numpy.ndarray, h:int,
                          X:Optional[numpy.ndarray]=None,
                          X_future:Optional[numpy.ndarray]=None,
                          level:Optional[List[int]]=None,
                          fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

OptimizedTheta.fit

 OptimizedTheta.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the AutoTheta model.

Fit an AutoTheta model to a time series (numpy array) y and optionally exogenous variables (numpy array) X.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsAutoTheta fitted model.

source

OptimizedTheta.predict

 OptimizedTheta.predict (h:int, X:Optional[numpy.ndarray]=None,
                         level:Optional[List[int]]=None)

Predict with fitted AutoTheta.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

OptimizedTheta.predict_in_sample

 OptimizedTheta.predict_in_sample (level:Optional[List[int]]=None)

Access fitted AutoTheta insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

OptimizedTheta.forward

 OptimizedTheta.forward (y:numpy.ndarray, h:int,
                         X:Optional[numpy.ndarray]=None,
                         X_future:Optional[numpy.ndarray]=None,
                         level:Optional[List[int]]=None,
                         fitted:bool=False)

Apply fitted AutoTheta to a new time series.

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import OptimizedTheta
from statsforecast.utils import AirPassengers as ap
# OptimzedThetA's usage example
model = OptimizedTheta(season_length=12)
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

Dynamic Standard Theta Method


source

DynamicTheta

 DynamicTheta (season_length:int=1,
               decomposition_type:str='multiplicative',
               alias:str='DynamicTheta', prediction_intervals:Optional[sta
               tsforecast.utils.ConformalIntervals]=None)

Dynamic Standard Theta Method.

TypeDefaultDetails
season_lengthint1Number of observations per unit of time. Ex: 24 Hourly data.
decomposition_typestrmultiplicativeSesonal decomposition type, ‘multiplicative’ (default) or ‘additive’.
aliasstrDynamicThetaCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

DynamicTheta.forecast

 DynamicTheta.forecast (y:numpy.ndarray, h:int,
                        X:Optional[numpy.ndarray]=None,
                        X_future:Optional[numpy.ndarray]=None,
                        level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

DynamicTheta.fit

 DynamicTheta.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the AutoTheta model.

Fit an AutoTheta model to a time series (numpy array) y and optionally exogenous variables (numpy array) X.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsAutoTheta fitted model.

source

DynamicTheta.predict

 DynamicTheta.predict (h:int, X:Optional[numpy.ndarray]=None,
                       level:Optional[List[int]]=None)

Predict with fitted AutoTheta.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

DynamicTheta.predict_in_sample

 DynamicTheta.predict_in_sample (level:Optional[List[int]]=None)

Access fitted AutoTheta insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

DynamicTheta.forward

 DynamicTheta.forward (y:numpy.ndarray, h:int,
                       X:Optional[numpy.ndarray]=None,
                       X_future:Optional[numpy.ndarray]=None,
                       level:Optional[List[int]]=None, fitted:bool=False)

Apply fitted AutoTheta to a new time series.

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import DynamicTheta
from statsforecast.utils import AirPassengers as ap
# DynStandardThetaMethod's usage example
model = DynamicTheta(season_length=12)
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

Dynamic Optimized Theta Method


source

DynamicOptimizedTheta

 DynamicOptimizedTheta (season_length:int=1,
                        decomposition_type:str='multiplicative',
                        alias:str='DynamicOptimizedTheta', prediction_inte
                        rvals:Optional[statsforecast.utils.ConformalInterv
                        als]=None)

Dynamic Optimized Theta Method.

TypeDefaultDetails
season_lengthint1Number of observations per unit of time. Ex: 24 Hourly data.
decomposition_typestrmultiplicativeSesonal decomposition type, ‘multiplicative’ (default) or ‘additive’.
aliasstrDynamicOptimizedThetaCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

DynamicOptimizedTheta.forecast

 DynamicOptimizedTheta.forecast (y:numpy.ndarray, h:int,
                                 X:Optional[numpy.ndarray]=None,
                                 X_future:Optional[numpy.ndarray]=None,
                                 level:Optional[List[int]]=None,
                                 fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

DynamicOptimizedTheta.fit

 DynamicOptimizedTheta.fit (y:numpy.ndarray,
                            X:Optional[numpy.ndarray]=None)

*Fit the AutoTheta model.

Fit an AutoTheta model to a time series (numpy array) y and optionally exogenous variables (numpy array) X.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
ReturnsAutoTheta fitted model.

source

DynamicOptimizedTheta.predict

 DynamicOptimizedTheta.predict (h:int, X:Optional[numpy.ndarray]=None,
                                level:Optional[List[int]]=None)

Predict with fitted AutoTheta.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

DynamicOptimizedTheta.predict_in_sample

 DynamicOptimizedTheta.predict_in_sample (level:Optional[List[int]]=None)

Access fitted AutoTheta insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

DynamicOptimizedTheta.forward

 DynamicOptimizedTheta.forward (y:numpy.ndarray, h:int,
                                X:Optional[numpy.ndarray]=None,
                                X_future:Optional[numpy.ndarray]=None,
                                level:Optional[List[int]]=None,
                                fitted:bool=False)

Apply fitted AutoTheta to a new time series.

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.
from statsforecast.models import DynamicOptimizedTheta
from statsforecast.utils import AirPassengers as ap
# OptimzedThetaMethod's usage example
model = DynamicOptimizedTheta(season_length=12)
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

ARCH Family

Garch model


source

GARCH

 GARCH (p:int=1, q:int=1, alias:str='GARCH', prediction_intervals:Optional
        [statsforecast.utils.ConformalIntervals]=None)

*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,bj0a_i, b_j \geq 0 for all ii and jj.
  2. 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.*

TypeDefaultDetails
pint1Number of lagged versions of the series.
qint1
aliasstrGARCHCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

GARCH.fit

 GARCH.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit GARCH model.

Fit GARCH model to a time series (numpy array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNone
ReturnsGARCH model.

source

GARCH.predict

 GARCH.predict (h:int, X:Optional[numpy.ndarray]=None,
                level:Optional[List[int]]=None)

Predict with fitted GARCH model.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

GARCH.predict_in_sample

 GARCH.predict_in_sample (level:Optional[List[int]]=None)

Access fitted GARCH model predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

GARCH.forecast

 GARCH.forecast (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                 X_future:Optional[numpy.ndarray]=None,
                 level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNone
X_futureOptionalNone
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

ARCH model


source

ARCH

 ARCH (p:int=1, alias:str='ARCH', prediction_intervals:Optional[statsforec
       ast.utils.ConformalIntervals]=None)

*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 ϵt\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 k=1pak<1\sum_{k=1}^p a_k < 1.*

TypeDefaultDetails
pint1Number of lagged versions of the series.
aliasstrARCHCustom name of the model.
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
By default, the model will compute the native prediction
intervals.

source

ARCH.fit

 ARCH.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit GARCH model.

Fit GARCH model to a time series (numpy array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNone
ReturnsGARCH model.

source

ARCH.predict

 ARCH.predict (h:int, X:Optional[numpy.ndarray]=None,
               level:Optional[List[int]]=None)

Predict with fitted GARCH model.

TypeDefaultDetails
hintForecast horizon.
XOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

ARCH.predict_in_sample

 ARCH.predict_in_sample (level:Optional[List[int]]=None)

Access fitted GARCH model predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

ARCH.forecast

 ARCH.forecast (y:numpy.ndarray, h:int, X:Optional[numpy.ndarray]=None,
                X_future:Optional[numpy.ndarray]=None,
                level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNone
X_futureOptionalNone
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

Machine Learning models

SklearnModel


source

SklearnModel

 SklearnModel (model, prediction_intervals:Optional[statsforecast.utils.Co
               nformalIntervals]=None, alias:Optional[str]=None)

scikit-learn model wrapper

TypeDefaultDetails
modelsklearn.base.BaseEstimatorscikit-learn estimator
prediction_intervalsOptionalNoneInformation to compute conformal prediction intervals.
This is required for generating future prediction intervals.
aliasOptionalNoneCustom name of the model. If None will use the model’s class.

source

SklearnModel.fit

 SklearnModel.fit (y:numpy.ndarray, X:numpy.ndarray)

Fit the model.

TypeDetails
yndarrayClean time series of shape (t, ).
XndarrayExogenous of shape (t, n_x).
ReturnsSklearnModelFitted SklearnModel object.

source

SklearnModel.predict

 SklearnModel.predict (h:int, X:numpy.ndarray,
                       level:Optional[List[int]]=None)

Predict with fitted SklearnModel.

TypeDefaultDetails
hintForecast horizon.
XndarrayExogenous of shape (h, n_x).
levelOptionalNone
ReturnsDictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

SklearnModel.predict_in_sample

 SklearnModel.predict_in_sample (level:Optional[List[int]]=None)

Access fitted SklearnModel insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsDictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

SklearnModel.forecast

 SklearnModel.forecast (y:numpy.ndarray, h:int, X:numpy.ndarray,
                        X_future:numpy.ndarray,
                        level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
hintForecast horizon.
XndarrayInsample exogenous of shape (t, n_x).
X_futurendarrayExogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsDictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

Fallback Models

ConstantModel


source

ConstantModel

 ConstantModel (constant:float, alias:str='ConstantModel')

*Constant Model.

Returns Constant values.*


source

ConstantModel.forecast

 ConstantModel.forecast (y:numpy.ndarray, h:int,
                         X:Optional[numpy.ndarray]=None,
                         X_future:Optional[numpy.ndarray]=None,
                         level:Optional[List[int]]=None,
                         fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n,).
hint
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

ConstantModel.fit

 ConstantModel.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the Constant model.

Fit an Constant Model to a time series (numpy.array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
Returnsself:Constant fitted model.

source

ConstantModel.predict

 ConstantModel.predict (h:int, X:Optional[numpy.ndarray]=None,
                        level:Optional[List[int]]=None)

Predict with fitted ConstantModel.

TypeDefaultDetails
hintforecasting horizon
XOptionalNoneexogenous regressors
levelOptionalNoneconfidence level
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

ConstantModel.predict_in_sample

 ConstantModel.predict_in_sample (level:Optional[List[int]]=None)

Access fitted Constant Model insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

ConstantModel.forward

 ConstantModel.forward (y:numpy.ndarray, h:int,
                        X:Optional[numpy.ndarray]=None,
                        X_future:Optional[numpy.ndarray]=None,
                        level:Optional[List[int]]=None, fitted:bool=False)

Apply Constant model predictions to a new/updated time series.

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries constant for point predictions and level_* for probabilistic predictions.
from statsforecast.models import ConstantModel
from statsforecast.utils import AirPassengers as ap
# ConstantModel's usage example
model = ConstantModel(1)
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

ZeroModel


source

ZeroModel

 ZeroModel (alias:str='ZeroModel')

*Returns Zero forecasts.

Returns Zero values.*


source

ZeroModel.forecast

 ZeroModel.forecast (y:numpy.ndarray, h:int,
                     X:Optional[numpy.ndarray]=None,
                     X_future:Optional[numpy.ndarray]=None,
                     level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n,).
hint
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

ZeroModel.fit

 ZeroModel.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the Constant model.

Fit an Constant Model to a time series (numpy.array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
Returnsself:Constant fitted model.

source

ZeroModel.predict

 ZeroModel.predict (h:int, X:Optional[numpy.ndarray]=None,
                    level:Optional[List[int]]=None)

Predict with fitted ConstantModel.

TypeDefaultDetails
hintforecasting horizon
XOptionalNoneexogenous regressors
levelOptionalNoneconfidence level
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

ZeroModel.predict_in_sample

 ZeroModel.predict_in_sample (level:Optional[List[int]]=None)

Access fitted Constant Model insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.

source

ZeroModel.forward

 ZeroModel.forward (y:numpy.ndarray, h:int,
                    X:Optional[numpy.ndarray]=None,
                    X_future:Optional[numpy.ndarray]=None,
                    level:Optional[List[int]]=None, fitted:bool=False)

Apply Constant model predictions to a new/updated time series.

TypeDefaultDetails
yndarrayClean time series of shape (n, ).
hintForecast horizon.
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels for prediction intervals.
fittedboolFalseWhether or not returns insample predictions.
ReturnsdictDictionary with entries constant for point predictions and level_* for probabilistic predictions.
from statsforecast.models import ZeroModel
from statsforecast.utils import AirPassengers as ap
# NanModel's usage example
model = ZeroModel()
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

NaNModel


source

NaNModel

 NaNModel (alias:str='NaNModel')

*NaN Model.

Returns NaN values.*


source

NaNModel.forecast

 NaNModel.forecast (y:numpy.ndarray, h:int,
                    X:Optional[numpy.ndarray]=None,
                    X_future:Optional[numpy.ndarray]=None,
                    level:Optional[List[int]]=None, fitted:bool=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.*

TypeDefaultDetails
yndarrayClean time series of shape (n,).
hint
XOptionalNoneOptional insample exogenous of shape (t, n_x).
X_futureOptionalNoneOptional exogenous of shape (h, n_x).
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
fittedboolFalseWhether or not to return insample predictions.
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

NaNModel.fit

 NaNModel.fit (y:numpy.ndarray, X:Optional[numpy.ndarray]=None)

*Fit the Constant model.

Fit an Constant Model to a time series (numpy.array) y.*

TypeDefaultDetails
yndarrayClean time series of shape (t, ).
XOptionalNoneOptional exogenous of shape (t, n_x).
Returnsself:Constant fitted model.

source

NaNModel.predict

 NaNModel.predict (h:int, X:Optional[numpy.ndarray]=None,
                   level:Optional[List[int]]=None)

Predict with fitted ConstantModel.

TypeDefaultDetails
hintforecasting horizon
XOptionalNoneexogenous regressors
levelOptionalNoneconfidence level
ReturnsdictDictionary with entries mean for point predictions and level_* for probabilistic predictions.

source

NaNModel.predict_in_sample

 NaNModel.predict_in_sample (level:Optional[List[int]]=None)

Access fitted Constant Model insample predictions.

TypeDefaultDetails
levelOptionalNoneConfidence levels (0-100) for prediction intervals.
ReturnsdictDictionary with entries fitted for point predictions and level_* for probabilistic predictions.
from statsforecast.models import NaNModel
from statsforecast.utils import AirPassengers as ap
# NanModel's usage example
model = NaNModel()
model = model.fit(y=ap)
y_hat_dict = model.predict(h=4)
y_hat_dict

References

General

Automatic Forecasting

Exponential Smoothing

Simple Methods

Sparse Intermittent

Multiple Seasonalities

Theta Family

GARCH Model

TBATS Model