ANALYSIS TOOL BOX

Predictive Analytics

CreateExponentialSmoothingModel

Construct, fit, and evaluate exponential smoothing models for time series forecasting.

exponential-smoothingholt-winterstime-seriesforecastingseasonality

Introduction

Not every time series needs the machinery of ARIMA — a lot of forecasting problems are really just "weight recent history more than distant history, and account for trend and seasonality if they're there." CreateExponentialSmoothingModel covers that ground with Simple, Double (Holt), and Triple (Holt-Winters) exponential smoothing, either picking the right variant for you automatically or letting you set it explicitly, then optimizing the smoothing coefficients, decomposing the series into trend/seasonal/residual components, and comparing training vs. test RMSE so you know how much to trust the forecast.

Teaching Note

Exponential smoothing is essential for:

  • Generating short-term demand forecasts for inventory management and logistics
  • Predicting future financial performance and revenue trends for budget planning
  • Analyzing seasonal patterns in economic indicators or market activity
  • Monitoring operational metrics and projecting future capacity requirements
  • Forecasting call volumes or service requests for workforce optimization
  • Smoothing noisy historical data to identify underlying structural trends
  • Evaluating the impact of seasonality on business performance metrics

Parameters

ParameterTypeDefaultDescription
dataframerequiredThe input pandas DataFrame containing the time series data.
time_columnrequiredThe name of the column containing date or time information.
outcome_columnrequiredThe name of the target variable column intended for forecasting.
smoothing_type'auto'The complexity of the model: 'simple' (level only), 'double' (level + trend), 'triple' (level + trend + seasonality), or 'auto' for heuristic-based selection. Defaults to 'auto'.
alphaNoneThe smoothing parameter for the level component (0 < alpha <= 1). Adjusts the weight of recent observations. Defaults to None.
betaNoneThe smoothing parameter for the trend component (0 < beta <= 1). Determines how quickly the model adapts to trend changes. Defaults to None.
gammaNoneThe smoothing parameter for the seasonal component (0 < gamma <= 1). Controls the sensitivity to seasonal fluctuations. Defaults to None.
seasonal_periodsNoneThe number of observations that make up a full season (e.g., 12 for monthly seasonality). Required for triple exponential smoothing.
trend_type'additive'The nature of the trend component: 'additive' or 'multiplicative'. Defaults to 'additive'.
seasonal_type'additive'The nature of the seasonal component: 'additive' or 'multiplicative'. Defaults to 'additive'.
damped_trendFalseWhether to dampen the trend approach to a horizontal line over time. Defaults to False.
test_size0.2Proportion of observations held out as a temporal test set (the last test_size fraction of rows). The model is fit on the remaining earlier observations. Defaults to 0.2.
auto_optimizeTrueIf True, utilizes numerical solvers to find optimal smoothing coefficients based on historical data. Defaults to True.
optimization_method'L-BFGS-B'The solver used for parameter tuning. Defaults to 'L-BFGS-B'.
print_model_performanceTrueWhether to print performance metrics (RMSE, MAE, MAPE) to the console. Defaults to True.
print_parameter_summaryTrueWhether to print the optimized smoothing coefficients to the console. Defaults to True.
print_forecast_summaryTrueWhether to print a summary of the future forecast values to the console. Defaults to True.
forecast_periods12The number of future time steps to project beyond the historical data. Defaults to 12.
data_source_for_plotNoneSource citation string displayed in the caption of all generated plots. Defaults to None.
plot_model_performanceTrueWhether to plot actual vs. fitted values to visualize model accuracy. Defaults to True.
plot_forecastTrueWhether to plot the future forecast against the historical series. Defaults to True.
plot_decompositionTrueWhether to plot the trend, seasonal, and residual decomposition of the series. Defaults to True.
dot_fill_color'#999999'Hex color for actual-value points on the model performance plot. Defaults to '#999999'.
line_color'#b0170c'Hex color for the fitted-value line on the model performance plot. Defaults to '#b0170c'.
forecast_color'#ff6b35'Hex color for the forecast line on the forecast plot. Defaults to '#ff6b35'.
figure_size_for_performance_plot(12, 8)Dimensions (width, height) for the model performance plot. Defaults to (12, 8).
figure_size_for_forecast_plot(12, 6)Dimensions (width, height) for the forecast plot. Defaults to (12, 6).
figure_size_for_decomposition_plot(12, 8)Dimensions (width, height) for the decomposition plot. Defaults to (12, 8).
title_for_performance_plot'Exponential Smoothing Model Performance'Title text for the model performance plot.
subtitle_for_performance_plot'Actual vs. Fitted values showing model accuracy'Subtitle text for the model performance plot.
title_for_forecast_plot'Exponential Smoothing Forecast'Title text for the forecast plot.
subtitle_for_forecast_plot'Future predictions based on historical patterns'Subtitle text for the forecast plot.
title_for_decomposition_plot'Time Series Decomposition'Title text for the decomposition plot.
subtitle_for_decomposition_plot'Breakdown of trend, seasonal, and residual components'Subtitle text for the decomposition plot.
caption_for_performance_plotNoneOptional caption text for the model performance plot. Defaults to None.
caption_for_forecast_plotNoneOptional caption text for the forecast plot. Defaults to None.
caption_for_decomposition_plotNoneOptional caption text for the decomposition plot. Defaults to None.
title_y_indent_for_performance_plot1.1Vertical position of the title on the model performance plot. Defaults to 1.1.
subtitle_y_indent_for_performance_plot1.05Vertical position of the subtitle on the model performance plot. Defaults to 1.05.
title_y_indent_for_forecast_plot1.1Vertical position of the title on the forecast plot. Defaults to 1.1.
subtitle_y_indent_for_forecast_plot1.05Vertical position of the subtitle on the forecast plot. Defaults to 1.05.
title_y_indent_for_decomposition_plot1.1Vertical position of the title on the decomposition plot. Defaults to 1.1.
subtitle_y_indent_for_decomposition_plot1.05Vertical position of the subtitle on the decomposition plot. Defaults to 1.05.
caption_y_indent_for_performance_plot-0.215Vertical position of the caption on the model performance plot. Defaults to -0.215.
caption_y_indent_for_forecast_plot-0.215Vertical position of the caption on the forecast plot. Defaults to -0.215.
caption_y_indent_for_decomposition_plot-0.215Vertical position of the caption on the decomposition plot. Defaults to -0.215.
x_indent_for_performance_plot-0.115Horizontal starting position for text on the model performance plot. Defaults to -0.115.
x_indent_for_forecast_plot-0.115Horizontal starting position for text on the forecast plot. Defaults to -0.115.
x_indent_for_decomposition_plot-0.115Horizontal starting position for text on the decomposition plot. Defaults to -0.115.
plot_training_and_test_performanceTrueWhether to render a bar chart comparing training RMSE and test RMSE. Defaults to True.
training_bar_color'#3a86ff'Bar color for the training RMSE bar. Defaults to '#3a86ff'.
test_bar_color'#b0170c'Bar color for the test RMSE bar. Defaults to '#b0170c'.
figure_size_for_performance_comparison_plot(7, 5)Dimensions (width, height) for the training/test RMSE comparison chart. Defaults to (7, 5).
title_for_performance_comparison_plotNoneTitle text for the training/test RMSE comparison chart. Defaults to a sensible built-in title when None.
subtitle_for_performance_comparison_plotNoneSubtitle text for the training/test RMSE comparison chart. Defaults to a sensible built-in subtitle when None.
caption_for_performance_comparison_plotNoneOptional caption text for the training/test RMSE comparison chart.
title_y_indent_for_performance_comparison_plot1.1Vertical position of the title on the comparison chart. Defaults to 1.1.
subtitle_y_indent_for_performance_comparison_plot1.05Vertical position of the subtitle on the comparison chart. Defaults to 1.05.
caption_y_indent_for_performance_comparison_plot-0.15Vertical position of the caption on the comparison chart. Defaults to -0.15.
x_indent_for_performance_comparison_plot-0.115Horizontal starting position for text on the comparison chart. Defaults to -0.115.

Returns

A dictionary with model (the fitted statsmodels Holt-Winters object), model_type (the smoothing method used), fitted_values (in-sample predictions), forecast (future predictions), performance_metrics (training_rmse, test_rmse, training_mae, training_mape), parameters (the optimized smoothing coefficients), and data (the cleaned time series used for modeling).

Example

python
from analysistoolbox.predictive_analytics import CreateExponentialSmoothingModel

# Automated model selection with a 12-period forecast
results = CreateExponentialSmoothingModel(
    df,
    time_column='Month',
    outcome_column='Sales',
)
forecast = results['forecast']