Bayes Optimal Classifier & Gibbs Algorithm
Source: Unit 3 §8
The question it answers
MAP answers "what is the most probable hypothesis?" The Bayes Optimal Classifier answers a different and, for prediction, better question: "what is the most probable classification of a new instance?"
Those two questions have different answers, and this page is about the gap.
The Bayes optimal classifier
Combine the predictions of all hypotheses, weighted by their posterior probabilities. For possible classes :
The optimal classification is then the argmax over :
Worked example: why it beats MAP
Three hypotheses with posteriors , , . On a new instance : , , .
| h₁ (0.4) | h₂ (0.3) | h₃ (0.3) | Σ | |
|---|---|---|---|---|
| P(+|hᵢ) | 1 | 0 | 0 | 0.4 |
| P(−|hᵢ) | 0 | 1 | 1 | 0.6 |
- For class +, only contributes: .
- For class −, and contribute: .
- Most probable classification is −, because .
The MAP hypothesis here is , and predicts +. The Bayes optimal classification is −. They disagree, and the Bayes optimal answer is the correct one: it maximises the probability that the new instance is classified correctly, given the data, the hypothesis space and the priors. No other classification method using the same hypothesis space and prior knowledge can do better on average.
Gibbs algorithm
The Bayes optimal classifier is optimal but costly - it computes a posterior for every hypothesis in and then a weighted vote over all of them. The Gibbs algorithm is the cheap alternative.
Under certain conditions, the expected error of Gibbs is at most twice the expected error of the Bayes optimal classifier. One random draw from the posterior buys you within a factor of 2 of the theoretical optimum.