S14 · Lesson 3 · Decision theory
Turning posterior probabilities into decisions, minimizing the probability of error, the Bayes decision boundary between two Gaussian classes and how priors shift it, unequal costs and the decision threshold they set, the Bayes error, and the best predictor under squared and absolute loss
A classifier that outputs "faulty with probability 0.3" hasn't made a decision yet. Whether to stop the production line depends on what a missed fault costs against what a false alarm costs, and on how common faults are. Decision theory separates the two jobs cleanly: inference estimates the probabilities, and a decision rule, set by the costs, turns them into actions. S8 used the same idea to choose a receiver's threshold; here it's general.
- Two classes with Gaussian densities of unit variance, centered at 0 and 2, weighted by their prior probabilities (class 1 has prior P). The decision boundary where the weighted densities cross moves away from the more probable class.
- The shaded probability of error is the area of each weighted density on the wrong side of the boundary.
- With equal priors the boundary is the midpoint, and the error is Q(1) = 0.159.
Predict
Two equally likely classes have unit-variance Gaussian densities centered 2 apart. What's the lowest possible error rate for deciding between them from one measurement?
The best rule picks the class with the larger posterior, which puts the boundary at the midpoint, one standard deviation from each mean. Each class then spills past the boundary with probability Q(1) = 0.159. No classifier using this measurement can do better: that's the Bayes error, set by how much the classes overlap.
Name it
Minimum error
To minimize the probability of a wrong decision, choose the class with the largest posterior . For two Gaussian classes with equal variance σ², means and priors , , the boundary is
and the error is , the Bayes error.
Unequal costs
With a cost for missing a positive and for a false alarm, deciding positive has expected cost and deciding negative , where p is the posterior of the positive class. So decide positive when
A rare but expensive miss drives the threshold far below 0.5.
Regression
Under squared loss the best prediction is the conditional mean ; under absolute loss, the conditional median.
Worked example
The sim's classes (means 0 and 2, σ = 1) with priors 0.8 and 0.2: where's the boundary and what's the error?
Show the solution
- Boundary.
- Error.
- Compare equal priors. That's lower than the 0.159 of the same classes with equal priors: the more common class gets more of the axis.
Answer the boundary is at x = 1.693, and the error is 0.112.
Worked example
A screening test's missed fault costs 1000 times as much as a false alarm. Above what posterior should it flag?
Show the solution
- Threshold. so flag anything with even a 0.1% chance of a fault.
- Compare an accuracy-trained classifier. A classifier trained for accuracy, thresholding at 0.5, would miss almost all of them.
Answer it should flag above a posterior of about 0.001.
Worked example
The sim's equally likely classes (means 0 and 2, σ = 1) are classified only when the larger posterior is at least 0.8; otherwise the system rejects and asks a person. Which inputs are rejected, how often, and what's the error rate on the rest?
Show the solution
- Log-odds. The log-odds of class 2 are
- Reject band. Both posteriors stay below 0.8 while , so the band is
- How often. Under either class that band holds of the inputs.
- Errors left. They are the far tails: of all inputs, 6.8% of those accepted, against the 15.9% Bayes error without rejection.
- The trade. Rejecting a third of the cases cuts the error rate by more than half, the trade a reject option offers.
Answer inputs between 0.307 and 1.693 are rejected, 33.4% of all inputs, and the error rate on the rest is 6.8% (4.5% of all inputs).
Check
A false alarm costs 5 and a miss costs 10. Above what posterior probability of the positive class should you decide positive?
Check
Class 1 has mean 0 and class 2 mean 1, both Gaussian with σ = 1; class 1's prior is 0.9. Where's the minimum-error boundary?
Check
Two equally likely classes have unit-variance Gaussian densities whose means are 2 apart. What's the Bayes error?
Check
Unit-variance classes 1 apart have priors 0.8 and 1 − 0.8. What's the Bayes error?
Check
The posterior of a fault is 0.2. A false alarm costs 1 and a miss 50. What's the expected cost of the better decision?
Check
Given an input, the target is equally likely to be 1, 3 or 20. What prediction minimizes the expected squared error?
Check
Two equally likely unit-variance Gaussian classes have means 2 apart. The classifier rejects whenever the larger posterior is below 0.7.
(a)
How far on each side of the midpoint does the reject band reach?
(b)
What fraction of inputs does it reject?
Check
Class 1 is Gaussian at 0 and class 2 at d, both with unit variance; class 1 has prior P.
Step 1
Where is the minimum-error boundary?
Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.
Step 2
What is the Bayes error?
Explain why
Why should a classifier's outputs be probabilities rather than just class labels?
The right decision depends on things the classifier can't know when it's trained: the costs of different mistakes, which vary from one use to another, and the class priors in the population where it's deployed, which can differ from the training set. A classifier that outputs only a label has fixed its threshold for one particular set of costs and priors. One that outputs calibrated posterior probabilities lets the threshold be set afterward, from the costs, and lets the priors be corrected by reweighting, without retraining. It also allows a reject option: when no class's probability is high enough, defer to a human or another test.
Practice
Keep practicing
10 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.