I fail in In 93 def initialize_parameters(n_x, n_h, n_y)
def initialize_parameters(n_x, n_h, n_y):
“”"
Argument:
n_x – size of the input layer
n_h – size of the hidden layer
n_y – size of the output layer
Returns:
parameters -- python dictionary containing your parameters:
W1 -- weight matrix of shape (n_h, n_x)
b1 -- bias vector of shape (n_h, 1)
W2 -- weight matrix of shape (n_y, n_h)
b2 -- bias vector of shape (n_y, 1)
"""
np.random.seed(1)
#(≈ 4 lines of code)
# W1 = ...
# b1 = ...
# W2 = ...
# b2 = ...
# YOUR CODE STARTS HERE
W1 = np.random.rand(n_h, n_x)*0.01
#print("Mark 1 W1="+str(W1))
b1 = np.zeros([n_h, 1])
W2 = np.random.rand(n_y, n_h)*0.01
#print("Mark 2 W2="+str(W2))
b2 = np.zeros([n_y, 1])
# YOUR CODE ENDS HERE
parameters = {"W1": W1,
"b1": b1,
"W2": W2,
"b2": b2}
return parameters
The output is this.
Test Case 1:
W1 = [[4.17022005e-03 7.20324493e-03 1.14374817e-06]
[3.02332573e-03 1.46755891e-03 9.23385948e-04]]
b1 = [[0.]
[0.]]
W2 = [[0.0018626 0.00345561]]
b2 = [[0.]]
Error: Wrong output for variable W1.
Error: Wrong output for variable W2.
1 Tests passed
1 Tests failed