Does the area under ROC curve depends on which class is defined as default positive class by the random forest model?

I am using caret package in R to train and validate a random forest model.


Now predict.rf has two columns representing probability for class 0 and class 1 respectively, which of this column should be used to calculate area under ROC curve.

In current case, By default the tpr is defined by taking class 0 as the positive class. As I understand The ROC curve is a plot between tpr and fpr. Does the ROC curve and AUC change if I define the positive class as 1 and accordingly tpr and fpr will be swapped?


Yes, but it is not relevant in practice, except some very rare cases when class order is somewhat not equivalent to the model (like in one-class SVM).

Exchanging class order simply changes AUROC from $a$ to $1-a$, so anyway your model makes so much sense as AUROC is far from .5. This way it is basically safe to report $1-a$ when $a<.5$, and many AUROC implementations will do this automatically.


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.