pytorch-forecasting
pytorch-forecasting copied to clipboard
Can i get nbinom parameters with DeepAR model?
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!
3- How can i save and load the model to use it later?
For 3, see #702
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.