Skip to content

Instantly share code, notes, and snippets.

@nmolivo
Created November 28, 2017 15:31
Show Gist options
  • Save nmolivo/8613bc758c21042c333ee581a59a7f15 to your computer and use it in GitHub Desktop.
Save nmolivo/8613bc758c21042c333ee581a59a7f15 to your computer and use it in GitHub Desktop.
Attempt to calculate an R^2 score for LOOCV using cross_val_score
scores = cross_val_score(LinearRegression(), Xr, yr, cv=397, scoring = "r2")
print("Cross-validated scores:", scores)
print("Average: ", scores.mean())
print("Variance: ", np.std(scores))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment