Course 1 week 2 last assignment

Unable to resolve this error kindly help

[Moderator edit: Solution code removed.]

Hi, @Rajat_Modi. I’m interested in what you think is going on. :thinking: Please study the traceback.

From that, at first site, it appears that the problem originates in the predict() function, but in a line of code that was supplied to you:

w = w.reshape(X.shape[0], 1)

The ValueError indicates that the weight matrix, which is 2 \times 1 (look at the test cell where w, b, and X, are defined) cannot be reshaped into a 4 \times 1 matrix. It certainly cannot. Not enough values to go around.

Looks like your X input to your predict function may be at fault. Have you hard-coded any values?

Note: You are not allowed to post your code in the Discourse forum. I runs afoul of the Coursera honor code. In other words, it is cheating–straight-up.


Thanks for your reply.
I am attaching a few more screenshots of the function where i initialise w and b.
I am also getting an error on this and unable to understand this particular error.
I am not getting any errors in Predict function and it shows all tests passed.
Can the initialize with zeros function be the reason for this error?


[Moderator edit: Solution code removed.]

Please note well: I have had to remove your solution code … again. Please see my Note in the previous post. Thank you for your future compliance to the Coursera course honor code.

As for your bug, see my post from just earlier today. It is the second from bottom.

Respected Sir,

I apologise for the violation as I did not intend to break the honor code and I will make sure it doesn’t happen again.
As for the error, it is fixed now.

Thanks for your help.

Thanks, Rajat! --Ken