A linear score can be any real number, but a binary prediction needs a value that can be read as confidence for one of two outcomes. Sigmoid converts scores to that probability-like scale while retaining their ordering. This implementation also has to survive scores too extreme for a direct exponential.
Implement sigmoid(z) elementwise. Theory gives the transform; the implementation first bounds the input so its exponential remains finite.
z may have any NumPy array shape; preserve that shape.z.0.5 for zero.z to [-500, 500] before exponentiating.Open one at a time. Each gives away a little more than the last.
The transform is applied independently to every element, so NumPy already provides the iteration.
Clamp the raw scores before using the exponential; a negative raw score becomes a positive exponent argument.
No results yet
Run your code to check it against the examples, or submit to run every test.