Shuffling of time series data in pytorch-forecasting

Hi, I am using pytorch-forecasting for count time series. I have some date information such as hour of day, day of week, day of month etc…

when I assign these as categorical variables in TimeSeriesDataSet using time_varying_known_categoricals the[‘categoricals’] values seem shuffled and not in the right order as the target. Why is that?

pandas dataframe has the columns below before going through TimeSeriesDataSet

[“_hour_of_day”,“_day_of_week”,“_day_of_month”,“_day_of_year”,“_week_of_year”,“_month_of_year”,“_year” ]

where _hour_of_day incrementally increases from 0 to 23 and cycle repeats. similarly for other columns.

After the following code the _hour_of_day column is no longer 0,1,2,3 but 0, 1, 12, 17. Why does this shuffle happen?

At the moment I tried to use time_varying_known_reals to keep the order correct.


Actually, the time_varying_known_categoricals are NOT shuffled. The categories assigned to them are not in order like 1 for 1st hour, 2 for 2nd hour etc… that’s why it feels like it has shuffled the time series. I tried to align “hour_of_day” categorical variable for 3 days. I noticed that the encoding for each hour matches correcly for each day so there is no shuffling. This information should be mentioned in the doc string atleast. It will save a lot of time and confusion.