mojolearn.DampedETS#
- class mojolearn.DampedETS(season_length=1, error='A', alpha=None, beta=None, phi=None, numeric_mode=None)#
Holt’s damped additive trend model, ETS(A,Ad,N).
ETSwithmodel=error + "AN"anddamped=True: a damped additive trend and no season. Seterror="M"for multiplicative errors (strictly positive data).- Parameters:
season_length (int, default 1) – Number of observations per season (no season is fitted).
error ({“A”, “M”}, default “A”) – Additive or multiplicative errors.
alpha, beta, phi (float or None, default None) – Fix the level, trend and damping smoothing parameters; None estimates each.
numeric_mode (str or None, default None) – Numeric mode for this model (
'identical'or'fast'); None uses the process default (seemojolearn.set_numeric_mode()).'fast'is available on Apple GPUs only.
- Variables:
info_ (ndarray of shape (batch_size, 10), float32) – Per-series fit summary. Set by predict().
Examples
>>> import numpy as np, mojolearn >>> y = (100 + np.cumsum(np.random.default_rng(0).normal(1, 2, 80))).astype(np.float32) >>> mojolearn.DampedETS().fit(y).predict(10)["mean"].shape (10,)
Methods
fit(y[, X])Check and store one series or a batch of series.
forecast(y, h[, X, X_future, level, fitted])Fit
yand forecasthsteps in one call.predict(h[, X, level])Fit the model and forecast h steps ahead.
- fit(y, X=None)#
Check and store one series or a batch of series.
The model itself is estimated by predict().
- Parameters:
y (array-like of shape (n_obs,) or (batch_size, n_obs)) – The series, float32. A private copy is kept.
X (None) – Exogenous regressors are not supported; anything other than None raises NotImplementedError.
- Returns:
self
- Raises:
TypeError – If
yis float64.ValueError – If a series has fewer than 4 observations, if a multiplicative model meets non-positive or non-finite values, or if there are too many parameters for the number of observations.
NotImplementedError – If
n_obsis at most the parameter count plus 4.
- forecast(y, h, X=None, X_future=None, level=None, fitted=False)#
Fit
yand forecasthsteps in one call.Equivalent to
fit(y).predict(h).fitted=True(in-sample fitted values) raises NotImplementedError.- Returns:
dict –
{"mean": forecasts}, as returned by predict().
- predict(h, X=None, level=None)#
Fit the model and forecast h steps ahead.
- Parameters:
h (int) – Forecast horizon.
X (None) – Unused.
level (None) – Prediction intervals are not supported; anything other than None raises NotImplementedError.
- Returns:
dict –
{"mean": forecasts}, shaped(h,)for a single series or(batch_size, h)for a batch.