hw(<history_length>, <season_length>, <sampling_rate>, <expression>[, <alpha>, <beta>, <gamma>])
Returns a smoothed version of the expression and forecasts its future points using the Holt-Winters triple exponential smoothing algorithm for seasonal data. The last three parameters are optional.
|history_length||Amount of data that we use to smooth the underlying time series and to forecast. History length is expressed as time before the left side of the widow, so that
|season_length||Length of one season of data. You need at least two full seasons of data to run the Holt-Winters algorithm.|
|sampling_rate||Rate at which the function summarizes the points in the underlying expression, similar to the
|expression||The time series on which you want to run the Holt-Winters algorithm.|
|alpha, beta, gamma||Optional coefficients that the Holt-Winters algorithm uses to determine how stable and how reactive its forecast is. The values range between 0 and 1, with smaller numbers weighing historical data more, and larger numbers weighing recent data more.
If you don't specify these parameters, the algorithm uses an optimization method called Nelder-Mead. Because Nelder-Mead finds local optima the same query might return two different results if the function is run twice. See Optional Parameters below for details.
Wavefront includes an implementation of the Holt-Winters algorithm, which supports prediction based on existing data. This algorithm is especially useful if your data are highly seasonal. Our implementation includes parameters to specify history length, season length, and sample rate. The optional
gamma parameters let you fine-tune how aggressive the smoothing is. See Exponential Smoothing and other internet resources for info about the algorithm.
Holt-Winters triple exponential smoothing is a form of time series analysis that’s used primarily for periodic or seasonal data. Its main strength is catching the overall trend of data over time while maintaining the structure of the data’s seasons.
If you use the
hw() function on a time series with a set periodicity, the function can predict the next event of interest, and, for example, send an alert.
For example, assume that at certain times of the day a set of virtual machines experiences peak load. You could set up an alert for that event, or assign additional CPU and memory to them. If the peak load time changes, for example, because daylight saving time ends, the
hw() function can catch up and adjust the alert or resources.
Using Optional Parameters to Holt-Winters to Affect hw()
Alpha, beta, and gamma are optional parameters that the Holt-Winters algorithm uses to determine how stable and how reactive its forecast is.
Alpha affects the weighted average of the points themselves. The weight of every point decays exponentially the further back the point is. When a new point is added to the weighted average, the weight of the new point is alpha, and the weight of the old average is
(1 – alpha). Therefore, higher values of alpha cause the algorithm to weight newer points more, making the forecast more reactive and less stable.
Beta affects the weighted average of the slopes between consecutive points. The algorithm uses an exponentially decaying weighted average of the slope between every two consecutive points, similar to the raw value of the points. This weighted average is calculated in the same way as the weighted average for alpha. Each time a new point is added, the slope between it and the last point is factored in with a weight of beta, while the old weighted average now has weight
(1 – beta). Therefore, higher values of beta cause the algorithm to weight the most recent slope higher, making the forecast more reactive and less stable.
Gamma affects the weighted average of the seasonal offsets. Holt-Winters captures seasonal data by measuring the average offset of a given point into a season from the average value of that season. For example, assume history length is four weeks, season length is one week, and sampling rate is one day. Then across the four weeks of history, there is an average amount that each day differs from the average value of the week it occurs in.
Like the alpha and beta, this average is a weighted average, with newer offsets having higher weights. Each time a new point is processed, it impacts the average offset from the season average by a factor of gamma, while the old weighted average offset has a weight of
(1 – gamma). Therefore, higher values of gamma cause the algorithm to weight newer points more, making the forecast more reactive and less stable.
If no values for these optional parameters are supplied, the
hw() function uses an optimization method called Nelder-Mead. Nelder-Mead finds local optima, so if no coefficients are provided, the same query might return two different results if it’s run twice.
There are requirements when using the
- The number of data points(including both the history length and the points in the window) divided by the sampling rate cannot exceed 10,000.
- The sampling rate must evenly divide the season length.
See Expanding Wavefront Predictive Analytics - See the Future with Holt-Winters Algorithm for in-depth discussion of an example.