Skip to content
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

Merged
merged 3 commits into from
Sep 27, 2016
Merged

Fixed issue #838 #895

merged 3 commits into from
Sep 27, 2016

Conversation

markroxor
Copy link
Contributor

Fixed RuntimeWarning: overflow encountered in exp.

Fixed RuntimeWarning: overflow encountered in exp.
if p > 0:
return 1. / (1. + exp(-p))
elif p <= 0:
exp(p) / (1 + exp(p))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it say return?

Copy link
Contributor Author

@markroxor markroxor Sep 27, 2016

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
@tmylk
Copy link
Contributor

tmylk commented Sep 27, 2016

Please add a note in changelog as well

@markroxor
Copy link
Contributor Author

Should I add a new version as well or continue with 0.13.3?

@tmylk
Copy link
Contributor

tmylk commented Sep 27, 2016

0.13.3 is the next release. Please add to it. Thanks

Fixed RuntimeWarning: overflow encountered in exp
@tmylk
Copy link
Contributor

tmylk commented Sep 27, 2016

Thanks for the report and the fix!

@markroxor
Copy link
Contributor Author

Didn't put much of an effort but thanks @tmylk :)

@tmylk tmylk merged commit b276127 into piskvorky:develop Sep 27, 2016
@markroxor markroxor deleted the patch-1 branch October 13, 2016 06:42
return 1. / (1. + exp(-p))
elif p <= 0:
return exp(p) / (1 + exp(p))
else:
Copy link
Owner

@piskvorky piskvorky Oct 30, 2016

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

Copy link
Contributor

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

Copy link
Owner

@piskvorky piskvorky Nov 1, 2016

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants