C2_W3_Assignment - Failed Test case

The test case fail for 2nd set of input

A2=[[0.4304596 0.43109421 0.43109413 … 0.43096957 0.43098158 0.4310936 ]]
Y=[[1 1 1 … 1 1 1]]

Test case “default_check”. Wrong output of compute_cost.
Expected:
0.6931477703826823
Got:
0.7019079882932774
[[0.64 0.6 0.35 0.15 0.95]]
[[0.58 0.01 0.42 0.24 0.99]]

1 Tests passed
1 Tests failed

Please help.

Your cost value differs from the value shown and then there are two 1 x 5 vectors shown as part of the output. The cost value should just be a scalar, right?

Problem got resolved by mulitplying the random generator with .01 for w1 and w2. That gave more accurate result

Do you mean that you changed the input values from the test code in order to pass? If that’s what you’re saying, then I think something more serious is wrong. There are not random generator calls in the actual compute cost code, right? It is never a good idea to change the test code.

No I did not change the test code .
Initializing the value of W1 and W2 from random number I multiplied with .01

Somerthing like this
W1 = np.multiply(np.random.randn(n_h, n_x) ,.01)

Ah, ok, the test cases in this assignment are pretty weak. They actually use the output of the previous functions as the test inputs for compute_cost. And the test for the initialize_parameters function does not check the actual output values, only their shape. The tests could be improved by setting the random seeds in each test and then they could actually check the values. I will file a bug about that.