DEV Community

Cover image for Day 4: Area under the ROC
Jamie
Jamie

Posted on

Day 4: Area under the ROC

I actually did this yesterday, but I forgot to post.
House saying oops
Anyway, building on day 3's work on ROC today was all about how to quantify how good a model is. That's where the area under the curve (or AUC) comes in. This will then give you a value. The bigger the value is the better your model.

The code

Once you've got your model (any model), split it into your train and test, then have it making predictions. Then you need to import the AUC and you can run it.
from sklearn.metrics import roc_auc_score
roc_auc_score(y_test, y_pred_prob)

Super easy thing to do

Top comments (2)

Collapse
 
mccurcio profile image
Matt Curcio

And what about showing us the 'R' equivalent? hehe

Collapse
 
jamiedumayne profile image
Jamie

I wish I knew enough to be able to do that 😅