AUROC
Study guide: Exam MAS-II
The AUROC is the area under the receiver operating characteristic (ROC) curve of a binary classifier. The ROC curve plots the sensitivity (vertical axis) against 1 - specificity (horizontal axis) of the confusion matrix, one point for each discrimination threshold. Joining the points with straight lines, the area is a sum of trapezoids:
\text{AUROC} = \sum_{j=1}^{J}\frac{1}{2}\left(x_j - x_{j-1}\right)\left(y_{j-1} + y_j\right)
x_jis1 -specificity andy_jthe sensitivity at thejth threshold, taken from highest to lowest.x_0 = y_0 = 0.
A threshold above every predicted probability flags nothing and gives the point (0, 0). A threshold below every predicted probability flags everything and gives (1, 1). Lowering the threshold past each predicted value in turn, from highest to lowest, gives the points between.
Six holdout observations have predicted probabilities
0.9,0.7,0.6,0.4,0.3and0.1, and actual outcomes1,0,1,0,1,0. What is the AUROC?
- There are 3 positives and 3 negatives, so each positive moves the curve up
1/3and each negative moves it right1/3.- From the highest score down, the points are
(0, \tfrac13),(\tfrac13, \tfrac13),(\tfrac13, \tfrac23),(\tfrac23, \tfrac23),(\tfrac23, 1)and(1, 1).- Only the three moves to the right have area under them:
\tfrac13 \cdot \tfrac13 + \tfrac13 \cdot \tfrac23 + \tfrac13 \cdot 1 = \tfrac69.- The AUROC is
0.667.
AUROC as a ranking probability
The AUROC is the probability that the model gives a randomly chosen actual positive a higher score than a randomly chosen actual negative, a tie counting half. Grouping the observations by predicted value from highest to lowest, it is
\text{AUROC} = \frac{1}{2NP}\sum_{i=1}^{I} n_i\left(c_{i-1} + c_i\right)
NandPare the numbers of actual negatives and positives.n_iis the number of negatives in groupi, andc_ithe cumulative number of positives through groupi, withc_0 = 0.
For the six observations above, what is the AUROC by the counting formula?
- The groups with a negative are
0.7(c = 1before and after),0.4(c = 2) and0.1(c = 3).- The sum is
1(1 + 1) + 1(2 + 2) + 1(3 + 3) = 12.- The AUROC is
12/(2 \times 3 \times 3) = 0.667. Each positive is ranked above3,2and1negatives,6of the9pairs.
Reading the AUROC
A model with no predictive power has an ROC curve along the line of equality from (0, 0) to (1, 1), and an AUROC of 0.5. A perfect model's curve rises straight to (0, 1) and runs across to (1, 1), with an AUROC of 1. The AUROC summarizes every threshold at once, which makes it useful for comparing classifiers. The threshold itself is a business decision weighing true positives against the cost of false positives. The AUROC is tied to the normalized Gini index:
\text{normalized Gini} = 2 \times \text{AUROC} - 1
- The normalized Gini is the model's Gini index divided by that of a perfect model.
So the two should not be taken as separate validation measures.
Fraud model A has an AUROC of
0.85and model B of0.72. What are their normalized Gini indices, and which is better?
- Model A's normalized Gini is
2(0.85) - 1 = 0.70.- Model B's is
2(0.72) - 1 = 0.44.- Model A ranks a fraudulent claim above a legitimate one 85% of the time against 72% for B, so A is better.