Every classifier here first estimates the posterior probability p(x) = Pr(default = Yes | x) for each of the 10,000 card holders and then predicts a default when p(x) exceeds a threshold. The Bayes rule uses 0.5, which minimises the total number of errors, but it misses three quarters of the defaulters. Lower the threshold and more defaulters are caught (higher sensitivity) at the price of more false alarms (lower specificity). The ROC curve traces this trade-off over every threshold at once, and its area (AUC) summarises it in one number.
All models are fitted in your browser to the full Default data: LDA with the pooled covariance (divisor n − 2) and priors nk/n; logistic regression by Newton–Raphson; naive Bayes with a normal density per class for balance and income (standard deviation with divisor nk − 1) and the class frequencies of student status. Rates are on the training data, as in the book.
code/ch04_classification.py (lda_fit, logistic_fit, nb_fit, confusion, roc, auc, Figures 4.7 and 4.8).