Course1/Week 2/Practice Lab/Linear Regression/Precision Error

Specialization, Course 1, Week 2, Practice Lab, Linear Regression

i am "almost’ getting the desired answer.
Any suggestions welcome.

Thanks.

This line: from the error report (quoted below) tells me it’s a precision error of 10^-18.

“AssertionError: Case 1: Cost must be 0 for a perfect prediction but got 3.0752959060584503e-18”

<class ‘numpy.float64’>
Cost at initial w (zeros): 0.000
Total Cost: 3.0752959060584503e-18

AssertionError Traceback (most recent call last)
in
9 # Public tests
10 from public_tests import *
—> 11 compute_cost_test(compute_cost)

~/work/public_tests.py in compute_cost_test(target)
9 initial_b = 3.0
10 cost = target(x, y, initial_w, initial_b)
—> 11 assert cost == 0, f"Case 1: Cost must be 0 for a perfect prediction but got {cost}"
12
13 # Case 2

AssertionError: Case 1: Cost must be 0 for a perfect prediction but got 3.0752959060584503e-18

EDIT:
**Ok. Got it. Problem solved. My mistake, of course. **
Hints at bottom of the exercise pointed me to the solution.

1 Like

No better feeling than solving the problem without any outside help - Keep Rolling!!