Shuffling of time series data in pytorch-forecasting

Jose_Peeterson: <p>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…</p>
<p>when I assign these as categorical variables in <strong>TimeSeriesDataSet</strong> using <strong>time_varying_known_categoricals</strong> the training.data[‘categoricals’] values seem shuffled and not in the right order as the target. Why is that?</p>
<p>pandas dataframe has the columns below before going through  <strong>TimeSeriesDataSet</strong></p>
<p>[“_hour_of_day”,“_day_of_week”,“_day_of_month”,“_day_of_year”,“_week_of_year”,“_month_of_year”,“_year” ]</p>
<p>where _hour_of_day incrementally increases from 0 to 23 and cycle repeats. similarly for other columns.</p>
<p>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?</p>
<p>At the moment I tried to use <strong>time_varying_known_reals</strong> to keep the order correct.</p>
<p>THanks.<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/2/2/2218a66dc1cf383f066b7183456daeb0b1f95d13.png" data-download-href="https://discuss.pytorch.org/uploads/default/2218a66dc1cf383f066b7183456daeb0b1f95d13" title="image"><img src="https://discuss.pytorch.org/uploads/default/original/3X/2/2/2218a66dc1cf383f066b7183456daeb0b1f95d13.png" alt="image" data-base62-sha1="4RD2TcbDHcl0nlYpzxqN8XxBS0P" width="690" height="444" data-dominant-color="282929"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1141×735 39.3 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

Jose_Peeterson: <p>Actually, the <strong>time_varying_known_categoricals</strong> 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.</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/4/5/45173c4c3c9947342b392a095ad749ac40b9559e.png" data-download-href="https://discuss.pytorch.org/uploads/default/45173c4c3c9947342b392a095ad749ac40b9559e" title="image"><img src="https://discuss.pytorch.org/uploads/default/original/3X/4/5/45173c4c3c9947342b392a095ad749ac40b9559e.png" alt="image" data-base62-sha1="9RcJ619oKvjTfleuDkvBVY3j9ro" width="690" height="362" data-dominant-color="272728"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">808×425 16.5 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>