-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
HalfCauchy, Gamma, Weibull and LogNormal moments #5148
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
Conversation
4d630c4
to
e809a0a
Compare
Codecov Report
@@ Coverage Diff @@
## main #5148 +/- ##
==========================================
+ Coverage 77.82% 77.86% +0.03%
==========================================
Files 88 88
Lines 14145 14165 +20
==========================================
+ Hits 11008 11029 +21
+ Misses 3137 3136 -1
|
pymc/distributions/continuous.py
Outdated
@@ -2100,6 +2106,12 @@ def dist(cls, beta, *args, **kwargs): | |||
assert_negative_support(beta, "beta", "HalfCauchy") | |||
return super().dist([0.0, beta], **kwargs) | |||
|
|||
def get_moment(rv, size, loc, beta): | |||
mean, _ = at.broadcast_arrays(at.as_tensor(0.0, dtype=rv.dtype), beta) |
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.
Does something like this also work?
mean, _ = at.broadcast_arrays(at.as_tensor(0.0, dtype=rv.dtype), beta) | |
mean = at.zeros_like(beta) |
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.
Is zero a good point to start sampling from this distribution?
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.
Looking at V3 I think the median (beta) takes precedence over the mode (0), so we were probably using the former to initialize halfcauchys
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.
Oh, I'll use the median instead then. Maybe we should list the order of preference for the moments in #5078
@lucianopaz seems like pre-commit is failing with import sorting |
e809a0a
to
f5407b1
Compare
Yeah I messed up the pre commit while rebasing the PR. But now everything should be fixed |
👍 |
Add moments and tests for the below distributions as part of #5078