Skip to content

Instantly share code, notes, and snippets.

@animesh-agarwal
Last active September 29, 2018 10:24
Show Gist options
  • Save animesh-agarwal/483cb4dc8d1885c6a3462b9814071db1 to your computer and use it in GitHub Desktop.
Save animesh-agarwal/483cb4dc8d1885c6a3462b9814071db1 to your computer and use it in GitHub Desktop.
# sum of square of residuals
ssr = np.sum((y_pred - y_actual)**2)
# total sum of squares
sst = np.sum((y_actual - np.mean(y_actual))**2)
# R2 score
r2_score = 1 - (ssr/sst)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment