1st TEST /Part 5 - Exercise 2 /

I passed all other weeks but this one / not sure why i am getting this error? this is my code which WORKS above but in this one

np.random.seed(3)               # This seed makes sure your "random" numbers will be the as ours
    parameters = {}
    L = len(layers_dims)            # integer representing the number of layers
    
    for l in range(1, L):
        #(≈ 2 lines of code)
        # parameters['W' + str(l)] = 
        # parameters['b' + str(l)] =
        # YOUR CODE STARTS HERE

        # moderator edit; code removed

        # YOUR CODE ENDS HERE

    return parameters

why do i get this ERROR???
W2 = [[-0.00082741 -0.00627001]]
b2 = [[0.]]
2 Tests passed
1 Tests failed

AssertionError Traceback (most recent call last)
in
4 print("W2 = " + str(parameters[“W2”]))
5 print("b2 = " + str(parameters[“b2”]))
----> 6 initialize_parameters_random_test(initialize_parameters_random)

~/work/release/W1A1/public_tests.py in initialize_parameters_random_test(target)
65 ]
66
—> 67 multiple_test(test_cases, target)
68
69 def initialize_parameters_he_test(target):

/opt/conda/lib/python3.7/site-packages/dlai_tools/testing_utils.py in multiple_test(test_cases, target)
162 print(‘\033[91m’, len(test_cases) - success, " Tests failed")
163 raise AssertionError(
→ 164 “Not all tests were passed for {}. Check your equations and avoid using global variables inside the function.”.format(target.name))

AssertionError: Not all tests were passed for initialize_parameters_random. Check your equations and avoid using global variables inside the function.

1 Like

First, sharing your code is not allowed by the community code of conduct. So, avoid sharing code.

Regarding the error, your code is incorrect. And, why you are using ** at the end of your code? Please double-check the instructions given to you:

Exercise 2 - initialize_parameters_random

Implement the following function to initialize your weights to large random values (scaled by *10) and your biases to zeros. Use np.random.randn(..,..) * 10 for weights and np.zeros((.., ..)) for biases. You’re using a fixed np.random.seed(..) to make sure your “random” weights match ours, so don’t worry if running your code several times always gives you the same initial values for the parameters.

1 Like

Also note that it looks like you just copied the code from the Course 1 Week 4 assignment and used the scaling factor of 0.01. Saif’s advice to read the instructions more carefully is key. They are pretty clear and essentially write the code out for you. The scaling factor specified is not 0.01, right?

1 Like