-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Infer logp and logcdf of abs of discrete variables #7958
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
base: main
Are you sure you want to change the base?
Conversation
logcdf(x=lower) != -inf
| ndim_supp = value.ndim - input_logprob.ndim | ||
| jacobian = jacobian.sum(axis=tuple(range(-ndim_supp, 0))) | ||
|
|
||
| # Discrete transformations do not need the jacobian adjustment |
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 don't really support any discrete cases with det(jacobian) != 1 but I prefer to have this branch already
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7958 +/- ##
==========================================
- Coverage 91.48% 91.46% -0.02%
==========================================
Files 116 116
Lines 18935 18957 +22
==========================================
+ Hits 17322 17339 +17
- Misses 1613 1618 +5
🚀 New features to boost your workflow:
|
72df5f3 to
474c8b7
Compare
jessegrabowski
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.
I found a typo! I'm helping!
| else: | ||
| x_rv = pt.abs(DiscreteUniform.dist(-4, 4, size=(5,))) | ||
| # |x_rv| = DiscreteUniform(0,4) with P(X=0) halved relative to other values | ||
| # We can use a Categorical to representh this |
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 can use a Categorical to representh this | |
| # We can use a Categorical to represent this |
I was going to work on general icdf(abs(x)) which requires an optimization routine, but found some small crumbs along the way.