Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Machine Learning by (19k points)

I have trouble understanding the difference (if there is one) between roc_auc_score() and auc() in scikit-learn.

I'm trying to predict a binary output with imbalanced classes (around 1.5% for Y=1).


model_logit = LogisticRegression(class_weight='auto'), Y_train)

Roc curve

false_positive_rate, true_positive_rate, thresholds = roc_curve(Y_test, clf.predict_proba(xtest)[:,1])


auc(false_positive_rate, true_positive_rate)

Out[490]: 0.82338034042531527


roc_auc_score(Y_test, clf.predict(xtest))

Out[493]: 0.75944737191205602

Somebody can explain this difference? I thought both were just calculating the area under the ROC curve. Might be because of the imbalanced dataset but I could not figure out why.


1 Answer

0 votes
by (33.1k points)

You can use a summary writer with different log dir for the training set and cross-validation set respectively.

For example:


Hope this answer helps.

Browse Categories