-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add Hurdle distributions #6688
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
Add Hurdle distributions #6688
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
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 functionality-wise.
In terms of organization, since there are two things going on, can I ask you to clean the git history and separate the move stuff around
and implement hurdle models
into two distinct commits?
pymc/distributions/distribution.py
Outdated
class Constant: | ||
def __new__(cls, *args, **kwargs): | ||
warnings.warn( | ||
"pm.Constant has been deprecated. Use pm.DiracDelta instead.", | ||
FutureWarning, | ||
) | ||
return DiracDelta(*args, **kwargs) | ||
|
||
@classmethod | ||
def dist(cls, *args, **kwargs): | ||
warnings.warn( | ||
"pm.Constant has been deprecated. Use pm.DiracDelta instead.", | ||
FutureWarning, | ||
) | ||
return DiracDelta.dist(*args, **kwargs) |
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.
Good time as any to remove it
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.
Done :)
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6688 +/- ##
==========================================
+ Coverage 89.50% 91.99% +2.49%
==========================================
Files 94 95 +1
Lines 15942 16162 +220
==========================================
+ Hits 14269 14869 +600
+ Misses 1673 1293 -380
|
5862523
to
1575381
Compare
1575381
to
ea37eb3
Compare
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 should remove the notebooks (right?)
There seem to be some conflict lines <<<<
in the intermediate commits. It probably makes things easier for you to 1) remove Constant, 2) Move things around, 3) Implement the new stuff, in that order.
Let me know if you want me to do it instead.
Everything else 👌
I thought they were completely removed. I expected them to be caught by the linting tools. It seems I was wrong.
I would appreciate it a lot :D |
And its correct to remove the notebooks? |
Yes, my bad. It was something I created to see how it worked. But it's not needed. |
0ae391c
to
47789b8
Compare
47789b8
to
8f13b05
Compare
ZeroInflated to mixture.py DiracDelta to distribution.py
8f13b05
to
be27167
Compare
What is this PR about?
Implements four hurdle distributions. These are like zero-inflated distributions, but the process that generates the zeroes is independent of the process that generates the non-zero values (in zero-inflated distributions the zeros can come from the two distinct processes).
These distributions are added in
distributions/mixture.py
. To do so, I had to move a couple of things aroundDiracDelta
is part ofdistributions/distribution.py
distributions/mixture.py
distributions/mixture.py
as wellDiracDelta
and zero-inflated distributions to their respective placesThere's a
hurdle.ipynb
notebook. My goal is not to merge it into the repository (it's in a very bad place). But I think it can be useful if you want to see how these distributions work.My end goal is to add hurdle families to Bambi and I think it would be better to have these distributions implemented and tested in PyMC rather than as something that only lives within Bambi.
Checklist
New features
HurdlePoisson
,HurdleNegativeBinomial
,HurdleGamma
, andHurdleLogNormal
).Maintenance
DiracDelta
todistributions/distribution.py
distributions/mixture.py
pm.Constant
Edit: @ricardoV94