-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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 issue #838 #895
Fixed issue #838 #895
Conversation
Fixed RuntimeWarning: overflow encountered in exp.
if p > 0: | ||
return 1. / (1. + exp(-p)) | ||
elif p <= 0: | ||
exp(p) / (1 + exp(p)) |
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.
Should it say return?
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.
That's embarrassing, forgot to return in all the haste. Fixing this PR.
Fixed RuntimeWarning: overflow encountered in exp
Please add a note in changelog as well |
Should I add a new version as well or continue with 0.13.3? |
0.13.3 is the next release. Please add to it. Thanks |
Fixed RuntimeWarning: overflow encountered in exp
Thanks for the report and the fix! |
Didn't put much of an effort but thanks @tmylk :) |
return 1. / (1. + exp(-p)) | ||
elif p <= 0: | ||
return exp(p) / (1 + exp(p)) | ||
else: |
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.
What is this entire if
for?
The logic seems obscure (why branch at all? needs at least a comment) and weird (what is the else
for?). @tmylk
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.
@markroxor Please remove else and add comment explaining #838
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 suggest replacing the whole function with scipy.special.expit
. Should be faster too (C code).
Fixed RuntimeWarning: overflow encountered in exp.