Time series forecasting with multi-seasonal exponential smoothing
In this page, we will go over implementation details for the multi-seasonal holt winters’ set of smoothing equations as referenced in
- the 2010 paper by Taylor on triple seasonal forecasting
- hyndman’s multi-seasonal paper
- hyndman’s forecast package for R
If you are unfamiliar with the original holt winters’ equations, you can see them here. The formulas alone are pretty unintuitive, so I recommend reading grisha’s guide
MOTIVATION
When examining time series related to human behavior, daily patterns emerge. If we spend enough time squinting at graphs (or just like to hypothesize), we might guess that not only is there a daily pattern, but there tends to be a weekly pattern, as well.
While there are many implementations of the single season holt-winters’ equations (which all coincidentally point to the NIST guide), there are not too many implementations of the multi-seasonal models - this page hopes to help others convert their models to multi-seasonal.
ORIGINAL EQUATIONS
Recall the original equations for the multiplicative model:
Easy, right?
UPDATING TO THE MULTI-SEASONAL MODEL
First, we re-define gamma, L and I and turn them into arrays of values, one value per season. (we are multi-seasonal, after all)
The initialization of the second season is much simpler than the initialization of the first season. In the multiplicative model, we will initialize all the values to 1 (the multiplicative identity), since the seasonal co-efficients are multiplied together when making our forecasts.
When updating parameters, we consider the first season to be the predictor of behavior and the second season captures the difference in the expected behavior of the first season and the actual outcome. In other words, we consider the second season to be “correcting” the errors of the first by capturing its residuals.
In equation form:
Wow… what a mouthful. Instead of hardcoding indeces, let us rewrite this more clearly. With a loop, we calculate the overall product of the seasonal co-efficients and then subtract out each season to find the residual factors.
The forecasting procedure is similar to the single seasonal normal equations. The main difference is that we accumulate all our seasonal co-efficients before making the forecast.
And there we have it: multi-seasonal exponential smoothing.
If you were able to use the above to update your model, congratulations! If not, get in touch and let’s debug it together. Happy forecasting!
IMPLEMENTATION
Snorkel’s implementation of HW exp smoothing + a simple solver is available on github
CHANGELOG
2019-03-31
- update github source link to port to snorkel-lite branch
2017-06-19
- add a picture
2016-08-30
- first write up of multi-seasonal exponential smoothing