- Notifications
You must be signed in to change notification settings - Fork2.2k
Implement specialized Hurdle distribution#7810
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
77ed668 to9c65ca1Compare3d5772c tobdb3f12Compareac73b55 to9a65487Compare| dist | ||
| fordistindists | ||
| if ( | ||
| getattr(dist,"rv_type",None)isnotNone |
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 was too restrictive, a subclass also inherits the dispatch function, and need not be in the registry explicitly
codecovbot commentedJun 4, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #7810 +/- ##======================================= Coverage 92.88% 92.88% ======================================= Files 107 107 Lines 18377 18389 +12 =======================================+ Hits 17069 17081 +12 Misses 1308 1308
🚀 New features to boost your workflow:
|
Uh oh!
There was an error while loading.Please reload this page.
zwelitunyiswa commentedJun 4, 2025
@ricardoV94 This is amazing. Thank you so much for this! |
zaxtax left a comment
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.
LGTM! We should probably add a test similar to one that motivate this PR in the first class
ricardoV94 commentedJun 5, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
We have the pre-existing hurdlesl tests, in a sense this is just a refactor/optimization. Can't think of anything |
zaxtax commentedJun 5, 2025
What caused the error originally reported here?pymc-devs/nutpie#163 Does that have a test already? |
ricardoV94 commentedJun 5, 2025
That was fixed sometime ago in PyTensor:pymc-devs/pytensor#1137 The performance question when in numba is addressed bypymc-devs/pytensor#1445 Neither is PyMC specific |
zaxtax commentedJun 6, 2025
Feel free to merge whenever you feel comfortable! I think it's good to go |
lucianopaz left a comment
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 to me. I just left two very minor comments
Uh oh!
There was an error while loading.Please reload this page.
| ) | ||
| returnmix_logp | ||
| mix_support_point=pt.sum(weights*support_point_components,axis=mix_axis) |
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.
Why not use the logsumexp and have log scale weights here? Is it because the weights are already in the 0-1 range and taking the log won’t help with precision?
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.
We're not computing any log quantities nor starting with any log quantities so I don't think it would help. Also the initial point is not so critical?
This does not require the arbitrary truncation of continuous distribution in the logp/logcdf
0f1bfa9 intopymc-devs:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
It indirectly addresses the issue reported in inpymc-devs/nutpie#163
The new objects have a logp that handles the discrete + continuous process correctly, without requiring the arbitrary truncation of the latter at epsilon. This provides a cheaper and more stable logp / logcdf.
For discrete variables we keep using a truncation
Also added special logic to truncate a Hurdle distribution which solvesbambinos/bambi#768, this is not the desired behavior, reverted itCC@zwelitunyiswa
📚 Documentation preview 📚:https://pymc--7810.org.readthedocs.build/en/7810/