Can you guys tell me what is going wrong with this code?
GRADED FUNCTION: sigmoid_derivative
def sigmoid_derivative(x):
“”"
Compute the gradient (also called the slope or derivative) of the sigmoid function with respect to its input x.
You can store the output of the sigmoid function into variables and then use it to calculate the gradient.
Arguments:
x -- A scalar or numpy array
Return:
ds – Your computed gradient.
“”"
#(≈ 2 lines of code)
# s =
# ds =
# YOUR CODE STARTS HERE
[ Moderator edit: solution code removed as per honor code.]
# YOUR CODE ENDS HERE
return ds
t_x = np.array([1, 2, 3])
print ("sigmoid_derivative(t_x) = " + str(sigmoid_derivative(t_x)))
sigmoid_derivative_test(sigmoid_derivative)
TypeError Traceback (most recent call last)
in
1 t_x = np.array([1, 2, 3])
----> 2 print ("sigmoid_derivative(t_x) = " + str(sigmoid_derivative(t_x)))
3
4 sigmoid_derivative_test(sigmoid_derivative)
in sigmoid_derivative(x)
18
19 s = 1 / (1+ np.exp(-x))
—> 20 ds = s(1-s)
21
22 # YOUR CODE ENDS HERE
TypeError: ‘numpy.ndarray’ object is not callable