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 Simple Exponential Smoothing model parameters.
| 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().
| 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.
| 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.
* "mean": jnp.ndarray (shape (h,))
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().
| 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).
* "mean": jnp.ndarray (shape (h,))
* "lo-{l}": jnp.ndarray (shape (h,), if level is provided)
* "hi-{l}": jnp.ndarray (shape (h,), if level is provided)
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.
| Parameter | Type | Default | Description |
|---|---|---|---|
self |
- | - | (undocumented) |
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.