Loading...
Loading...
Time series forecasting with Simple (SES), Double (Holt), and Triple (Holt-Winters) exponential smoothing. Visualize fitted values, generate forecasts, and export Python statsmodels code.
Exponential smoothing forecasts time series by weighting recent observations more heavily. Simple (SES) handles level-only data. Double (Holt) adds trend tracking. Triple (Holt-Winters) captures both trend and seasonal patterns.
import pandas as pd
import numpy as np
from statsmodels.tsa.holtwinters import Holt
import matplotlib.pyplot as plt
# Data
data = pd.Series([200, 220, 250, 280, 210, 230, 260, 290, 220, 240, 270, 300, 230, 250, 280, 310])
# Double Exponential Smoothing / Holt PH6 ko- PH7 Actual PH8 b- PH9 Fitted PH10 r-- PH11 Forecast', linewidth=2)
plt.legend()
plt.title("Holt's Double Exponential Smoothing")
plt.grid(True, alpha=0.3)
plt.show()Single (SES) handles level only - best for data without trend or seasonality. Double (Holt) adds a trend component - for data with upward/downward trends. Triple (Holt-Winters) adds seasonality - for data with both trend and repeating seasonal patterns.
Use grid search or optimization (statsmodels does this with optimized=True). Alpha (0-1) controls level smoothing - higher = more responsive. Beta controls trend - higher = faster trend changes. Gamma controls seasonality. Minimize AIC, BIC, or out-of-sample RMSE.
Additive: seasonal variation is constant regardless of level (e.g., always ±50 units). Multiplicative: seasonal variation scales with level (e.g., always ±10%). Use multiplicative when seasonal swings grow as the series increases.
SES: minimum 3-5 points. Holt: minimum 5-10. Holt-Winters: at least 2 full seasonal cycles (e.g., 24 months for monthly data with yearly seasonality). More data generally gives better parameter estimates.
Exponential smoothing is simpler, intuitive, and often works well for forecasting. ARIMA is more flexible, handles more complex patterns, and provides statistical tests. For most business forecasting, exponential smoothing performs comparably to ARIMA with less effort.