Bayes' Theorem

The Foundation of Probabilistic Reasoning

$$P(A|B) = \frac{P(B|A) \times P(A)}{P(B)}$$

Named after: Reverend Thomas Bayes (1701-1761)

Core Principle: How to update our beliefs when we observe new evidence

Conditional Probability

The Building Block

Conditional Probability: The probability of event A occurring given that event B has occurred $$P(A|B) = \frac{P(A \cap B)}{P(B)}$$
Example: What's the probability it's raining given that you see people with umbrellas?
Key Insight: $P(A|B) \neq P(B|A)$ in general
The probability of rain given umbrellas ≠ probability of umbrellas given rain

Deriving Bayes' Theorem

From Basic Probability Rules

Starting with conditional probability:
1. P(A|B) = P(A ∩ B) / P(B)
2. P(B|A) = P(A ∩ B) / P(A)

3. From (2): P(A ∩ B) = P(B|A) × P(A)

4. Substitute into (1):
P(A|B) = [P(B|A) × P(A)] / P(B)
$$P(A|B) = \frac{P(B|A) \times P(A)}{P(B)}$$
This is Bayes' Theorem! A simple rearrangement of conditional probability definitions

Components of Bayes' Theorem

Understanding Each Term

$$P(\text{Hypothesis}|\text{Evidence}) = \frac{P(\text{Evidence}|\text{Hypothesis}) \times P(\text{Hypothesis})}{P(\text{Evidence})}$$
Four Key Components:
Intuition: Posterior ∝ Likelihood × Prior

Medical Diagnosis Example

Disease Testing Scenario

Problem Setup:
Given information:
• P(Disease) = 0.01 (prior)
• P(Positive|Disease) = 0.95 (likelihood)
• P(Positive|No Disease) = 0.05

Need to find: P(Disease|Positive) = ?
$$P(\text{Disease}|\text{Positive}) = \frac{P(\text{Positive}|\text{Disease}) \times P(\text{Disease})}{P(\text{Positive})}$$
Intuitive guess: 95%? Actual answer: Much lower!

Medical Example: Full Calculation

Step-by-Step Solution

Step 1: Calculate P(Positive) using law of total probability
P(Positive) = P(Positive|Disease) × P(Disease) + P(Positive|No Disease) × P(No Disease)
P(Positive) = 0.95 × 0.01 + 0.05 × 0.99
P(Positive) = 0.0095 + 0.0495 = 0.059

Step 2: Apply Bayes' theorem
P(Disease|Positive) = P(Positive|Disease) × P(Disease) / P(Positive)
P(Disease|Positive) = (0.95 × 0.01) / 0.059 ≈ 0.161
$$P(\text{Disease}|\text{Positive}) = 16.1\%$$
Key Insight: Even with a 95% accurate test, a positive result only gives 16% chance of having the disease!
Base Rate Fallacy: Ignoring the low prevalence (1%) leads to massive overestimation of risk

Bayesian vs. Frequentist Perspectives

Two Philosophies of Probability

Aspect Frequentist Bayesian
Probability Long-run frequency of events Degree of belief or uncertainty
Parameters Fixed but unknown constants Random variables with distributions
Prior Knowledge Not formally incorporated Explicitly included via priors
Inference Confidence intervals, p-values Credible intervals, posterior distributions
Uncertainty About the procedure About the parameter values
When to use each:

Applications in Machine Learning

Bayes' Theorem in Action

Key Applications:
$$P(\text{Class}|\text{Features}) = \frac{P(\text{Features}|\text{Class}) \times P(\text{Class})}{P(\text{Features})}$$

Common Misconceptions

Avoiding Pitfalls

Misconception 1: Confusing P(A|B) with P(B|A)
Misconception 2: Ignoring Base Rates (Priors)
Misconception 3: Assuming Independence
Pro Tips:

Key Takeaways

Essential Points to Remember

$$P(\text{Hypothesis}|\text{Evidence}) = \frac{P(\text{Evidence}|\text{Hypothesis}) \times P(\text{Hypothesis})}{P(\text{Evidence})}$$
Remember: Bayes' theorem is not just a formula—it's a way of thinking about evidence, belief updating, and rational decision making in the face of uncertainty.
Next Steps: Explore Bayesian statistics, probabilistic programming, and Bayesian machine learning methods
Slide 1 of 10