pytorch-forecasting icon indicating copy to clipboard operation
pytorch-forecasting copied to clipboard

Can i get nbinom parameters with DeepAR model?

Open nicocheh opened this issue 3 years ago • 3 comments

1- In the DeepAR model with negativebinomial loss, is there any way to obtain the two parameters n and p of the nbinom distribution when predicting over a val_dataloader?? I can only get samples or quantiles.

2- In the same model with same loss, i got an error when plotting with .plot_prediction that is that a parameter is 1.0 when the upper bound is 1.0. I suppose that is the p of the negative binomial. I cant get the plot but i can get raw predictions and all that stuff, is that ok? how is it that cant plot but can predict?

The library is amazing! Thank you very much for all the effort!

nicocheh avatar Jan 06 '22 17:01 nicocheh

3- How can i save and load the model to use it later?

nicocheh avatar Jan 06 '22 20:01 nicocheh

For 3, see #702

ozanozyegen avatar Jan 25 '22 18:01 ozanozyegen

Related to (1), I needed the parameters of the gaussian distribution produced by DeepAR also. I had a test data loader (created with TimeSeriesDataSet), but instead of samples or prediction, I wanted to get the parameters of the distribution. So I ran the pred, input = deepar.predict(test_loader, return_x=True) to extract inputs for the model (which should be a dictionary). Then, I rad output = deepar.forward(input), which yields the parameters as desired.

mrsergazinov avatar Apr 01 '22 02:04 mrsergazinov