jdb78 / pytorch-forecasting

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

Binary classification task in TFT model that outputs a probability distribution over the two possible outcomes for each of the next 10 time steps #622

Open Kimonili opened 2 years ago

Kimonili commented 2 years ago

Hi there,

  1. I have a binary classification task and I am using the TFT model. I want to output the probability distribution over the two possible outcomes (binary) for each of the next 10 time steps given the last 30 timesteps. Is that possible with TFT? If yes, should I set decoder_length=10, encoder_length=30 and output_size=1 and the model will output the desired results or there is more to do to achieve that?

  2. How can we add a metric (accuracy, f1 score, precision, recall etc) to visualize the performance of the TFT model in classification tasks? Is it possible through the class directly or should I inherit it?

Thanks @jdb78 !

Kimonili commented 2 years ago

Any updates on this issue @jdb78?

ammargilani commented 2 years ago

Hi, any updates? @jdb78?

Nintorac commented 1 year ago

for 2 checkout logging_metrics which is a kwarg to TemporalFusionTransformer.

output_size I am also a little lost on but I think it's changing the number of quantiles for the quantile loss (section 5). Not what you are trying to do. Oh yea, setting to 2 fixed some random crashes I was getting

I just replaced my bool column with a category column with two categories, true and false and then used pytorch_forecasting.metrics.CrossEntropy, seems to work but please correct me if I've made a mistake