Skip to content

Instantly share code, notes, and snippets.

@RobotGyal
Created May 27, 2020 22:17
Show Gist options
  • Save RobotGyal/f89bc4f3e95fce3345257cb0d2a8ae57 to your computer and use it in GitHub Desktop.
Save RobotGyal/f89bc4f3e95fce3345257cb0d2a8ae57 to your computer and use it in GitHub Desktop.
def min_sq_error(y, x, w1, w0):
y_pred = [w1*i+w0 for i in x]
sum_squared_error = sum((y_pred-y)**2)
N = len(y)
mse = sum_squared_error/N
return mse
print("MSE via my calculations: ", min_sq_error(y, x, 0.05034768176424329, 0.6504410345649969))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment