Implement the sigmoid activation function:
σ(x)=1+e−x1Input: x = [0, 2, -2]
Output: [0.5, 0.88079708, 0.11920292]
Input: x = 0
Output: 0.5
Input: x = [[-1, 0], [1, 2]]
Output: [[0.26894142, 0.5], [0.73105858, 0.88079708]]
Convert the input into a NumPy array so that operations like -x and np.exp(-x) work correctly for scalars, lists, and arrays.
Use np.asarray(x, dtype=float)
Sign in to take notes on this problem
Accepts: any
Implement the sigmoid activation function:
σ(x)=1+e−x1Input: x = [0, 2, -2]
Output: [0.5, 0.88079708, 0.11920292]
Input: x = 0
Output: 0.5
Input: x = [[-1, 0], [1, 2]]
Output: [[0.26894142, 0.5], [0.73105858, 0.88079708]]
Convert the input into a NumPy array so that operations like -x and np.exp(-x) work correctly for scalars, lists, and arrays.
Use np.asarray(x, dtype=float)
Sign in to take notes on this problem
Accepts: any