-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix independent_rvs
determination in vectorize_over_posterior
#7890
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7890 +/- ##
=======================================
Coverage 92.94% 92.94%
=======================================
Files 116 116
Lines 18851 18851
=======================================
+ Hits 17521 17522 +1
+ Misses 1330 1329 -1
🚀 New features to boost your workflow:
|
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.
Looks good, some small comments
and not ({*outputs, *independent_rvs} & set(rv_ancestors)) | ||
and {var for var in rv_ancestors if var in all_rvs} <= {rv, *needed_rvs} | ||
if rv not in needed_rvs and not ( | ||
{*outputs, *needed_rvs, *independent_rvs} & set(rv_ancestors) |
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.
outputs / needed_rvs / independent_rvs are also the blockers
store than in an intermediate variable?
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.
filter rv not in needed_rvs
already in the list comp that starts this loop?
a_ancestor1 = get_var_by_name([vectorized_no_intermediate], "a")[0] | ||
a_ancestor2 = get_var_by_name([vectorized_intermediate_rvs], "a")[0] |
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.
Assuming there should only be one match:
a_ancestor1 = get_var_by_name([vectorized_no_intermediate], "a")[0] | |
a_ancestor2 = get_var_by_name([vectorized_intermediate_rvs], "a")[0] | |
[a_ancestor1] = get_var_by_name([vectorized_no_intermediate], "a") | |
[a_ancestor2] = get_var_by_name([vectorized_intermediate_rvs], "a") |
Description
This PR fixes the determination of
independent_rvs
RVs invectorize_over_posterior
. I think that the fixed check is much clearer now. It says that anrv
is independent if it doesn't depend on anoutput
, aneeded_rv
(a model freeRV that is replaced by its posterior samples), or anotherindependent_rv
. To make sure the check works correctly, the candidate rv nodes are searched in the order given by their topological sort.Related Issue
vectorize_over_posterior
fails to determineindependent_rvs
#7889Checklist
Type of change
📚 Documentation preview 📚: https://pymc--7890.org.readthedocs.build/en/7890/