Problems with Week 3 Practice Lab Logistic Regression. Problem 1:compute_gradient function

This is the first of many problems I had with Week 3 Logistic Regression lab
In cell 13, I defined the compute_gradient function exactly as suggested in the hints, and yet it gives incorrect results:
dj_db at initial w and b (zeros):-0.005050505050504951
dj_dw at initial w and b (zeros):[-0.3766963389152976, -0.4509304870421179]
Expected outputs:
dj_db at initial w and b (zeros) -0.1
dj_dw at initial w and b (zeros): [-12.00921658929115, -11.262842205513591]
Then in cell 15, where the compute_gradient_test function is called, the results are even worse. There is an assertion error on line 53: Wrong value for dj_db. Expected: 0.28936094 got: 0.12443210715916564

And the resulting outputs:
dj_db at test w and b: -0.010101010101010001
dj_dw at test w and b: [-0.7533926778306007, -0.9018609740842394]

Expected outputs:
dj_db at test w and b (non-zeros) -0.5999999999991071
dj_dw at test w and b (non-zeros): [-44.8313536178737957, -44.37384124953978]

I have attached my Jupiter Notebook
I will describe the other issues in subsequent posts
{moderator edit: code removed}

Please don’t post your code on the forum. That’s not allowed by the community standard.

You made three posts on the forum that all relate to this same issue.

To get correct results for predict() and for the decision boundary graph (your other two posts), you first have to get the correct results for compute_gradient().

There’s no reason to post about other errors that occur farther down the notebook until you get the first functions correct.

Did you read the “Hint” material for the compute_gradient() function? I think you will find it useful.

1 Like

Hi, did you read my comments? Yes, I implemented the code EXACTLY as directed in the hints. And my code PASSED the tests. So the problem is not in my code, there is something in their implementation that is wrong. Also, as I pointed out, the code in cell 27 that Coursera provides for the gradient descent, which they say just to run, ALSO does not work properly - the solution does not converge and the decision boundary is way wrong. So please let me know what I can do here. If I can’t post my code, how am I supposed to debug the problem? Thanks

I have replied on your other thread.

How was it resolved? Where is the other thread? I have the same problem!

@Haniyeh_Salehi, please start a new thread for your issue, and provide the full details (but do not post your code).