Exponential Smoothing¶
durbyn provides four exponential smoothing models and a separate Croston method from the same module.
SES — Simple Exponential Smoothing¶
Best for series with no trend or seasonality.
Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
initial |
str |
"optimal" |
Initialisation method: "optimal" or "simple" |
alpha |
float \| None |
None |
Smoothing parameter (0-1). None for optimised |
lambda_ |
float \| bool \| None |
None |
Box-Cox parameter. True for auto, None for none |
biasadj |
bool |
False |
Bias adjustment for Box-Cox back-transformation |
Holt — Linear Trend Method¶
Extends SES with a linear trend component.
from durbyn import Holt
# Damped trend
model = Holt(damped=True).fit(y, m=1)
fc = model.forecast(h=12)
# Exponential (multiplicative) trend
model = Holt(exponential=True).fit(y, m=1)
fc = model.forecast(h=12)
Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
damped |
bool |
False |
Use damped trend |
initial |
str |
"optimal" |
"optimal" or "simple" |
exponential |
bool |
False |
Multiplicative (exponential) trend |
alpha |
float \| None |
None |
Level smoothing parameter |
beta |
float \| None |
None |
Trend smoothing parameter |
phi |
float \| None |
None |
Damping parameter |
lambda_ |
float \| bool \| None |
None |
Box-Cox parameter |
biasadj |
bool |
False |
Bias adjustment for Box-Cox |
HoltWinters — Triple Exponential Smoothing¶
Handles trend and seasonality.
from durbyn import HoltWinters
# Additive seasonality
model = HoltWinters(seasonal="additive").fit(y, m=12)
fc = model.forecast(h=12, level=[80, 95])
# Multiplicative seasonality with damped trend
model = HoltWinters(
seasonal="multiplicative",
damped=True,
).fit(y, m=12)
fc = model.forecast(h=24)
Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
seasonal |
str |
"additive" |
"additive" or "multiplicative" |
damped |
bool |
False |
Damped trend |
initial |
str |
"optimal" |
"optimal" or "simple" |
exponential |
bool |
False |
Multiplicative trend |
alpha |
float \| None |
None |
Level smoothing |
beta |
float \| None |
None |
Trend smoothing |
gamma |
float \| None |
None |
Seasonal smoothing |
phi |
float \| None |
None |
Damping parameter |
lambda_ |
float \| bool \| None |
None |
Box-Cox parameter |
biasadj |
bool |
False |
Bias adjustment |
Note
m (seasonal period) is required at fit time and must be > 1 for seasonal models.
ETS — Error-Trend-Seasonal State Space¶
General framework encompassing all exponential smoothing models. Supports automatic model selection.
from durbyn import ETS
# Automatic model selection
model = ETS(model="ZZZ").fit(y, m=12)
fc = model.forecast(h=12)
# Specific model: Additive error, Additive trend, Multiplicative seasonal
model = ETS(model="AAM").fit(y, m=12)
fc = model.forecast(h=12, level=[80, 95])
# With damped trend
model = ETS(model="ZZZ", damped=True).fit(y, m=12)
Model String¶
The model parameter is a 3-character string "ETS" where:
- E (Error):
A= additive,M= multiplicative,Z= auto - T (Trend):
N= none,A= additive,M= multiplicative,Z= auto - S (Seasonal):
N= none,A= additive,M= multiplicative,Z= auto
Common models:
| Model | Description |
|---|---|
"ZZZ" |
Fully automatic selection |
"ANN" |
Simple exponential smoothing (additive errors) |
"AAN" |
Holt's linear trend |
"AAA" |
Additive Holt-Winters |
"MAM" |
Multiplicative Holt-Winters |
Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
model |
str |
"ZZZ" |
3-char model specification |
damped |
bool \| None |
None |
Damped trend. None for auto |
alpha |
float \| None |
None |
Level smoothing |
beta |
float \| None |
None |
Trend smoothing |
gamma |
float \| None |
None |
Seasonal smoothing |
phi |
float \| None |
None |
Damping parameter |
additive_only |
bool |
False |
Restrict to additive models |
lambda_ |
float \| bool \| None |
None |
Box-Cox parameter |
biasadj |
bool |
False |
Bias adjustment |
opt_crit |
str |
"lik" |
Optimisation criterion: "lik", "amse", "mse" |
ic |
str |
"aicc" |
Information criterion: "aicc", "aic", "bic" |
bounds |
str |
"both" |
Parameter bounds: "both", "usual", "admissible" |
restrict |
bool |
True |
Apply admissibility restrictions |
allow_multiplicative_trend |
bool |
False |
Allow multiplicative trend models |
Croston — Intermittent Demand (Simple)¶
Simple Croston wrapper from the ExponentialSmoothing module. For more advanced variants, see Intermittent Demand.
from durbyn import Croston
data = [0, 0, 1, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0]
model = Croston().fit(data)
fc = model.forecast(h=12)
print(fc.mean) # flat forecast (no prediction intervals)
Note
Croston's method produces flat forecasts without prediction intervals. The level parameter is ignored.