Cannot compile code

Hello,
I have tried to submit my week 3 lab coding assignment for over a week now, but it still says that it cannot compile code from the notebook. I have restarted the kernel on multiple occasions. It says all test are passed, except for the following test:

Note: 
Actual values are not checked here in the unit tests (due to random initialization).
w3_unittest.test_initialize_parameters(initialize_parameters)

I am not sure what else to do.

It appears there is a mistake in your initialize_parameters() function. The shape of W is not correct, that’s why it hits that assert.

I’m not a mentor for that course, so I don’t have access to the materials.

That’s weird because the size of W isn’t anything that I changed.

As I said, it’s not my course, but I have to wonder why the function has an assert that checks if W.shape is (n_y,1), when there are parameters for both n_x and n_y.

Hi @Morgan_Fitzgerald.

The bias value should be a vector of shape (n_y, 1). Let me know if there’s still an error after your revision.

@jonrico, it looks to me like the assert is being thrown by the line 16 “W.shape” code.

Hi @TMosh. That’s also what I noticed which is a bit weird. That’s why I asked him to remove all code mistakes first then let me know if there’s still an error message.

@jonrico Hi Johnathan, thanks for getting back to me. I wasn’t sure if you meant that n_y, 1 should be the definition of b or just the shape, but I tried both with n_y and still have the same error.

    ### START CODE HERE ### (~ 2 lines of code)
    W = np.random.randn(n_y, n_x) * 0.01
    b = np.zeros((n_y, 1))
    ### END CODE HERE ###
    
    assert (W.shape == (n_y, 1))
    assert (b.shape == (n_y, 1))

Thank you.

Hi.

Can you tell me the title of the exercise? For example, “Classification with Perceptron” or “Neural Network with Two Layers”

Hi, yes. It is - Programming Assignment: Single Perceptron Neural Networks for Linear Regression.

This is under section 2.2 - Initialize the Model’s Parameters - Exercise 3. Implement the function initialize_parameters()

I see. The error could be from the previous Exercises. Can you download your .ipynb notebook and send it to me privately?

Hi @Morgan_Fitzgerald

Let me know if you need help downloading your .ipynb notebook and sending it privately.

Just sent! Thank you

Thanks!

I just noticed that you might have accidentally edited the assert line:

assert (W.shape == (n_y, 1))

This is not part of the editable code for grading. So in general, you should avoid editing codes outside the “START CODE HERE” and “END CODE HERE” to avoid unnecessary errors.

The original assert line is this:

assert (W.shape == (n_y, n_x))