Why np.log() got name 'log' is not defined


NameError Traceback (most recent call last)
in
3 X = np.array([[1., -2., -1.], [3., 0.5, -3.2]])
4 Y = np.array([[1, 1, 0]])
----> 5 grads, cost = propagate(w, b, X, Y)
6
7 assert type(grads[“dw”]) == np.ndarray

in propagate(w, b, X, Y)
35 print(A.shape)
36
—> 37 cost = np.sum(Y * np.log(A) + (1 - Y) * log(1 - A)) * (- 1 / m)
38 print(cost)
39 # YOUR CODE ENDS HERE

NameError: name ‘log’ is not defined

=w=b Sorry, found my second log without np

Hi,

I have moved this post to the DLS Course 1 category. Make sure if you have any course-specific doubts, explore the specialization category and post in the relevant course subcategory as course-specific mentors are actively answering the queries there and the threads in the general discussion might not come on their radar and remain unanswered at times.

OK, Thanks a lot for replying ~