Bayes’ Theorem
Bayes’ Theorem – Statement and Formula
Bayes’ Theorem is a way to update our beliefs based on new evidence.Given events and , where :
More generally , Let be mutually exclusive and exhaustive events (i.e., they partition the sample space), and let be any event such that . Then the posterior probability of event given is:
📌 Terminology
Term | Meaning |
---|---|
Prior probability – belief before observing A | |
Likelihood – how likely A is given | |
Posterior probability – updated belief after observing A | |
Denominator | Total probability(evidence) of A using the law of total probability |
✅ Example: Medical Test
Imagine a disease affects 1 in 1000 people. A test for the disease is 99% accurate (i.e., 99% true positive and 99% true negative).
-
Let:
-
: person has disease
-
: test is positive
-
Known:
-
-
-
(False positive)
-
What is the probability the person has the disease given the test is positive?
👉 So, even if the test is positive, the person only has about a 9% chance of actually having the disease!
📊 Visual Diagram of Bayes’ Theorem
Here’s a graphical interpretation
🌳 Tree Diagram:
Example 2: Coin Selection Problem
You have:
-
Bag 1: 2 gold coins
-
Bag 2: 1 gold + 1 silver coin
-
You pick a random bag, then a random coin from it, and it’s gold.
What is the probability it came from Bag 1?
Let:
-
: chose Bag 1
-
: chose Bag 2
-
: selected gold coin
Example 3: Spam Filter (Machine Learning)
-
80% of emails are not spam
-
"Win money" appears in 10% of spam emails
-
Appears in 1% of non-spam emails
What is the probability an email is spam given it contains "win money"?
Let:
-
: spam
-
: contains "win money"
👉 The email is about 71% likely to be spam.
Example 4: Quality Control
A factory has 3 machines:
-
M1 produces 30% of items; 2% are defective.
-
M2 produces 50% of items; 1% are defective.
-
M3 produces 20% of items; 3% are defective.
If an item is found defective, what is the probability it was produced by M3?
✅ Solution 4:
Let:
-
: defective
-
: machines
Numerator:
Denominator:
👉 Answer: ~35.3% chance the defective item came from M3
Question 5: Student Performance
Suppose:
-
60% of students are from urban schools, 40% from rural.
-
80% of urban students pass the entrance test.
-
50% of rural students pass.
If a student is selected who passed, what is the probability they are from an urban school?
✅ Solution 5:
Let:
-
: urban
-
: rural
-
: passed
👉 Answer: ~70.6% chance the student is from an urban school.
Q6. Classifier Error (AI/ML context)
An email classifier identifies 90% of spam correctly, but misclassifies 10% of non-spam as spam. If 30% of all emails are spam, what is the probability an email is actually spam given that it was classified as spam?
Solution:
Let:
-
: spam →
-
: not spam →
-
: classified as spam
Summary
-
Bayes’ Theorem allows us to update probabilities when new information (like test results) is available.
-
It’s essential in fields like:
-
Machine learning
-
Medical diagnostics
-
Spam filtering
-
Decision-making under uncertainty
-
Comments
Post a Comment