 # Reggie linear regression Python 3

Hello,
I am getting a name error and I don’t know why
http://localhost:8888/notebooks/Reggie’s%2BLinear%2BRegression/Reggie_Linear_Regression_Skeleton.ipynb

def calculate_error(m, b, point):
x_point, y_point = point
y = m*x_point + b
distance = abs(y - y_point)
return distance

We can’t see the file you included

And neither can we see the call arguments, but we may assume they are (float, float, tuple of floats).

Myself would have been content to stick with (x, y) for less verbosity. If we know the math, we know the symbols.

``````y = mx + b
``````

where,

``````m = (y2 - y1) / (x2 - x1)
``````

(in framing carpentry this is called rise over run)

and,

``````b = A_CONSTANT
``````

namely, the y-intercept.

What’s throwing me off is the variable `distance`. It should resolve to two vectors, change in y, and change in x. Those values can be resolved to a vector length using the distance formula, which is essentially Pythagorean so that,

``````Delta x squared + Delta y squared all raised to the one-half
``````

equals distance between (x1, y1) and (x2, y2).