Assignment: Planar Data Classification with One Hidden Layer - 4.4 - Compute the Cost

I have used the following code to compute the cost
logprobs = np.log(A2)

I obtain the cost
cost = 0.6926858869721941
whereas the expected value is
cost = 0.6930587610394646

I therefore receive an error message that one test had failed:
Error: Wrong output
1 Tests passed
1 Tests failed

I don’t understand what is wrong with my code.

The code that they give you is not a complete solution: it is just an example of how to vectorize the computation of one of the terms of the cost. Please compare the code you wrote to the math formula for the cost shown just above and ask yourself two questions:

  1. What happened to the factor of \displaystyle \frac {1}{m}?
  2. Why is there only one term? What happened to the Y = 0 term?

If you check the instructions again, you’ll see that they actually tell you that the sample code is not the complete solution.