Skip to content

Instantly share code, notes, and snippets.

@aialenti
Last active February 12, 2020 21:28
Show Gist options
  • Save aialenti/773066cb160d771ecc4b1140887a6246 to your computer and use it in GitHub Desktop.
Save aialenti/773066cb160d771ecc4b1140887a6246 to your computer and use it in GitHub Desktop.
from sklearn.metrics import r2_score
def xgb_r2_score(preds, dtrain):
labels = dtrain.get_label()
return 'r2', r2_score(labels, preds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment