Hey,
Towards the end of the project (I don’t know what I’m supposed to do in this exercise, but when I compared my code to the solution it was pretty much the same (except for a variable that I omitted)), I’ve created this code as instructed, but it returns a TypeError when I run it.
smallest_error = float("inf")
best_m = 0
best_b = 0
for m in possible_ms:
for b in possible_bs:
if calculate_all_error(m,b,datapoints) < smallest_error:
best_m = m
best_b = b
smallest_error = datapoints
print(best_m,best_b,smallest_error)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-59-47ada9e8be36> in <module>()
5 for m in possible_ms:
6 for b in possible_bs:
----> 7 if calculate_all_error(m,b,datapoints) < smallest_error:
8 best_m = m
9 best_b = b
TypeError: unorderable types: float() < list()
I appreciate that these errors may arise from something I’ve done prior to this part of the exercise, but when comparing my code to the solution I cannot pinpoint the actual cause. Here’s a link to my full notebook:
https://notebooks.azure.com/Twan4188/projects/Reggie
Thanks,
Twan