Starting the new year (2023) off with Reggie. But stuck! In Part 1: Step 5, this is my code (which matches the solution given) …
def calculate_all_error(m, b, datapoints):
total_error = 0
for point in datapoints:
point_error = calculate_error(m, b, point)
total_error += point_error
Even after copying and pasting the exact code solution given, I still come up with the following chilling message …
NameError Traceback (most recent call last)
1 #every point in this dataset lies upon y=x, so the total error should be zero:
2 datapoints = [(1, 1), (3, 3), (5, 5), (-1, -1)]
----> 3 print(calculate_all_error(1, 0, datapoints))
5 #every point in this dataset is 1 unit away from y = x + 1, so the total error should be 4:
NameError: name ‘calculate_all_error’ is not defined
Someone please help? I reviewed the code that I had written in, Part 1: Steps 1 and 2, and they look fine and ran cleanly.
Thank you. It will be a happy new year indeed if I can understand what went wrong?