Hi,
in this assignment there are two tasks UNQ_C1 to return the cost function and UNQ_C2 to compute the gradient. However, the implementation of UNQ_C1 was correct since the result matches the output but the folllowing warining appears AssertionError: Case 1: Cost must be 0 for a perfect prediction but got 21.067772005.
Concerning UNQ_C2 I do not think there is an error in the code but there unmatching between the output of the exercise and the expected one.
So, if I submit the assignment I get the following error and 0 points: Code Cell UNQ_C1: Unexpected error (IndexError(‘index 3 is out of bounds for axis 0 with size 3’)) occurred during function check. We expected function compute_cost to return cost for perfect prediction must be 0. Please check that this function is defined properly.
*Code Cell UNQ_C2: Unexpected error (IndexError(‘index 3 is out of bounds for axis 0 with size 3’)) occurred during function check. We expected function compute_gradient to return compute_gradient failed expected [2., [0]]. Please check that this function is defined properly. * 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.

Could you please help me to solve this issue?
Thanks

There is sometimes a first test that an answer is revealed in the notebook that you need to match with. There is a second test called the public test that you need to pass also. There is a third test called the private test which will be run through when you submit your assignment. You need to pass all three sets of tests to call your function correct.

The following message indicates that you do not pass the public test.

You may click “File” > “Open” > “public_tests.py” to check out the details of the public tests. For example, the test that you had failed uses the following input arguments:

x = np.array([2, 4, 6, 8]).T
y = np.array([7, 11, 15, 19]).T
initial_w = 2
initial_b = 3.0

They imply a perfect model and thus the test expects your function to produce a zero for the cost value. I suggest you to insert some print lines to keep track of your functions to see which step starts to go wrong.

Thank you for the clarification. I managed to solve the problem. It was related to the code, moreover I found out that indentation can change the output of a value, so it is really tricky.

May I ask you how is it possible to get a result that is quite similar to the expected one despite few decimal points? for instance in Week3 practice lab Course 1 UNQ C3 I get what is represented by the following picture.