Classifier Probability Versus the Decision Threshold
A classifier's score, its probability, and the decision it makes are three different things, and the threshold is what links the last two. James, Witten, Hastie, and Tibshirani's Section 4.3 on logistic regression shows all three. The model makes the log odds, which the book also calls the logit, a linear function of the input: log(p(X) / (1 − p(X))) = β0 + β1X. The logistic function then turns that score into a probability between 0 and 1. And a decision comes from a rule on that probability: "one might predict default=Yes for any individual for whom p(balance)>0.5. Alternatively, if a company wishes to be conservative in predicting individuals who are at risk for default, then they may choose to use a lower threshold, such as p(balance)>0.1."
The three are different kinds of number. The score can be any real number. The probability is squeezed into the range from 0 to 1. The decision is a label, and it depends on a threshold that comes from the costs of mistakes and not from the model. Separately, whether a probability can be read at face value is a question about calibration. The scikit-learn guide defines it this way: "Well calibrated classifiers are probabilistic classifiers for which the output of the predict_proba method can be directly interpreted as a confidence level." It warns that "Some models can give you poor estimates of the class probabilities and some even do not support probability prediction (e.g., some instances of SGDClassifier)."
Try it by hand. The book's fitted default model uses the coefficient estimates −10.6513 for the intercept and 0.0055 for balance, so the score is −10.6513 + 0.0055 × balance. At a balance of US$1,000 the score is −5.1513, the probability is 0.00576, and the decision is No at either threshold. At US$2,000 the score is 0.3487 and the probability is 0.586, which is the book's figure, and the decision is Yes at either threshold. At US$1,800, a value I computed from the same rounded coefficients and not from the book, the score is −0.7513, the probability is 0.3205, and the two thresholds disagree: above 0.5 the answer is No, above 0.1 it is Yes. Nothing about the model or the person changed between those two decisions. Only the rule applied to the probability changed. The values were computed from the book's rounded coefficients, so they match its printed 0.00576 and 0.586 to the digits shown, and the data are the book's invented Default example.
The trap: treating any classifier score as a calibrated probability. In my own examples, a support vector machine's distance from its boundary, a neural network's softmax output, and a forest's vote share are all numbers that rank cases, and none of them is guaranteed to mean "this fraction of such cases are positive." A caution of my own, not from the sections I read: even a probability from a model that assumes the logistic form is only as good as that assumption and the training data, so it deserves a calibration check before anyone quotes it as a percentage. The single threshold shown here is a two-class rule; with more than two classes the decision step is different, for example picking the class with the largest probability, and multilabel problems and rules that allow abstaining change it again. This note covers finite labels with one decision per case.
Prof Rod's rule: keep the score, the probability, and the decision apart, choose the threshold from what each kind of mistake costs, and check calibration before you read a probability as a percentage.