Hiya,
Im currently busy with the reggie’s linear regression project. But for some reason I keep bouncing to the “2 positional arguments but 3 were given” error. Even after copy pasting the code from the answer.
This is the code with error:
datapoints = [(1, 2), (2, 0), (3, 4), (4, 4), (5, 3)]
smallest_error = float("inf")
best_m = 0
best_b = 0
for m in possible_ms:
for b in possible_bs:
**error = calculate_all_error(m, b, datapoints)**
if error < smallest_error:
best_m = m
best_b = b
smallest_error = error
print(best_m, best_b, smallest_error)
datapoints = [(1, 2), (2, 0), (3, 4), (4, 4), (5, 3)]
smallest_error = float("inf")
best_m = 0
best_b = 0
for m in possible_ms:
for b in possible_bs:
error = calculate_all_error(m, b, datapoints)
if error < smallest_error:
best_m = m
best_b = b
smallest_error = error
print(best_m, best_b, smallest_error)
TypeError Traceback (most recent call last)
in
6 for m in possible_ms:
7 for b in possible_bs:
----> 8 error = calculate_all_error(m, b, datapoints)
9 if error < smallest_error:
10 best_m = m
TypeError: calculate_all_error() takes 2 positional arguments but 3 were given
Is this just a bug in the project, or am I doing something wrong?