-
Notifications
You must be signed in to change notification settings - Fork 34
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
implement mohamed's solution (#12#issuecomment-451416440) #13
Conversation
My editor removed some empty spaces automatically. But I guess it's fine. |
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.
These changes look good to me. Also if you manage to find a reproducible example (with a certain seed) that generates the error in Turing's Travis (or hits the max
with this PR), please file an issue so I can take a closer look.
Also, are these the only log
s we need to worry about?
@xukai92 could the same fix be applied to similar transforms, e.g. |
@@ -276,11 +276,11 @@ function logpdf_with_trans( | |||
|
|||
sum_tmp = zero(eltype(x)) | |||
z = x[1] | |||
lp += log(z + ϵ) + log(one(T) - z + ϵ) | |||
lp += log(max(0, z + ϵ)) + log(max(0, one(T) - z + ϵ)) |
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.
perhaps we can overload log(x)=log(max(0, x))
? This would fix all uses of log
's, e.g. those in univariate distributions with lower / upper bounds.
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.
May be but that would give a stack overflow. _log(x) = log(max(0, x))
would do, replacing all uses of log
with _log
.
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.
Or we'd name it something like logsafe
so that it's more informative?
Closed in favour of #14 |
Resolving #12