sktime / pytorch-forecasting

Time series forecasting with PyTorch
https://pytorch-forecasting.readthedocs.io/
MIT License
4.01k stars 637 forks source link

Categorical variable labels #710

Open polal2is opened 3 years ago

polal2is commented 3 years ago

Hi guys, I was wondering how to map encoded categorical variables back to their initial label (columns names or categories in a given column) after training. This is useful for custom plots and clearer understanding of predictions in the context of a classification problem (categorical target).

I guess the variable order given in the TimeSeriesDataSet() is preserved for columns names but what about categories in a given column?

Do you know any method to do that? Thanks in advance!

DeastinY commented 2 years ago

Pitfall I stumbled upon actually... The order is not preserved, somewhere in numpy iirc sorted() is called. So prepare accordingly or extract the NaNLabelEncoder from your TimeSeriesDataSet and check the encodeing there. Cheers

DeastinY commented 2 years ago

val_dataloader.target_normalizer.classes_