I have a problem with W2, exercise 5, calculating the cost. I tried cost = Y-A, ad\nd cost =y log(a) + (1-y) log (1-y). Neither form works. please advise. Thanks

It would be helpful if you include the name of the notebook file - most weeks of the DLS course have several programming assignments.

I presume this is “Logistic regression with a neural network mindset”, Exercise 5 “propagate”?

Cost is given by the equation I’ve noted with brackets.

You can use the np.dot() and np.log() functions to implement this. The dot products will compute the sums.