Bayesian Classification Methods Explained
Bayes' Theorem
Updating Beliefs with Evidence
How do you change your mind when you learn something new? It seems simple, but there's a formal way to do it. Bayes' Theorem gives us a mathematical rule for updating our beliefs in light of new evidence. It's a cornerstone of probability theory that helps us move from an initial guess to a more informed position.
Think of it as a precise way to combine what you already believed with what you just learned.
This idea is central to many machine learning models, especially those used for classification. At its heart, the theorem is a formula for reversing a conditional probability. If you know the probability of seeing certain evidence given a specific cause, Bayes' Theorem helps you find the probability of that cause being true, given that you've seen the evidence.
A Practical Example
Formulas can be abstract, so let's use a common example: medical testing. Imagine a rare disease that affects 1 in every 10,000 people. There's a test for this disease that is 99% accurate.
Someone tests positive. What is the actual probability they have the disease? It might seem like it's 99%, but let's use Bayes' Theorem to see what's really going on.
First, let's define our terms:
- A: The person has the disease.
- B: The person tests positive.
Now we can assign probabilities based on what we know.
| Term | Description | Probability |
|---|---|---|
| Prior: The probability of having the disease before any test. | 0.0001 | |
| $P(B | A)$ | Likelihood: The probability of testing positive if you have the disease (test accuracy). |
| The probability of not having the disease. | 0.9999 | |
| $P(B | A')$ | The probability of testing positive if you don't have the disease (false positive rate). |
The one missing piece is , the total probability of anyone testing positive. A person can test positive in two ways: they have the disease and test positive (a true positive), or they don't have the disease and test positive (a false positive). We add these two possibilities together:
Now we have everything we need to plug into Bayes' Theorem to find , the probability of having the disease given a positive test.
The result is about 0.98%, or just under 1%. Even with a positive result from a 99% accurate test, the chance of actually having this rare disease is surprisingly low. This is because the disease is so rare that most positive tests are actually false positives.
This shows how Bayes' Theorem helps us correct our intuition. Our initial belief (the prior) is weak, so even strong evidence (the likelihood) doesn't make the conclusion a certainty. It simply updates our belief from 0.01% to about 1%.
The Core Components
Let's formalize the key terms we just used.
Prior
noun
An initial belief about the probability of an event, before considering any new evidence. It's our starting point.
In our example, the prior was . This was our knowledge before the test result came in.
Likelihood
noun
The probability of observing the new evidence, given that our initial hypothesis is true.
This was . It measures how well the evidence (a positive test) supports our hypothesis (the person has the disease).
Posterior
noun
The revised probability of an event after taking the new evidence into account. It's the result of applying Bayes' Theorem.
The posterior, , is our updated belief. If we got more evidence, like a second positive test, this posterior would become the prior for our next calculation. This is how Bayesian reasoning allows us to update our knowledge incrementally as we learn more.
What is the primary purpose of Bayes' Theorem?
In the medical test example, a person tests positive for a rare disease (1 in 10,000 people) with a 99% accurate test. Why is the actual probability they have the disease surprisingly low (around 1%)?