Two kinds of error
The topic Logistic regression ended with probabilities , and the reliability diagram showed how to check that they can be read literally. The classifiers of Linear classifiers and surrogate losses give scores without that promise. Classes here are , and 1 is the positive class, the one being looked for: the sick patient, the fraud, the customer about to leave.
Two questions remain. Where should the threshold go that turns a probability into a decision? And how good is the classifier? Both need a language for errors, because the two kinds of error rarely cost the same.
Write for any score that is larger for "more positive" objects: a probability, a logit, a margin. A threshold turns the score into a decision:
At a fixed threshold every test object falls into one of four cells of the confusion matrix:
| true positive (TP) | false negative (FN) | |
| false positive (FP) | true negative (TN) |
Take the screening test from Conditional probability and Bayes' formula: base rate , sensitivity , false-positive rate . Among people, 100 are sick, so and . Of the healthy, and . The row sums are fixed by the data, so only two of the four counts are free. One threshold needs two numbers, one per kind of error.
The obvious single number is accuracy, the share of correct answers, . Let and be the numbers of positives and negatives, and the prevalence. Splitting the correct answers by true class shows what accuracy weighs:
It averages the success rates on the two classes with the prevalence as weights. At the positives contribute one hundredth of the number. The screening test is right about of people. A "test" that declares everyone healthy is right about . So any accuracy must be read against the majority baseline , the accuracy of always predicting the larger class.