Skip to content

sigmoid(sop) function not numerically safe #13

Open
@jtlareau

Description

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

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions