-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fixed log posterior of bounded variables when the value lies near the boundary #4418
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
Codecov Report
@@ Coverage Diff @@
## master #4418 +/- ##
==========================================
- Coverage 88.05% 88.01% -0.04%
==========================================
Files 88 88
Lines 14399 14343 -56
==========================================
- Hits 12679 12624 -55
+ Misses 1720 1719 -1
|
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, thanks @kc611 ! Giving it a few hours before merging, to see what @ColCarroll thinks
Hi @kc611 , Seeing as you have a reproducible snippet of code which fails on |
This solution looks great -- +1 to @MarcoGorelli's suggestion of adding the example as a test. Probably around https://github.com/pymc-devs/pymc3/blob/master/pymc3/tests/test_transforms.py#L197, you would add something like def test_interval_near_boundary():
lb = -1.0
ub = 1e-7
x0 = np.nextafter(ub, lb)
with pm.Model() as model:
pm.Uniform('x', testval=x0, lower=lb, upper=ub)
log_prob = model.check_test_point()
np.testing.assert_allclose(log_prob.values, np.array([-52.68])) |
@MarcoGorelli @ColCarroll Sorry for late reply. I added the tests as requested. |
@kc611 it looks like the tests failed in the CI for float32. You probably are on float64 locally.. You can probably add a |
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.
Thanks @kc611 ! Merging now 🍾
Fix for #3938
Fix sugested by @lcontento over here #3938 (comment)
The following code :
Now returns :
Instead of
-inf
.