Exponential Smoothing models for time series forecasting.
Classes
class algorithms.timeseries.exponential_smoothing.ExponentialSmoothing(Regressor)
Exponential Smoothing model for time series forecasting with trend and seasonal components.
__init__( self, trend: str | None = None, seasonal: str | None = None, seasonal_periods: int | None = None, smoothing_level: float | None = None, smoothing_trend: float | None = None, smoothing_seasonal: float | None = None, damped_trend: bool = False, )
Overview
The Exponential Smoothing procedure works as follows:
- Select the model type: Simple (no trend/season), Double (trend),
- Initialize the level, trend, and seasonal components from the data.
- Apply the recursive smoothing equations to update each component
- Compute fitted values and residuals from the one-step-ahead
- Generate multi-step forecasts by extrapolating the final level,
Theory
Simple Exponential Smoothing (SES): Suitable for data with no clear trend or seasonal pattern.
Double Exponential Smoothing (Holt's Linear Trend): Adds a trend component to SES.
Triple Exponential Smoothing (Holt-Winters): Adds a seasonal component to Holt's method. Supports both additive and multiplicative seasonality.
Additive Seasonality:
Parameters
trend
seasonal
seasonal_periods
smoothing_level
smoothing_trend
smoothing_seasonal
damped_trend
Attributes
level_
trend_
seasonal_
params_
fitted_values_
resid_
n_obs_
Notes
Complexity:
- Training: O(n) where n is the number of samples.
- Prediction: O(h) where h is the forecast horizon.
- Time series with trend and/or seasonal patterns
- When recent observations should carry more weight than older ones
- Short-to-medium term forecasting with limited data
- Business and demand forecasting applications
- When a simple, fast, and interpretable model is desired
References
See Also
>>> import numpy as np
>>> from tuiml.algorithms.timeseries import ExponentialSmoothing
>>> # Generating data with trend
>>> y = np.array([2, 4, 6, 8, 10, 12, 14, 16, 18, 20], dtype=float)
>>> model = ExponentialSmoothing(trend="add")
>>> model.fit(y)
>>> forecast = model.predict(steps=3)
Methods
fit
(self, y: np.ndarray, X: Optional[np.ndarray]=None) -> 'ExponentialSmoothing'
fit
(self, y: np.ndarray, X: Optional[np.ndarray]=None) -> 'ExponentialSmoothing'
Fit the exponential smoothing model to time series data.
Parameters
y
X
Returns
self
predict
(self, steps: int=1, X: Optional[np.ndarray]=None) -> np.ndarray
predict
(self, steps: int=1, X: Optional[np.ndarray]=None) -> np.ndarray
Forecast future values using the fitted smoothing model.
Parameters
steps
X
Returns
forecast
fit_predict
(self, y: np.ndarray, steps: int=1) -> np.ndarray
fit_predict
(self, y: np.ndarray, steps: int=1) -> np.ndarray
Fit the model and forecast future values in one step.
Parameters
y
steps
Returns
forecast