-
-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New predictions group! #1030
Comments
I think following |
For future, we need to think about how do we handle post-run generated_quantities. |
Can I work on this? |
Yes! #1032 added predictions and predictions constant data to |
@OriolAbril which converters are you referring to? The |
Other converters such as |
Should the Also, it doesn't seem to have |
I don't really know the details of pyro well enough, I don't know if it is even possible or if this data is stored in pyro. A good start would be to replicate the model and workflow in the examples used to illustrate the schema specification. There is a version in PyStan and in PyMC3 implementing the same model and populating all the groups in InferenceData (with the exception of sample_stats_prior in PyMC3) |
|
The dimension looks ok (the extra dims are 1, the data contained there looks correct). Maybe it is an issue with a missing squeeze? Also, it looks like you have no log_likelihood group, are you using latest pyro release and arviz master? |
If you compare it with the PyMC3 example then the
I had not updated arviz but now I have and you can review again. |
In the case of log_likelihood it looks like an error of dimension handling in io_pyro. In the case of the prior, all extra dimensions (b0_dim_o, c1_dim_0,...) have length 1 which is why I believe a squeeze may solve the "problem". The data is the same for both a shape |
I was reading the code from my mobile on the train, so double check and it looks like log likelihood to xarray uses dims instead of self.dims, should be an easy fix. I am a little bit puzzled by the extra dims in prior, a squeeze (before adding the chain dim) should solve the issue, but they probably shold not be there to begin with |
Got it.
Does it have anything to do with my implementation? I don't have much experience with Pyro. |
Is posterior squeezing the input in io_pyro? In Pyro 1D arrays are actually 2D with last dimension being 1. --> column vector |
There seems to be no squeeze for posterior.
Yes, I just checked the shape of |
Hi, I am now looking to get predictions on new data but what I get is the data has shape of It seems like everytime you need new predictions you generate a new trace in Pyro? But there must be someway to get the right dims on new data with same trace. Here's the example @OriolAbril @ahartikainen. |
@nitishp25 I don't know how to fix this, as I said above I don't even know if it is possible to get out of sample posterior predictive samples (what we shortened to predictions) in Pyro. If you want to keep working on this maybe their forum is good place to get some help. Side comment: I was looking at |
I have asked these questions on their forum. I'll wait for the reply. |
Thanks to the Pyro forum I was able to figure out how to make out-of-sample predictions. Here's the notebook. I'm thinking of implementing this data similar to PyMC3 by creating a |
I am not sure about following pymc3 or pystan approach. PyMC3 needs a different function, because the information stored in the model is needed for the conversion, and to obtain predictions, the model changes, so a single function would not be able to access both the old and new instances of the model. It is probably better to follow pystan converter, because then both options become possible; users can merge the current inference data object with the new inference data containing only predictions (pymc3 like workflow) or generate the inference data with everything at once. In this case it would then be important to test that |
Yes that makes more sense. Also note that currently there seems to be no way to store constant data directly in Pyro, there exists |
I'd say it is useful to include the group because it let's users keep track of how where the predictions generated. For example, in the model you are working with, if you only get the inference data without the constant data groups you are missing quite some information as you would not have the times used to generate the posterior predictive samples. |
Why it (group input) can not be a dictionary that user provides? |
I think this was the idea? @nitishp25 |
It can be. I was just trying to find an easier way from the user's perspective like if Pyro had an option like But since this is not yet possible in Pyro, a dictionary can definitely be the desired input type. I was just looking for a better way and I thought if waiting for such a solution is worth it or not :) |
Tell us about it
Two new groups were recently added to the
InferenceData
schema:predictions
andpredictions_constant_data
. #983 added them infrom_pymc3
, however it is still pending for the other libraries.Current status:
Thoughts on implementation
PyStan
@ahartikainen what do you think would be better? Mimicking
posterior_predictive
orlog_likelihood
and adding the dict option to rename variables on creation?The text was updated successfully, but these errors were encountered: