MAP, ML & the Cancer Example
Source: Unit 3 §5
Bayes' theorem for hypotheses
| Term | Name | Meaning |
|---|---|---|
P(h|D) | Posterior | probability of the hypothesis after seeing the data - this is what we want |
P(h) | Prior | probability of the hypothesis before any data |
P(D|h) | Likelihood | probability of the data given the hypothesis |
P(D) | Evidence | prior probability of the data, a normalising constant |
MAP: maximum a posteriori
Find the most probable hypothesis given the data:
is dropped because it is a constant independent of , and a constant cannot change which wins the argmax.
Best hypothesis means most probable hypothesis. The whole goal of Bayesian learning is to locate the hypothesis that best explains the observed data. Linear and logistic regression can both be framed as MAP estimation.
ML: maximum likelihood
If every hypothesis is equally probable a priori, so that for all , the prior factors out of the argmax and MAP collapses to:
If the prior is uniform, then . ML is not a different philosophy, it is MAP with the prior switched off.
Worked example: does the patient have cancer?
- , so .
- Test accuracy given cancer: , .
- Test accuracy given no cancer: , .
| Test \ Actual | Cancer | ¬Cancer |
|---|---|---|
| + | 0.98 | 0.03 |
| − | 0.02 | 0.97 |
A patient tests positive. Cancer or not? Compare the two unnormalised posteriors, which is all MAP needs.
- Hypothesis cancer: .
- Hypothesis ¬cancer: .
- Since , the winner is . The patient most likely does not have cancer.
- Normalise to recover real probabilities. The sum is .
- .
- .
Even after a positive test, cancer is only 21% likely, because the prior is only 0.008. There are simply far more healthy people generating false positives than sick people generating true positives. Bayesian inference depends strongly on the priors, and this example exists to make that impossible to forget.