3
$\begingroup$

I am experimenting with xgboost.

I ran GridSearchCV with score='roc_auc' on xgboost. The best classificator scored ~0.935 (this is what I read from GS output). But now when I run best classificator on the same data:

roc_auc_score(Y, clf_best_xgb.predict(X))

it gives me score ~0.878

Could you tell me how the score is evaluated in both cases? Thanks

$\endgroup$
2
$\begingroup$

Try using predict_proba instead of predict as below. It should give you the same number.

roc_auc_score(Y, clf_best_xgb.predict_proba(X)[:,1])

When we compute AUC, most of time people will use the probability instead of the actual classs.

$\endgroup$
  • $\begingroup$ Thanks. Also I've slighlty modified it: roc_auc_score(Y, clf_best_xgb.predict_proba(X)[:,1]) $\endgroup$ – tomtom Dec 1 '16 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.