There are two tests in here.
The first one is to use a test case created by "backward_propagation_test_case(). And, the second one is “backward_propagation_test(backward_propagation)”. It looks like you passed the first one, but failed the 2nd one. So, please check your implementation with the second test.
The test case is in public_tests.py which is in the same directory as a notebook, if you want to see.
Hi! I am having a similar problem with the dw1 value. dW2 and db2 match with the expected value but bW1 don’t so I guess might be a problem with the dZ1 or dW1 formula. But I have been checking against the formula and I can’t find the problem. Can somebody help me with this? Thanks!
Solved, I had a problem with the dZ1 formula. I try using dZ1 = np.dot(W2.T,dZ2) * (1 - np.power(A1,2)), instead of dZ1 = np.dot(W2.T,dZ2) * np.tanh(1 - np.power(A1,2)) and all the tests are passed. But don’t understand where the tanh of the g’(Z) is represented in the correct one. Can anyone explain me this? Thanks
Dear sir,
I have a small question about your answer.
here if I use (1 - np.tanh(Z1) ** 2) to replace (1 - A1**2), is it still correct?
I think they shuld be equal except a little accurate issue generated by tanh function.
That is logically correct, but it doesn’t work here because of the way the test cases are written. They just have random values for Z1 and A1 in the input for the test case, so using the formula based on tanh(Z1) fails the test. I’ve filed a bug about this, but it has not been fixed yet.