Datapoints declaration in Reggie's Linear Regression

In part two of the project, the loop doesn’t produce the correct output unless I declare the datapoints list in the same cell (highlit portion of screenshot). If the datapoints list was declared earlier in the project, why does it need to be declared again here? The output at the bottom of the picture shows what results from running the loop without the datapoint declaration.



1 Like

Note that previously, in the frame headed by “Let’s test this function!”, datapoints was redefined to
[(1, 1), (3, 3), (5, 5), (-1, -1)]
… so, yes, you do need to put in datapoints from earlier to get the output they are showing.

This would have been a lot more interesting if a more meaningful set of datapoints had been provided to play around with!


Oh there it is! Right after the calculate_all_error function cell.

Nice work, Patrick. Thanks!

At least it was a good lesson (for me, at least) in keeping track of the current definition of a variable…

1 Like

Yeah, Jupyter notebooks are cumulative!

1 Like