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

sigmoid(sop) function not numerically safe #13

Open
jtlareau opened this issue Oct 8, 2022 · 1 comment
Open

sigmoid(sop) function not numerically safe #13

jtlareau opened this issue Oct 8, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@jtlareau
Copy link

jtlareau commented Oct 8, 2022

The current implementation of the sigmoid() function can get a RuntimeWarning overflow in cnn.py at line 29 numpy.exp():
"return 1.0 / (1 + numpy.exp(-1 * sop))"
To avoid/correct the overflow, use:
"return numpy.exp(-numpy.logaddexp(0, -sop))"

@ahmedfgad
Copy link
Owner

It is just a warning and NumPy is able to handle the situation. It happens when a large number like 1234.1234 is fed to the numpy.exp() function. This does not affect the result.

@ahmedfgad ahmedfgad added the bug Something isn't working label Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants