Sigmoid Function
Beginner classical-mlclassificationactivations
Implement:
def sigmoid(z: np.ndarray) -> np.ndarray:
"""
z: any shape of real numbers.
Returns elementwise sigmoid, same shape as z, values strictly in (0, 1).
"""
Your function should:
- Work elementwise on arrays of any shape.
- Never overflow or return
nan, even for very large |z|.
- Return exactly
0.5 when z = 0.