Smoothing methods basically generalize the time series functions based on previous examples’ seasonal effects and trends. In this way, these methods provide us to predict values for unknown points. This techniques are successful over recursive and cumulative datasets. Moreover, calculation lasts linear time. That is the cause time series approaches why highly adopted.
Interestingly, first study on exponential smoothing is about forecasting tobacco demands in 1956. A pleasure has triggered the development of smoothig time series approaches.
🙋♂️ You may consider to enroll my top-rated machine learning course on Udemy
Recent observations are weightier than the previous observations in exponential smoothing.
There are 3 types of smoothing methods: Single, Double and Triple Exponential Smoothing. Trends and seasonal effects are considered on Triple exponentials smoothing whereas only trend is considered on double exponential smoothing. In contrast, single exponential smoothing should be applied on datasets with no trends and no seasonal effects.
The following code block would give a opinion about triple exponential smoothing.
for (int i = blockSize; i < trainset.size(); i++) { //calculating i level parameters double actual = trainset.get(i).getActual(); level = alpha * (actual / trends.get(i - blockSize).getSeasonal()) + (1 - alpha) * (trends.get(i - 1).getLevel() + trends.get(i - 1).getTrend()); trend = beta * (level - trends.get(i - 1).getLevel()) + (1 - beta) * trends.get(i - 1).getTrend(); seasonal = gama * (actual / level) + (1 - gama) * (trends.get(i - blockSize).getSeasonal()); forecast = (trends.get(i - 1).getLevel() + trends.get(i - 1).getTrend()) * trends.get(i - blockSize).getSeasonal(); trends.get(i).setLevel(level); trends.get(i).setTrend(trend); trends.get(i).setSeasonal(seasonal); trends.get(i).setForecast(forecast); }
Adapting
I used the recursive sinus wave dataset. The following graph is retrieved when triple exponential smoothing is applied on the dataset. As seen forecats are very successful (MAE / Mean ratio: 8.80%).
Of course, smoothing methods are not perfect. Suppose that a vendor machine located near to a stadium and weekdays of football activities are randomly assigned to the stadium. If demands would like to be forecasted, smoothing methods would most probably fail at activity days. AI-based approaches such as Neural Networks are suggested to generalize the demand for these cases because activity days could be involved in the forecasting model. Negatively, AI-based approaches last much more time to train. I strongly recommend you to read my research paper about AI-based time series forecasting.
Finally, I’ve shared the java implementations of this post on my GitHub profile under the time series repository.
Support this blog if you do like!
1 Comment
Comments are closed.