Using the very simple model showed below, how is it that InferenceData contains no prior_predictive group? It would be highly useful if someone could explain my misunderstanding(s) of this modeling?
import pymc as pm
with pm.Model() as model:
p = pm.Beta(“p”, alpha=1, beta=1)
y_obs = pm.Binomial(“y_obs”, p=p, n=10, observed=7)
idata = pm.sample(1000)
NOTE: in a previous post, thanks to OriolAbril, I had some guidance saying I now see you are not saving the results of prior predictive sampling anywhere. Potentially useful references: PyMC 4.0 with labeled coords and dims — Oriol unraveled 1, Prior and Posterior Predictive Checks — PyMC 5.1.2 documentation
Unfortunately, I can’t find my way around these documents: I can’t manage to use them to reformulate my program effectively… There’s something I don’t understand but can’t explain. Any suggestion welcome.
Nice suggestion! Actually the prior_predictive group is now included in idata. But shouldn’t it be simpler if extend_inferencedata=True could be added to pm.sample_prior_predictive(return_inferencedata=True) ? Having for example the possibility to write pm.sample_prior_predictive(return_inferencedata=True, extend_inferencedata=True) ? For the moment, it generates an error, but it is not very logical, right?
I had a similar problem when using pm.to_inference_data(). If trace is used as an argument is already an InferenceData object then trace is simply returned and any other arguments are ignored (see the source code). I feel like the least surprising result would be for all arguments to be used. Maybe this would require extra arguments to control how the various fields are merged.
@Andre where do you see in the docstrings that it accepts an InferenceData as input? It accepts the arguments used to specify the returned InferenceData, it doesn’t say anywhere you can pass one as input.
Yes. I got the impression from your message above that you were saying sample_prior_predictive should already accept InferenceData as input because of the documentation. But I think we are on the same page?
Okay, so to clarify posterior_predictive doesn’t simply accept InferenceData, it needs it! That’s why it’s an argument to it. prior_predictive has no intrinsic need for an InferenceData, it creates new samples from nothing. That’s why it’s not an input.