Fix independent_rvs
determination in vectorize_over_posterior
#7890
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.
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/