Searched high and low and have not been able to find out what AUC, as in related to prediction, stands for or means.

  • 7
    Check the description of auc tag you used: stats.stackexchange.com/questions/tagged/auc – Tim Jan 9 '15 at 10:50
  • 4
    Area Under the Curve (i.e., ROC curve) – Andrej Jan 9 '15 at 11:02
  • 7
    Readers here may also be interested in the following thread: Understanding ROC curve. – gung Jan 9 '15 at 21:23
  • 10
    The expression "Searched high and low" is interesting since you can find plenty of excellent definitions/uses for AUC by typing "AUC" or "AUC statistics" into google. Appropriate question of course, but that statement just caught me off guard! – Behacad Jan 9 '15 at 23:03
  • 3
    I did Google AUC but a lot of the top results didn't explicitly state AUC = Area Under Curve. The first Wikipedia page related to it does have it but not until half way down. In retrospect it does seem rather obvious! Thank you all for some really detailed answers – josh Jan 12 '15 at 12:13
up vote 249 down vote accepted
+50

Abbreviations

AUC is used most of the time to mean AUROC, which is a bad practice since as Marc Claesen pointed out AUC is ambiguous (could be any curve) while AUROC is not.


Interpreting the AUROC

The AUROC has several equivalent interpretations:

  • The expectation that a uniformly drawn random positive is ranked before a uniformly drawn random negative.
  • The expected proportion of positives ranked before a uniformly drawn random negative.
  • The expected true positive rate if the ranking is split just before a uniformly drawn random negative.
  • The expected proportion of negatives ranked after a uniformly drawn random positive.
  • The expected false positive rate if the ranking is split just after a uniformly drawn random positive.

Going further: How to derive the probabilistic interpretation of the AUROC?


Computing the AUROC

Assume we have a probabilistic, binary classifier such as logistic regression.

Before presenting the ROC curve (= Receiver Operating Characteristic curve), the concept of confusion matrix must be understood. When we make a binary prediction, there can be 4 types of outcomes:

  • We predict 0 while we should have the class is actually 0: this is called a True Negative, i.e. we correctly predict that the class is negative (0). For example, an antivirus did not detect a harmless file as a virus .
  • We predict 0 while we should have the class is actually 1: this is called a False Negative, i.e. we incorrectly predict that the class is negative (0). For example, an antivirus failed to detect a virus.
  • We predict 1 while we should have the class is actually 0: this is called a False Positive, i.e. we incorrectly predict that the class is positive (1). For example, an antivirus considered a harmless file to be a virus.
  • We predict 1 while we should have the class is actually 1: this is called a True Positive, i.e. we correctly predict that the class is positive (1). For example, an antivirus rightfully detected a virus.

To get the confusion matrix, we go over all the predictions made by the model, and count how many times each of those 4 types of outcomes occur:

enter image description here

In this example of a confusion matrix, among the 50 data points that are classified, 45 are correctly classified and the 5 are misclassified.

Since to compare two different models it is often more convenient to have a single metric rather than several ones, we compute two metrics from the confusion matrix, which we will later combine into one:

  • True positive rate (TPR), aka. sensitivity, hit rate, and recall, which is defined as $ \frac{TP}{TP+FN}$. Intuitively this metric corresponds to the proportion of positive data points that are correctly considered as positive, with respect to all positive data points. In other words, the higher TPR, the fewer positive data points we will miss.
  • False positive rate (FPR), aka. fall-out, which is defined as $ \frac{FP}{FP+TN}$. Intuitively this metric corresponds to the proportion of negative data points that are mistakenly considered as positive, with respect to all negative data points. In other words, the higher FPR, the more negative data points will be missclassified.

To combine the FPR and the TPR into one single metric, we first compute the two former metrics with many different threshold (for example $0.00; 0.01, 0.02, \dots, 1.00$) for the logistic regression, then plot them on a single graph, with the FPR values on the abscissa and the TPR values on the ordinate. The resulting curve is called ROC curve, and the metric we consider is the AUC of this curve, which we call AUROC.

The following figure shows the AUROC graphically:

enter image description here

In this figure, the blue area corresponds to the Area Under the curve of the Receiver Operating Characteristic (AUROC). The dashed line in the diagonal we present the ROC curve of a random predictor: it has an AUROC of 0.5. The random predictor is commonly used as a baseline to see whether the model is useful.

