NumPyCNN
NumPyCNN copied to clipboard
sigmoid(sop) function not numerically safe
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))"
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.