Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Back in 2018, I participated in a discussion of an enhancement of PyMC, adding functions to sample the prior, prior predictive, and posterior predictive distributions.
Here’s the PR: #2983
I suggested an API with four functions:
sample_prior
sample_prior_predictive
sample_posterior (synonym for sample)
sample_posterior_predictive (synonym for sample_ppc)
In the end, only
sample_prior_predictive
andsample_posterior_predictive
were added.Reflecting on that decision, I think there are cases where we want to sample from the prior only and not from the prior predictive. For example, in a model that contains a Potential, the sample from the prior predictive would not reflect the Potential and might be misleading (there’s a warning about that). Also, I have encountered a case where sampling from the prior worked correctly, but sampling from the prior predictive generates an error (sometimes).
As an alternative, you could call
sample_prior_predictive
and specifyvar_names
, butsample_prior
as a wrapper forsample_prior_predictive
automates the process of identifying unobserved vars and deterministics (that don't depend on observed vars).So I am considering adding
sample_prior
to PyMC. What do we think?📚 Documentation preview 📚: https://pymc--7833.org.readthedocs.build/en/7833/