kdgutier / esrnn_torch

MIT License
156 stars 44 forks source link

Prediction interval for ES-RNN #35

Closed marijnhazelbag closed 2 years ago

marijnhazelbag commented 2 years ago

Thank you for making this implementation available. Sorry if I missed It; Is there an easy way to obtain prediction intervals with your ES-RNN implementation?

kdgutier commented 2 years ago

Hi @marijnhazelbag, For the moment we are only estimating quantiles using the quantile regression like in the paper and main M4 competition. We have implemented a multi-quantile loss function here: https://github.com/Nixtla/nixtlats/blob/master/nixtlats/losses/pytorch.py#L317

I imagine, it could be easy to adapt the final layer of the ES-RNN to output multi-quantiles. https://github.com/kdgutier/esrnn_torch/blob/master/ESRNN/utils/ESRNN.py#L285

Let me know if you want to try it, or would you need help with it.

marijnhazelbag commented 2 years ago

Thank you for the swift response! I will try and let you know if I run into problems :)

kdgutier commented 2 years ago

I am reaching a friend who might have already done it to point you to his work.

AzulGarza commented 2 years ago

Hi, @marijnhazelbag,

Thanks for your interest. We have written the multi-quantile version of the ESRNN model: MQESRNN; you can find it in our new library for time series forecasting using Deep Learning named nixtlats, in particular here. You can import it using:

from nixtlats.models.esrnn.mqesrnn import MQESRNN

You pass a list of percentiles to obtain prediction intervals; for example, if you want a 90% prediction interval, you could use training_percentiles=[5, 50, 95]. Under the hood, the model trains the ESRNN model using the multiquantile loss.

marijnhazelbag commented 2 years ago

Thank you, gentlemen! I really appreciate it.