Esc
Ask AIAnswers may be inaccurate; check the linked pages.Esc
Ask anything about these docs, like how to get started or what a function does.

SimpleExponentialSmoothing

chronax.models.SimpleExponentialSmoothing · inherits BaseForecaster

JAX-optimized Simple Exponential Smoothing. Weighted average of past observations with exponentially decreasing weights. Formula: $\hat{y}[t+1] = \alpha \cdot y[t] + (1-\alpha) \cdot \hat{y}[t]$.

__init__(self, alpha, alias='SES', conformal_params=None)

Initializes the SimpleExponentialSmoothing model.

Parameter Type Default Description
alpha float - Smoothing parameter in [0,1]
alias str "SES" Model name
conformal_params ConformalIntervals \| None None ConformalIntervals for prediction intervals

fit(self, y, X=None) -> Self

Fit the SimpleExponentialSmoothing model.

Runs SES on the full series to produce fitted values and the final smoothed level (used as the flat forecast). If conformal_params is configured, conformity scores are computed and cached for predict().

Parameters:

Parameter Type Default Description
y jnp.ndarray - Clean time series of shape (t,).
X jnp.ndarray \| None None Exogenous variables (unused; included for API compatibility).

Returns: Self (the fitted forecaster; sets self.model_).

forecast(self, y, h, X=None, X_future=None, level=None, fitted=False) -> dict

Memory-efficient stateless fit+predict in one call.

Fits SES on y and immediately generates h-step ahead point forecasts without storing any model state. Used internally by BaseForecaster for conformity score computation in cross-validation windows.

Parameters:

Parameter Type Default Description
y jnp.ndarray - Clean time series of shape (t,).
h int - Forecast horizon (number of steps ahead).
X jnp.ndarray \| None None In-sample exogenous variables (unused; included for API compatibility).
X_future jnp.ndarray \| None None Future exogenous variables (unused; included for API compatibility).
level list[int \| float] \| None None Confidence levels (unused; included for BaseForecaster compliance).
fitted bool False Whether to return fitted values (unused; included for BaseForecaster compliance).

Returns: dict (Dictionary containing "mean", point forecasts of shape (h,), all equal to the final smoothed level.)

predict(self, h, X=None, level=None) -> dict

Generate h-step ahead forecasts using the fitted model.

All h forecasts equal the final smoothed level $\ell[T]$. Optionally adds conformal prediction intervals using cached conformity scores from fit().

Parameters:

Parameter Type Default Description
h int - Forecast horizon (number of steps ahead).
X jnp.ndarray \| None None Exogenous variables (unused; included for API compatibility).
level list[int] \| None None Confidence levels (0--100) for prediction intervals, e.g. [80, 95]. Requires conformal_params to be set.

Returns: dict (Dictionary containing "mean" (point forecasts of shape (h,)) and optionally "lo-{l}" / "hi-{l}" (conformal interval bounds for each level l, only present when level is not None).)

Raises: * ValueError: If level is requested but conformal_params is None. * ValueError: If level is requested but the model has not been fitted yet.

predict_in_sample(self) -> dict

Return in-sample fitted values from the last fit() call.

Returns: dict (Dictionary containing: "fitted": In-sample smoothed predictions of shape (t,). The first value is NaN (no prior level available at t=0).)

Raises: * ValueError: If the model has not been fitted yet.