Exponential smoothing
polars_ts.models.exponential_smoothing
Pure-Polars exponential smoothing forecasters.
Implements SES, Holt's linear, and Holt-Winters methods. Delegates to Rust when available (2-5x faster per group), falling back to pure Python otherwise. Closes #49.
ses_forecast(df, h, alpha=0.3, target_col='y', id_col='unique_id', time_col='ds')
Forecast with Simple Exponential Smoothing.
Smooths with level parameter alpha and projects a flat forecast.
Parameters
df Input DataFrame. h Forecast horizon. alpha Smoothing parameter for level (0 < alpha < 1).
holt_forecast(df, h, alpha=0.3, beta=0.1, target_col='y', id_col='unique_id', time_col='ds')
Holt's linear trend forecast.
Smooths level and trend, then extrapolates linearly.
Parameters
df Input DataFrame. h Forecast horizon. alpha Smoothing parameter for level. beta Smoothing parameter for trend.
holt_winters_forecast(df, h, season_length, alpha=0.3, beta=0.1, gamma=0.1, seasonal='additive', target_col='y', id_col='unique_id', time_col='ds')
Holt-Winters seasonal forecast.
Smooths level, trend, and seasonal components.
Parameters
df
Input DataFrame.
h
Forecast horizon.
season_length
Number of observations per season.
alpha
Smoothing parameter for level.
beta
Smoothing parameter for trend.
gamma
Smoothing parameter for seasonality.
seasonal
"additive" or "multiplicative".