The Calibration Trap: When a Perfect Classifier Fails Probability Estimation
Suppose you train a binary classifier that achieves 100% training accuracy — it correctly labels every training point. A colleague claims: "Since our classifier is perfect on the training set, we can read off class probabilities directly from its output scores. If the model outputs a score of 0.9 for class 1, the true probability of class 1 is 0.9."
Now consider a specific case. You train a naive Bayes classifier on two features and that are strongly positively correlated (say ) given the class label. The model achieves near-perfect classification accuracy.
Question: Even if the classifier achieves perfect (or near-perfect) classification accuracy, explain precisely why its output scores cannot be trusted as calibrated probabilities. What goes wrong in the naive Bayes case specifically, and what is the general principle?
As a concrete sanity check: if the true posterior is , can a perfectly-accurate classifier output a score of for the same input? Is this consistent or contradictory?
Answer: The Calibration Trap: Perfect Accuracy vs Probability Estimation
Key Idea / Intuition
Classification accuracy and probability calibration are fundamentally different objectives. A classifier only needs to get the ordering right — it must put for positive examples and for negative ones. Any monotone transformation of the true posterior preserves classification accuracy, but wildly distorts probability estimates. Naive Bayes specifically double-counts correlated evidence, inflating its confidence far beyond what is warranted.
Formal Proof / Solution
Step 1: Accuracy vs. Calibration Are Different Things
A binary classifier is perfectly accurate if, for every input :
This only requires the sign of to be correct. The actual value of is irrelevant to accuracy.
A classifier is calibrated if, among all inputs where the model outputs score :
These are independent properties. A perfectly accurate classifier can be completely miscalibrated.
Step 2: The Concrete Sanity Check
Suppose the true posterior is for some input .
- The true label is 1 (since ).
- A classifier outputting score for this input is still perfectly accurate — it correctly predicts class 1.
- But the probability estimate is wildly wrong: the true chance is only .
So yes, a perfectly accurate classifier can output when the truth is . No contradiction with accuracy; total failure of calibration.
Step 3: Why Naive Bayes Specifically Overcounts
Naive Bayes assumes conditional independence of features given the class:
When and are strongly correlated (say, ), knowing already tells you almost everything about . But naive Bayes multiplies both likelihoods as if they were independent pieces of evidence.
This is equivalent to counting the same evidence twice (or nearly twice). The log-odds get inflated:
Each term pushes in the same direction (since are correlated), so the sum is roughly twice what it should be. The resulting posterior gets pushed toward 0 or 1 much more aggressively than the truth warrants.
Example: Suppose the true log-odds should be (corresponding to ). Naive Bayes with two correlated features might produce log-odds , giving . Classification is still correct (), but the probability is inflated.
Step 4: The General Principle
| Property | What It Requires | |---|---| | Perfect accuracy | Correct sign of | | Calibration | equals true conditional probability |
Any strictly monotone transformation with preserves accuracy while destroying calibration. This is why:
- Naive Bayes is often a strong classifier but a poor probability estimator (overconfident).
- SVMs with hinge loss optimize a margin, not likelihood — their scores need Platt scaling to become probabilities.
- Boosting also tends to produce overconfident scores.
The fix is calibration post-processing: Platt scaling (logistic regression on scores), isotonic regression, or temperature scaling — all of which adjust the scores to match empirical frequencies without changing the ranking.
Summary
Naive Bayes violates calibration by treating correlated features as independent, double-counting evidence and systematically pushing posteriors toward 0 and 1. A score of 0.99 from a naive Bayes model might correspond to a true probability of 0.6 — and the model is still "perfectly accurate."
Source: The Elements of Statistical Learning, Hastie, Tibshirani, Friedman (2nd ed.), Section 6.6.3 and folklore