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
fix default prior variable names #3591
Conversation
I think this is ready to merge. It fixes the issue in the cases I tested locally and I added a test to make sure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of splitting this function into two, why not adding an argument something like include_prior=True
, or include="both"
("prior", "predictive")
pymc3/sampling.py
Outdated
vars = set(model.named_vars.keys()) | ||
vars_ = model.named_vars | ||
prior_pred_vars = model.observed_RVs | ||
prior_vars = get_default_varnames(model.unobserved_RVs, include_transformed=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will exclude potentials (model.potentials)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not know these existed. Should they be included in prior_vars
or prior_pred_vars
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potentials are a way to add arbitrary terms to the computation of the logp. You can use them to add constraints to the model. I will add them to prior_vars
@@ -505,12 +505,14 @@ def test_ignores_observed(self): | |||
observed = np.random.normal(10, 1, size=200) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove unused variable?
Fix #3588. I have also noted that
sample_prior_predictive
samples both the prior and the prior_predictive. Considering how default var names are defined now. It would be quite easy to divide the function in 2, asample_prior
and asample_prior_predictive
but it would be quite a breaking change. Are you interested in dividing the function at all? Would you rather do in now or in some future PR after having added FutureWarnings here?I think the best idea will probably be to make this PR only about fixing #3588 so it can be merged before the discussion about prior and prior predictive. I can send another PR afterwards with whatever is decided.