Assertion error in C1_W2_Linear_Regression

Please find the attached snapshot

you can find that the expected output (Cost at initial w: 75.203) is matching with the out put from the program. However, it is throwing assertion error that cost must be zero for correct prediction. Then I checked the compute_cost_test(target) code from “Public tests.py” file. I used the same inputs to run the program in my local compiler and it is perfectly returning “0” for cost value. If the expected output is coming correct then why it is not returning zero for the sample data set in compute_cost_test() function.

I have attached the exercise 2 output as well. It is also facing the same error. Pls help me with this error.

The issue is that your functions do not work correctly.

Please note that you posted this in the wrong category. I’ve moved your post to the MLS.

It is giving correct output for the inputs given in the exercise (cost at initial w: 75.02). Then the function is working correctly right? However, it is not working properly for the sample inputs given in “compute_cost_test(target)”. How is this possible?. Please help me with what I can do.

Your code must work correctly for all possible sets of data and conditions.

It is not working. can you tell me how I can complete my assessment successfully.

Double-check how you are implementing the compute_gradient function, especially dj_db. Check hints and more hints below that cell. The compute_cost_test(target) only calls your own compute_cost function.