Exercise 3 - initialize_parameters - I dont understand anything

I am very new to AI and I was hoping that the exercises will be based upon the lectures of the week. I guess they are not. I am now stuck on Exercise 3. I dont even understand what is expected here.

I changed code here

START CODE HERE ### (~ 2 lines of code)

W = np.random.randn(n_x, n_y) * 0.01
b = np.zeros((n_x, n_y))

END CODE HERE

Now when I run
parameters = initialize_parameters(n_x, n_y)
print("W = " + str(parameters[“W”]))
print("b = " + str(parameters[“b”]))

I get error ‘NoneType’ object cannot be interpreted as an integer

So I tried
n_x = 3
n_y = 1
parameters = initialize_parameters(n_x, n_y)
print("W = " + str(parameters[“W”]))
print("b = " + str(parameters[“b”]))

But now I am getting assertion errors. Can someone please explain what is expected here. I am a bit disappointed that the lectures for the week in question do not even touch any of the topics covered in the assignment.

Please help.

In your code here, you have issues with the parameters.
image

Compare your code vs. the information in the doctext. Look at the order of the parameters, and the names of the variables.
image

I really appreciate your help. I guess I messed up by moving around the values trying to get it to run. here is the revised code now.

START CODE HERE ### (~ 2 lines of code)

W = np.random.randn(n_x, n_y) * 0.01
b = np.zeros((n_x, 1))

END CODE HERE

Second code block is
n_x = 1
n_y = 1
parameters = initialize_parameters(n_x, n_y)

print("W = " + str(parameters[“W”]))
print("b = " + str(parameters[“b”]))

I am getting expected values. However, when I run the unit test
w3_unittest.test_initialize_parameters(initialize_parameters)

I am getting

est case “extra_check”. Wrong shape of the weights matrix W.
Expected: (3, 5).
Got: (5, 3).
Test case “extra_check”. Wrong shape of the bias vector b.
Expected: (3, 1).
Got: (5, 1).
Test case “extra_check”. Wrong bias vector b.
Expected:
[[0.]
[0.]
[0.]]
Got:
[[0.]
[0.]
[0.]
[0.]
[0.]]

Any idea what is going wrong here? I printed W and b, both are in (1,1) format.

(Do you think I should do another course before attempting this module? I am new to linear algebra as well as AI)

Aren’t these backward from the doctext instructions?

image

And the shape of b uses n_y, not n_x.

Please read the instructions more carefully.

Thanks, I am trying to reset to start from scratch and unable to find the option to reset everything. I will read the help document again and check.

The best way to start over is to go to the File menu, select Open, then click on the checkbox next to your notebook ipynb file. This will make a red “trash can” icon appear in the menu.

Click on the trash can. This will delete your notebook.

Then use the Help menu, and select the “Get latest version” button. This will give you a new copy of the notebook.

Then double-click on the notebook file name. It should open the notebook in your browser for editing.

Then you can start fresh.

That worked thanks. I was getting unable to call module directly error in the beginning, to get rid of that error I made changes and basically shot myself in the foot.

Now I am stuck on exercise but to be honest i have no understand what I am doing with the earlier questions at all. Do you think I am missing any prerequisite course. I just dont understand what the questions in the lab have to do with the videos of week3 :frowning:

If I recall correctly, the C1 W3 lab notebook doesn’t have much to do with the lectures. I think they were developed by different teams of people who didn’t talk to each other.

The lectures for this lab are in Course 2 at Week 3.

Thanks, I found this course from your team Supervised Machine Learning: Regression and Classification. I think it covers some of the things in this course at a beginner level which is where I am at.

Don’t take that course until you finish the M4ML course.

You will get very confused if you take both courses at once, because M4ML uses different conventions for variable names and methods.

Thanks, I am planning to finish that course and then come back to this one.