Hi @paulinpaloalto , @Rashmi
Now I have changed the code
W1 = np.random.rand(n_h, n_x)*0.01
b1 = (np.zeros((n_h,1)))
where n_h = n[1] and n_x = n[0]
So, the initialization has the following values for W1 when called for the test method
[[0.00435995 0.00025926 0.00549662]
[0.00435322 0.00420368 0.00330335]
[0.00204649 0.00619271 0.00299655]
[0.00266827 0.00621134 0.00529142]
[0.0013458 0.00513578 0.0018444 ]]
with
n_x → 3
n_h – > 5
n_y —> 2
But the expected value is
W1 = [[-0.00416758 -0.00056267]
[-0.02136196 0.01640271]
[-0.01793436 -0.00841747]
[ 0.00502881 -0.01245288]]
which is 2X4 array
I am getting the below error now
~/work/release/W3A1/public_tests.py in initialize_parameters_test(target)
57 assert parameters["b2"].shape == expected_output["b2"].shape, f"Wrong shape for b2."
58
---> 59 assert np.allclose(parameters["W1"], expected_output["W1"]), "Wrong values for W1"
60 assert np.allclose(parameters["b1"], expected_output["b1"]), "Wrong values for b1"
61 assert np.allclose(parameters["W2"], expected_output["W2"]), "Wrong values for W2"
AssertionError: Wrong values for W1
The expected value in the test cases are
expected_output = {'W1': np.array(
[[-0.00416758, -0.00056267, -0.02136196],
[ 0.01640271, -0.01793436, -0.00841747],
[ 0.00502881, -0.01245288, -0.01057952],
[-0.00909008, 0.00551454, 0.02292208],
[ 0.00041539, -0.01117925, 0.00539058]]),
'b1': np.array([[0.], [0.], [0.], [0.], [0.]]),
'W2': np.array([[-5.96159700e-03, -1.91304965e-04, 1.17500122e-02,
-7.47870949e-03, 9.02525097e-05],
[-8.78107893e-03, -1.56434170e-03, 2.56570452e-03,
-9.88779049e-03, -3.38821966e-03]]),
'b2': np.array([[0.], [0.]])}
But the value created by the method, does not match. Value created by the method
are
W1 = [[0.00435995 0.00025926 0.00549662]
[0.00435322 0.00420368 0.00330335]
[0.00204649 0.00619271 0.00299655]
[0.00266827 0.00621134 0.00529142]
[0.0013458 0.00513578 0.0018444 ]]
b1 = [[0.]
[0.]
[0.]
[0.]
[0.]]
W2 = [[0.00785335 0.00853975 0.00494237 0.00846561 0.00079645]
[0.00505246 0.00065287 0.00428122 0.00096531 0.0012716 ]]
b2 = [[0.]
[0.]]
Can you please check if I am doing something wrong?