pytorch-forecasting
pytorch-forecasting copied to clipboard
Question about using lags or monthly categorical features for seasonality recognition
Hey there,
I try to forecast monthly sales with the help of DeepAR
and TemporalFusionTransformer
. The data I use has monthly seasonality, and the seasonality is the same or at least very similar for different countries.
While generating the data I could set the parameter lags
, but I’m not sure if this is the better option than using the month or maybe month and country in a combination as a categorical feature to simplify the recognition of the seasonality.
Did anyone have own experience with this topic or an explanation what choice would be the best?
Thanks in advance!
Hello, @lch679 !
I have experience in forecasting parking meters' revenues with TFT implemented in PyTorch-forecasting. I, personally, found it both more straightforward and interpretable to use a day/month/year embedding to introduce the seasonality to the model.
The embedding is constructed by projecting the month's number on a unit circle as described here: https://towardsdatascience.com/cyclical-features-encoding-its-about-time-ce23581845ca
Although using lags in a baseline model, say LSTM or GRU, usually increases performance, I didn't get any benefits in TFT.
Should you have any other ideas on that, let me know.