DLS1 Week4 Deep NN-Application Exercise 1

I get the below error , but when I train the model it is the same as the expected output, could anyone please tell me why such an error shows?

Your code must be incorrect. The cost is a pretty low resolution metric for success. You can examine the test cases to see what they are looking for. Click “File → Open” and then open the file public_tests.py.

Also note that you didn’t show us the most interesting part of the test error message. It will tell you which variable is wrong. It’s the part just above where you started the screenshot.

1 Like

Hi Paul,
Here is the screen shot of the error:

the outputs :
1.parameters is a dictionary and
2. costs is a list as expected ,however, in the test case the parameters are numpy arrays.

But please note that the outputs are a dictionary and a list in the case of an L-layer NN and this gave me a test-set accuracy of 82%.
please help me out in this.

I have converted the individual cost to type np.array now it works

My guess is that you “copy/pasted” your functions from the Step by Step exercise. That is mistake: they provide imported versions for you. In the step by step exercise, the cost function could produce either a scalar or a 1 x 1 array and it wasn’t a problem. But here they expect what their version produces: a 1 x 1 numpy array.


I did paste the code from the previous exercise ,thank you for the help!