If you want to get some first-hand experience:

  • 3
    Brilliant explanation. Thank you. One question just to clarify that I understand: am I right in saying that, on this graph, a solid blue square would have ROC curve (AUC=1) and would be a good prediction model? I assume this is theoretically possible. – josh Jan 12 '15 at 12:39
  • 17
    @josh Yes, that's right. The AUROC is between 0 and 1, and AUROC = 1 means the prediction model is perfect. In fact, further away the AUROC is from 0.5, the better: if AUROC < 0.5, then you just need to invert the decision your model is making. As a result, if AUROC = 0, that's good news because you just need to invert your model's output to obtain a perfect model. – Franck Dernoncourt Jan 12 '15 at 17:08
  • Much clearer now. Thanks Gung and Franck! – josh Jan 16 '15 at 16:46
  • 1
    the link "several equivalent interpretations" is broken. – hxd1011 May 25 '16 at 18:43
  • 1
    @ryu576 ideally the number of points in the ROC curve is indeed the number of testing samples. – Franck Dernoncourt Apr 8 at 2:49

Although I'm a bit late to the party, but here's my 5 cents. @FranckDernoncourt (+1) already mentioned possible interpretations of AUC ROC, and my favorite one is the first on his list (I use different wording, but it's the same):

the AUC of a classifier is equal to the probability that the classifier will rank a randomly chosen positive example higher than a randomly chosen negative example, i.e. $P\Big(\text{score}(x^+) > \text{score}(x^-)\Big)$

Consider this example (auc=0.68):

enter image description here

Let's try to simulate it: draw random positive and negative examples and then calculate the proportion of cases when positives have greater score than negatives

cls = c('P', 'P', 'N', 'P', 'P', 'P', 'N', 'N', 'P', 'N', 'P',
        'N', 'P', 'N', 'N', 'N', 'P', 'N', 'P', 'N')
score = c(0.9, 0.8, 0.7, 0.6, 0.55, 0.51, 0.49, 0.43, 0.42, 0.39, 0.33, 
          0.31, 0.23, 0.22, 0.19, 0.15, 0.12, 0.11, 0.04, 0.01)

pos = score[cls == 'P']
neg = score[cls == 'N']

set.seed(14)
p = replicate(50000, sample(pos, size=1) > sample(neg, size=1))
mean(p)

And we get 0.67926. Quite close, isn't it?

 

By the way, in R I typically use ROCR package for drawing ROC curves and calculating AUC.

library('ROCR')

pred = prediction(score, cls)
roc = performance(pred, "tpr", "fpr")

plot(roc, lwd=2, colorize=TRUE)
lines(x=c(0, 1), y=c(0, 1), col="black", lwd=1)

auc = performance(pred, "auc")
auc = unlist(auc@y.values)
auc

enter image description here

  • Nice. The second grey block definitely clarifies the plotting method. – josh Jan 16 '15 at 16:45
  • +1 (from before). Above I linked to another thread where you made a very nice contribution to a related topic. This here does a great job complimenting @FranckDernoncourt's post & helping to flesh it out further. – gung Jan 16 '15 at 21:12
  • 1
    In the ROC curve produced by the R package, What does the color stands for ? Can you please add some details to it. Thanks ! – Prradep Mar 3 '16 at 1:00
  • It would probably be useful to add true positives and true negatives to the explanation in the grey box above? Otherwise it may be a bit confusing. – cbellei Jan 25 '17 at 15:28

Important considerations are not included in any of these discussions. The procedures discussed above invite inappropriate thresholding and utilize improper accuracy scoring rules (proportions) that are optimized by choosing the wrong features and giving them the wrong weights.

Dichotomization of continuous predictions flies in the face of optimal decision theory. ROC curves provide no actionable insights. They have become obligatory without researchers examining the benefits. They have a very large ink:information ratio.

Optimum decisions don't consider "positives" and "negatives" but rather the estimated probability of the outcome. The utility/cost/loss function, which plays no role in ROC construction hence the uselessness of ROCs, is used to translate the risk estimate to the optimal (e.g., lowest expected loss) decision.

The goal of a statistical model is often to make a prediction, and the analyst should often stop there because the analyst may not know the loss function. Key components of the prediction to validate unbiasedly (e.g., using the bootstrap) are the predictive discrimination (one semi-good way to measure this is the concordance probability which happens to equal the area under the ROC but can be more easily understood if you don't draw the ROC) and the calibration curve. Calibration validation is really, really necessary if you are using predictions on an absolute scale.

See the Information Loss chapter in Biostatistics for Biomedical Research and other chapters for more information.

  • 1
    Every other answer focuses on mathematical formulas which have no practical usefulness. And the only correct answer has the least upvotes. – max May 4 '16 at 23:00
  • 4
    I have been at the receiving end of seemingly cryptic answers on this topic from Professor Harrell - they are great in the way that they force you to think hard. What I believe he is hinting at is that you don't want to accept false negative cases in a screening test for HIV (fictional example), even if accepting a higher percentage of false negatives (concomitantly reducing false positives) could place your cutoff point at the AUC maxima. Sorry for the brutal oversimplification. – Antoni Parellada Sep 17 '16 at 15:24
  • Here – Antoni Parellada Sep 17 '16 at 15:25

AUC is an abbrevation for area under the curve. It is used in classification analysis in order to determine which of the used models predicts the classes best.

An example of its application are ROC curves. Here, the true positive rates are plotted against false positive rates. An example is below. The closer AUC for a model comes to 1, the better it is. So models with higher AUCs are preferred over those with lower AUCs.

Please note, there are also other methods than ROC curves but they are also related to the true positive and false positive rates, e. g. precision-recall, F1-Score or Lorenz curves.

                                            Example of a ROC curve

  • 9
    AUC stands for area under the curve and is not limited to ROC curves (though that is its most common use). I have seen the abbreviation AUC being used in the context of precision-recall and even glucose tolerance curves (in medicine). – Marc Claesen Jan 9 '15 at 12:12
  • 1
    Of course, your are right. All this measures are related. I will add a remark to my answer. – random_guy Jan 9 '15 at 12:14
  • 1
    can you please explain the ROC curve in the context of a simple crossvalidation of the 0/1 outcome? I don't know understand very well how the curve is constructed in that case. – Curious Jan 9 '15 at 13:42

The answers in this forum are great and I come back here often for reference. However, one thing was always missing. From @Frank's answer, we see the interpretation of AUC as the probability that a positive sample will have a higher score than the negative sample. At the same time, the way to calculate it is to plot out the TPR and FPR as the threshold, $\tau$ is changed and calculate the area under that curve. But, why is this area under the curve the same as this probability? @Alexy showed through simulation that they're close, but can we derive this relationship mathematically? Let's assume the following:

  1. $A$ is the distribution of scores the model produces for data points that are actually in the positive class.
  2. $B$ is the distribution of scores the model produces for data points that are actually in the negative class (we want this to be to the left of $A$).
  3. $\tau$ is the cutoff threshold. If a data point get's a score greater than this, it's predicted as belonging to the positive class. Otherwise, it's predicted to be in the negative class.

Note that the TPR (recall) is given by: $P(A>\tau)$ and the FPR (fallout) is given be: $P(B>\tau)$.

Now, we plot the TPR on the y-axis and FPR on the x-axis, draw the curve for various $\tau$ and calculate the area under this curve ($AUC$).

We get:

$$AUC = \int_0^1 TPR(x)dx = \int_0^1 P(A>\tau(x))dx$$ where $x$ is the FPR. Now, one way to calculate this integral is to consider $x$ as belonging to a uniform distribution. In that case, it simply becomes the expectation of the $TPR$.

$$AUC = E_x[P(A>\tau(x))] \tag{1}$$ if we consider $x \sim U[0,1)$ .

Now, $x$ here was just the $FPR$

$$x=FPR = P(B>\tau(x))$$ Since we considered $x$ to be from a uniform distribution,

$$P(B>\tau(x)) \sim U$$ $$=> P(B<\tau(x)) \sim (1-U) \sim U$$ \begin{equation}=> F_B(\tau(x)) \sim U \tag{2}\end{equation}

But we know from the inverse transform law that for any random variable $X$, if $F_X(Y) \sim U$ then $Y \sim X$. This follows since taking any random variable and applying its own CDF to it leads to the uniform.

$$F_X(X) = P(F_X(x)<X) =P(X<F_X^{-1}(X))=F_XF_X^{-1}(X)=X$$ and this only holds for uniform.

Using this fact in equation (2) gives us: $$\tau(x) \sim B$$

Substituting this into equation (1) we get:

$$AUC=E_x(P(A>B))=P(A>B)$$

In other words, the area under the curve is the probability that a random positive sample will have a higher score than a random negative sample.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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