Skip to content
Minsing Log
Go back

English Edition

Bayes' Theorem

Programming & CS

What is Bayes’ Theorem?

Bayes’ theorem is a law of probability used to infer the cause after an event has occurred.
In other words, it provides a way to update the probability of another event occurring based on an event that has already occurred.


1. Formula for Bayes’ Theorem

Bayes’ theorem is expressed as follows using conditional probability:


2. Why Is Bayes’ Theorem Important?

Bayes’ theorem is the process of updating probabilities when new information is provided.
In other words, it calculates the posterior probability by modifying the existing probability (prior probability) using new information (likelihood).


3. Example: Disease Diagnosis

Suppose that the probability of having a certain disease (e.g., influenza) is 1%.
The probability of receiving a positive result on a test for this disease is as follows:

Here:

We need to find the probability that a person actually has the disease when the test result is positive, P(D | T^+).

Applying Bayes’ Theorem

First, we need to find P(T^+). The overall probability of receiving a positive test result is calculated as follows:

Substituting the values:

Now, use Bayes’ theorem to find P(D | T^+):

In other words, even if the test result is positive, the probability that the person actually has the disease is only about 16.1%.
(This is why you should not rely solely on the test result!)


4. Extension: Multiple Causes (Using the Law of Total Probability)

Bayes’ theorem can also be used when there are multiple causes rather than a single cause (A).

If B occurred due to one of several possible causes A_1, A_2, …, A_n:

This is called the Law of Total Probability.


5. Conclusion

If you have any further questions, please feel free to ask! 😊

Follow the journey

Get new posts by email.

Short, honest notes on building, startups, learning, failures, and retrospectives, for readers who follow the journey rather than pass through from search.

The newsletter is coming soon. Until then, follow via RSS or email me to get notified.


Share this post:

Comments

Sign in with GitHub to leave a comment.


Previous Post
What It Means for a Model to Learn
Next Post
If a Problem Only Tells You That A and B Are Dependent, Without Giving the Intersection Probability or Conditional Probability