pytorch-forecasting icon indicating copy to clipboard operation
pytorch-forecasting copied to clipboard

Question about using lags or monthly categorical features for seasonality recognition

Open lch679 opened this issue 3 years ago • 1 comments

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!

lch679 avatar Nov 12 '21 07:11 lch679

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.

polkadot21 avatar Apr 06 '22 08:04 polkadot21