-
Notifications
You must be signed in to change notification settings - Fork 242
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
Fixed log_prob
for negative correlation in SineBivariateVonMises
#1515
Fixed log_prob
for negative correlation in SineBivariateVonMises
#1515
Conversation
numpyro/distributions/directional.py
Outdated
@@ -400,7 +400,7 @@ def norm_const(self): | |||
|
|||
fs = ( | |||
lbinoms.reshape(-1, 1) | |||
+ 2 * m * jnp.log(corr) | |||
+ m * jnp.log(corr**2) |
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.
Nice catch! I guess you can clip by tiny here in case users set corr=0?
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.
Sure, that makes sense.
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, Ola! Just a small comment on the floating point.
numpyro/distributions/directional.py
Outdated
+ 2 * m * jnp.log(corr) | ||
- m * jnp.log(4 * jnp.prod(conc, axis=-1)) | ||
fs = lbinoms.reshape(-1, 1) + m * ( | ||
jnp.log(jnp.clip(corr**2, a_min=jnp.finfo(float).tiny)) |
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.
The float finfo is too small for single precision, how about jnp.finfo(jnp.result_type(float)).tiny
?
Removes bias on correlation in
SBvM
normalization and fixesNaN
in normalization for negative correlation (corr < 0.
).From #1511.