About 2 weeks ago I had to come up with a forecast for some key metrics. I was already familiar with Arima and Exponential Smoothing (if you’re not familar with them, I suggest you read Rob Hyndman’s free book online), but when I tested another model, the Theta Model, I was pleasantly surprised by the model’s performance. Compared to the other two forecasting models, the MSE was lower and the prediction intervals were smaller. The only problem was that I had no idea how the Theta model worked. Fortunately, learning these things has gotten much easier with the advent of ChatGPT (and other LLMs).
Also, I found that the code in the statsforecast library’s Github repository was written in Python (at least the theta.py file is). This was very fortunate, because, as a ChatGPT subscriber, I could just copy and paste the code into the chat window and get a summary for all the portions of code.
Through my conversation with ChatGPT I was able to get this summary of the model:
The Theta method is a simple yet powerful forecasting technique used to predict future values based on historical time series data. It operates by decomposing the original time series into two or more “theta lines,” which are modified versions of the data that emphasize different components, such as long-term trends and short-term fluctuations. By separately forecasting these theta lines and then combining the results, the Theta method effectively captures both the overall direction and the cyclical patterns within the data, leading to more accurate and reliable predictions.
This method gained significant recognition during the M3 Forecasting Competition held in 2000, which was a global event aiming to evaluate the accuracy of various forecasting methods across multiple time series datasets. The Theta method stood out by achieving highly accurate forecasts, outperforming many more complex and sophisticated models. Its success in the M3 competition highlighted its effectiveness and practicality, making it a preferred choice for businesses and analysts seeking dependable forecasting tools.
The summary is kind of helpful, but I think I can do a little better.
The Theta Model is just a combination of Simple Exponential Smoothing and Linear Regression, where the hyperparameters are theta (which weights the linear regression part of the model), alpha (which controls the level in the exponential smoothing part of the model) and the initial level (which is the starting level).
These parameters are tuned using the Nelder-Mead algorithm, which creates a simplex in n dimensional space (where n is the number of hyper-parameters), and moves it, expands it, or shrinks it until it converges to the optimal solution. Here’s a link to a YouTube video that explain the method in detail.
Hopefully this post has piqued your curiosity. Here’s a link to the full chat that shows my whole conversation with ChatGPT o-1.
As always, I hope you enjoyed reading this. Have a great day!
Leave a Reply