Programming Exercise Week 2 - Exercise 8 - model

I passed all the above exercise but got an error on this exercise can anyone help
{moderator edit: code removed}

This is the code and having an error

Please don’t post your code. That’s not allowed by the Code of Conduct. Posting your error message is fine.

Hello Hassan,

Your written code is incorrect for A as you need to apply the sigmoid function from the exercise cell 3 in the propagate exercise cell 5.

Your cost function uses keep dims and axis (which is incorrect) but you did not pass it for your optimize exercise cell 6 causing the dim 1=dim0 error.
Also there are some tuple error in the cost code lines which you need to address.

Kindly go back from starting see where all you could do the corrections. your error logs always tells a lot of hints in correcting your code lines.

And yes, kindly share the error screenshot only which in your case you have done but it gives a lot glimpse in your code lines as it needs correction.

Regards
DP

But if the propagate code passed its test cases, that can’t be the problem. The propagate code looks like it is way more complicated than it needs to be, but it’s not incorrect.

The problems are in the model logic. The w value turns out to be the wrong size, so how could that happen? Notice that it matches the column dimension of the input X_train, instead of matching the number of rows. Where in the model logic is that dimension determined?

Also note that the failing code you show is the actual training, but there was a specific smaller test case for the model function before that. What happened when you ran that cell?

Also note that once you fix that bug, you’ll then hit the next set of problems. Ask yourself what learning rate and number of iterations values will actually get used in optimize? Will they match the values being requested by the test case? :nerd_face: