-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Allow non-scalar measurable switch mixtures #6796
Allow non-scalar measurable switch mixtures #6796
Conversation
008e3b0
to
2441185
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6796 +/- ##
==========================================
- Coverage 91.92% 88.22% -3.71%
==========================================
Files 95 95
Lines 16197 16233 +36
==========================================
- Hits 14889 14321 -568
- Misses 1308 1912 +604
|
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.
As always, looks great @ricardoV94 😅 As usual, some questions from my side
|
||
invalid_mix = pt.switch(valid_switch_cond, valid_true_branch, invalid_false_branch) | ||
fgraph, _, _ = construct_ir_fgraph({invalid_mix: invalid_mix.type()}) | ||
assert not isinstance(fgraph.outputs[0].owner.op, MeasurableVariable) |
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.
Would it be more clear to rename the fgraph
s and invalid_mix
es in this test?
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.
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.
On a second thought... rename to what? I feel the names are pretty reasonable?
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.
Ah, I was just alluding to the redundancy in names (three presences of fgraph
, two of invalid_mix
).
2441185
to
9f65891
Compare
|
||
invalid_mix = pt.switch(valid_switch_cond, valid_true_branch, invalid_false_branch) | ||
fgraph, _, _ = construct_ir_fgraph({invalid_mix: invalid_mix.type()}) | ||
assert not isinstance(fgraph.outputs[0].owner.op, MeasurableVariable) |
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.
Ah, I was just alluding to the redundancy in names (three presences of fgraph
, two of invalid_mix
).
9f65891
to
df9f1b8
Compare
This PR expands the supported Mixture graphs beyond the scalar case.
It comes at the cost of not creating a lazy evaluation logp graph that the old MixtureRV approach did, but benefits from allowing arbitrary measurable variables and not just pure RVs.
In a future PR I intend to introduce a lazy Mixture RV that brings back that functionality, but that's right now blocked by pymc-devs/pytensor#329
CC @shreyas3156
📚 Documentation preview 📚: https://pymc--6796.org.readthedocs.build/en/6796/