sweeping every classification threshold, plot the true positive rate
TPR=TP+FNTP (= recall) on the y-axis against the false positive rate
FPR=FP+TNFP (= 1 - specificity) on the x-axis; AUC is the area under this curve. As the threshold drops, TPR rises monotonically while FPR grows too; key points: (0,0) = predict all negative, (1,1) = predict all positive, and the diagonal
TPR=FPR is random guessing (AUC = 0.5). Probabilistic interpretation: AUC = the probability that a randomly chosen positive scores higher than a randomly chosen negative,
AUC=P(s+>s−) — threshold-free and class-ratio-free, a pure ranking metric. Hand computation: 4 samples with scores [0.9, 0.7, 0.5, 0.3] and labels [+, -, +, -]: there are
2×2=4 positive–negative pairs, and 3 of them (0.9, 0.7), (0.9, 0.3), (0.5, 0.3) are correctly ordered while only (0.5, 0.7) is inverted, so
AUC=3/4=0.75.