sachinruk / KerasQuantileModel

Quantile Regression using Deep Learning. An alternative to Bayesian models to get uncertainty.
74 stars 37 forks source link

Quantile regression after parameter estimation #1

Open tblazina opened 6 years ago

tblazina commented 6 years ago

Hi @sachinruk, I'm very happy to have come across your quantile regression notebook. I'm a data scientist in Switzerland working on doing forecasting of fresh food and have been trying to implement the model described recently in https://arxiv.org/pdf/1704.04110.pdf, where they are using a RNN to estimate the mean and dispersion of a negative binomial distribution and then using these estimates to draw samples from the distributions defined by their estimates to calculate what they refer to as p-quantile loss but their formulation of the loss function is different from yours.

I had a sort of general question because I have no experience with quantile regression, but intuitively , if you take like the 90% quantile loss and train a RNN on it then the predictions it makes would be inherently more conservative than if you used the median (50% quantile) or the 25% quantile... so in my world of fresh food forecasting, if we used the 90% quantile as the loss to train the model then we would say that our risk of stock out would be 10% (i.e. only a 10 % chance of our demand being higher than we expect). Does my intuition hold up here?

Thanks again for the great notebook!

sachinruk commented 6 years ago

I apologise for taking so long to respond. Haven't read the paper but in terms of the statement:

if we used the 90% quantile as the loss to train the model then we would say that our risk of stock out would be 10%

This is more or less correct. But keep in mind that this does not show model uncertainty of that prediction. i.e. if I say that I predict the 90th quantile to be sale of 500 units, there is no +/- x units for this prediction. So always check for a test set if the observations below this prediction are close to 90% before using quantile regression in production.

tblazina commented 6 years ago

No problem, thanks for the response. Yes I think I understand this. Thank you very much for the clarification!