Week 2 Exercise 8. Pls help

All the other 8 before this, have passed the tests.


This is the error it is showing. Pls help

So based on the error message, the error seems to be that w and X are not the correct shape.

w.T has a shape of (1, 4), and X has a shape of (2, 3). To fix the error, the second dimension in w.T (4 in this case) must be the same as the first dimension of X (2 in this case).

I don’t see the exact code, but you might want to check what you are passing into initialize_with_zeros() inside your model. You need to use X_train to find the shape/number that needs to be passed in.

I agree with @hackyon.

Unless you’ve modified w or b in some way that you should not have, the problem may go back to initialize_with_zeros().

I’m passing “X_train.shape[0]” into the initialize_with_zeros().

Ok cool, that should be correct.

In that case, the issue is probably in the shape of X. Looking at your error stacktrace, I think you might be passing in the wrong variables into optimize(…).

Specifically, inside the model(…) definition, you want to use X_train/Y_train instead of X/Y, since those were the variables that were passed into the function. The X/Y are likely just global variables defined elsewhere.

i love you, hackyon.

It works. Thank you.