수학 학습

베이즈 정리

확률에서 베이즈 정리 이해 및 적용

Interactive Bayes' Theorem Visualization

Welcome to the Bayes' Theorem Explorer

Bayes' Theorem allows us to update our beliefs about the probability of an event based on new evidence. It's one of the most important formulas in probability and statistics, with applications in medicine, machine learning, and decision-making.

Bayes' Theorem Formula:

P(A|B) = P(B|A) × P(A) / P(B)

where P(B) = P(B|A) × P(A) + P(B|A') × P(A')

  • P(A|B) - Posterior probability (what we want to find)
  • P(B|A) - Likelihood (probability of evidence given hypothesis)
  • P(A) - Prior probability (initial belief)
  • P(B) - Total probability of evidence

How to Use This Visualization

Interactive Features:

  • Select Example - Choose from medical test, spam detection, or custom
  • Adjust Probabilities - Change prior, likelihood, and false positive rates
  • View Tree Diagram - See the probability tree visualization
  • See Calculations - Step-by-step Bayes' Theorem calculation

What You'll See:

  • Probability Tree - Visual representation of all paths
  • Step-by-Step Calculation - How Bayes' Theorem is applied
  • Prior vs Posterior - How evidence updates our beliefs
  • Real-World Examples - Practical applications

Probability of having a disease given a positive test result

Initial probability before evidence

True positive rate (sensitivity)

False positive rate (1 - specificity)

Bayes' Theorem Calculation

Step 1: Calculate P(B) - Total Probability of Evidence

P(Test Positive) = P(Test Positive|Has Disease) × P(Has Disease) + P(Test Positive|Not Has Disease) × P(Not Has Disease)

P(Test Positive) = 0.950 × 0.010 + 0.050 × 0.990

P(Test Positive) = 0.0590

Step 2: Apply Bayes' Theorem

P(Has Disease|Test Positive) = P(Test Positive|Has Disease) × P(Has Disease) / P(Test Positive)

P(Has Disease|Test Positive) = 0.950 × 0.010 / 0.0590

P(Has Disease|Test Positive) = 0.1610

= 16.10%

Prior Probability

0.0100

P(Has Disease) = 1.00%

Before observing evidence

Posterior Probability

0.1610

P(Has Disease|Test Positive) = 16.10%

After observing evidence

Update Factor

16.10×

How much the probability increased after evidence

Key Concepts

Prior (P(A)): Our initial belief about the probability of event A before seeing any evidence.

Likelihood (P(B|A)): The probability of observing evidence B given that A is true. Also called sensitivity.

Posterior (P(A|B)): Our updated belief about the probability of A after observing evidence B.

Evidence (P(B)): The total probability of observing evidence B, calculated using the law of total probability.

Applications

Medical Diagnosis: Update disease probability based on test results, considering test accuracy and disease prevalence.

Spam Filtering: Determine if an email is spam based on word presence, using prior spam rate and word frequencies.

Machine Learning: Bayesian inference for updating model parameters as new data arrives.

Decision Making: Update beliefs and make decisions under uncertainty using available evidence.

Medical Test Example

Even with a highly accurate test (95% sensitivity), if the disease is rare (1.0% prevalence), a positive test result doesn't guarantee you have the disease.

In this example, if you test positive, there's only a 16.1% chance you actually have the disease. This is because false positives (5.0% of healthy people) can outnumber true positives when the disease is rare.

This is why doctors often order follow-up tests for rare diseases, even after a positive initial screening.

수업

개별 학습 단위

수업 준비 중

베이즈 정리 | Maths Learning