Code correct, but getting zero in the assignment

Course Name: Supervised Machine Learning: Regression and Classification
Week: 2

Currently working on Week 2 Practice Lab.

I have made multiple submissions for the same assignment. My solution appears correct, as I am not getting any error with the assertion in the following cells. I have also added an image to show that my result aligns with the expected result.

However, I keep getting the below error while submitting the assignment.

“Code Cell UNQ_C1: Function ‘compute_cost’ is incorrect. Check implementation.
Code Cell UNQ_C2: Function ‘compute_gradient’ is incorrect. Check implementation.
If you see many functions being marked as incorrect, try to trace back your steps & identify if there is an incorrect function that is being used in other steps.
This dependency may be the cause of the errors.”

Please note that I have not deleted any comments, or moved the text in the cells.

Request your help to understand what I am doing wrong.


The unit tests in the notebook don’t prove your code is correct. The grader uses a different test case, your code must work correctly for that also.

The most common problem with this assignment is if your code for compute_cost() uses some global variable from the notebook instead of using the parameters that are passed to it.

Dear mentor,

Thank you for your reply. I get what you are saying.

I have posted the code for 1 of the 2 functions that we are expected to write in this assignment.
Please note the my earlier submission had an implementation that involved the use of vectorized product. However, unsure of the code expectation, I now submitted a code very similar to what we have in the optional lab for Linear Regression.

This attachment contains my latest submission for “compute_cost”, and also, the remark I received from the autograder.

Request you to share some more information on the same. Many thanks for your help in advance.

The issue is now resolved for me.

I submitted the lab from another browser on another internet network, and I was able to clear it successfully.

Thanks again for your time.