smooth.ES
- class smooth.ES(model='ZXZ', lags=None, persistence=None, phi=None, initial='backcasting', initial_season=None, ic='AICc', loss='likelihood', h=None, holdout=False, bounds='usual', verbose=0, regressors='use', initial_X=None, **kwargs)
Exponential Smoothing in Single Source of Error (SSOE) state space model.
This class is a wrapper around ADAM that provides a simplified interface for pure ETS (Error, Trend, Seasonal) models without ARIMA components. It uses normal distribution for errors and conventional ETS formulation.
The model is specified in state-space form as:
\[ \begin{align}\begin{aligned}y_t &= o_t(w(v_{t-l}) + h(x_t, a_{t-1}) + r(v_{t-l})\epsilon_t)\\v_t &= f(v_{t-l}) + g(v_{t-l})\epsilon_t\end{aligned}\end{align} \]where:
\(y_t\): Observed value at time t
\(o_t\): Occurrence indicator (Bernoulli variable for intermittent data)
\(v_t\): State vector (level, trend, seasonal components)
\(l\): Vector of lags
\(w(\cdot)\): Measurement function
\(r(\cdot)\): Error function (additive or multiplicative)
\(f(\cdot)\): Transition function
\(g(\cdot)\): Persistence function
\(\epsilon_t\): Error term (normal distribution)
- Parameters:
model (Union[str, List[str]], default="ZXZ") –
The type of ETS model. The first letter stands for the type of error (“A” or “M”), the second for trend (“N”, “A”, “Ad”, “M” or “Md”), and the third for seasonality (“N”, “A” or “M”).
Examples: “ANN”, “AAN”, “AAdN”, “AAA”, “AAdA”, “MAdM”
Special codes: - “ZZZ”: Automatic selection using information criteria - “XXX”: Select only additive components - “YYY”: Select only multiplicative components - “ZXZ”: Auto-select error and seasonal, additive trend only (default) - “CCC”: Combination of all models using AIC weights
Can also be a list of model names for custom model pool.
lags (Optional[Union[int, List[int]]], default=None) – Seasonal period(s). Can be a single integer or a list of integers. E.g.,
lags=12is equivalent tolags=[12]. For monthly data with annual seasonality:lags=12orlags=[1, 12]. If None, defaults to [1] (no seasonality).persistence (Optional[Dict[str, float]], default=None) – Fixed persistence (smoothing) parameters. If None, estimated. Keys: “alpha” (level), “beta” (trend), “gamma” (seasonal).
phi (Optional[float], default=None) – Damping parameter for damped trend models. If None, estimated when applicable.
initial (Union[str, Dict[str, Any]], default="backcasting") – Method for initializing states or dictionary of fixed initial values. String options: “backcasting”, “optimal”, “complete”, “two-stage”
initial_season (Optional[NDArray], default=None) – Initial values for seasonal components. If None, estimated. Length should be (seasonal_period - 1) for each seasonal component.
ic (Literal["AIC", "AICc", "BIC", "BICc"], default="AICc") – Information criterion for model selection.
loss (LOSS_OPTIONS, default="likelihood") – Loss function for parameter estimation.
h (Optional[int], default=None) – Forecast horizon. Can also be set in predict().
holdout (bool, default=False) – Whether to use holdout sample for validation.
bounds (Literal["usual", "admissible", "none"], default="usual") – Parameter bounds type: - “usual”: Standard smoothing parameter constraints - “admissible”: Stability constraints - “none”: No constraints
verbose (int, default=0) – Verbosity level. 0 = silent.
regressors (Literal["use", "select"], default="use") – How to handle external regressors.
initial_X (Optional[NDArray], default=None) – Initial values for regressor coefficients.
**kwargs – Additional arguments passed to ADAM.
See also
ADAMParent class with full attribute documentation including
persistence_vector,states,fitted,residuals,phi_,coef, and all other properties.
Examples
Simple exponential smoothing:
>>> from smooth.adam_general.core.es import ES >>> import numpy as np >>> y = np.array([112, 118, 132, 129, 121, 135, 148, 148, 136, 119, 104, 118]) >>> model = ES(model="ANN") >>> model.fit(y) >>> forecasts = model.predict(h=6)
Holt-Winters with automatic model selection:
>>> model = ES(model="ZZZ", lags=[12]) >>> model.fit(y) >>> print(f"Selected model: {model.model_type}")
Damped trend model:
>>> model = ES(model="AAdN") >>> model.fit(y) >>> print(f"Damping parameter: {model.phi_:.3f}")
With external regressors:
>>> X = np.random.randn(len(y), 2) >>> model = ES(model="AAN", regressors="use") >>> model.fit(y, X=X)
References
Svetunkov, I. (2023). Forecasting and Analytics with the Augmented Dynamic Adaptive Model. https://openforecast.org/adam/
Hyndman, R.J., et al. (2008). “Forecasting with Exponential Smoothing”
See also
ADAMFull ADAM model with ETS and ARIMA components
Methods
|
Fit the ADAM model to time series data. |
|
Generate point forecasts using the fitted ADAM model. |
|
Generate prediction intervals using the fitted ADAM model. |
Select the best model based on information criteria and update model parameters. |
|
|
Generate a formatted summary of the fitted model. |
Attributes
Return original in-sample data. |
|
Return Akaike Information Criterion. |
|
Return corrected Akaike Information Criterion. |
|
$B). |
|
Return Bayesian Information Criterion. |
|
Return corrected Bayesian Information Criterion. |
|
Return estimated coefficients (parameter vector B). |
|
$constant). |
|
$data). |
|
$distribution). |
|
'A' (additive) or 'M' (multiplicative). |
|
Return in-sample fitted values. |
|
$holdout). |
|
$ICw). |
|
$initialType). |
|
$initial). |
|
Return True if model is a combination of multiple models. |
|
Return the vector of lags used in the model. |
|
Return log-likelihood of the fitted model. |
|
$loss). |
|
$lossValue). |
|
$measurement). |
|
modelName()). |
|
Return ETS model type code (e.g., 'AAN', 'AAA', 'MAdM'). |
|
$models). |
|
$nParam). |
|
Return number of observations used for fitting. |
|
Return number of estimated parameters. |
|
Return ARIMA orders as dict with 'ar', 'i', 'ma' keys. |
|
$persistence). |
|
$phi). |
|
$profile). |
|
Return model residuals (errors from fitting). |
|
$scale). |
|
Return scale/standard error estimate. |
|
$states). |
|
Time taken to fit the model in seconds. |
|
$transition). |