Bayesian Probability

Named after the Reverend Thomas Bayes, this theorem has applications in various fields such as statistics, machine learning, medicine, and many others.

Rina Mondal
Women in Technology
3 min readJun 15, 2024

--

Bayes’ Theorem:

Bayes’ Theorem helps you figure out how likely something is to be true based on new information. It combines what you already know with new evidence to update your beliefs. The theorem is mathematically expressed as follows: P(A∣B)=P(B∣A)⋅P(A)/P(B)

Example: Imagine you are trying to figure out if it’s going to rain today. You know it rains 10% of the days (initial belief), and if it rains, the weather forecast predicts it 80% of the time correctly. However, the forecast is not always right and predicts rain 20% of the time when it doesn’t actually rain.

You hear today’s forecast says it will rain. Bayes’ Theorem helps you update your belief about whether it will actually rain today based on this new forecast.

Using the theorem, you combine the forecast accuracy and your initial belief to get a more accurate probability of rain.

Let’s understand the math

Given:
P(Rain) = 0.10 : The prior probability of rain (10%).
P(Forecast says Rain| Rain) = 0.80 : The probability that the forecast predicts rain if it actually rains (80%).
P(Forecast says Rain | No Rain) = 0.20: The probability that the forecast predicts rain if it does not rain (20%).

To Find:
P(Rain| Forecast says Rain): The updated probability of rain given that the forecast says it will rain.

Step-by-Step Calculation:

1. Calculate P(No Rain): P(No Rain) = 1 — P(Rain) = 1–0.10 = 0.90

2. Calculate P(Forecast says Rain): the total probability that the forecast says it will rain
P(Forecast says Rain) = P(Forecast says Rain | Rain) * P(Rain) + P(Forecast says Rain | No Rain) * P(No Rain)
P(Forecast says Rain) = (0.80 * 0.10) + (0.20 * 0.90) ]
P(Forecast says Rain) = 0.08 + 0.18
P(Forecast says Rain) = 0.26

3. Apply Bayes’ Theorem:
P(Rain | Forecast says Rain) = P(Forecast says Rain | Rain) * P(Rain)/P(Forecast says Rain)
P(Rain| Forecast says Rain) = 0.80 * 0.10/ 0.26= approx 0.3077

Given that the forecast says it will rain, the updated probability that it will actually rain today is approximately 30.77%.

2. Prior, Likelihood, and Posterior Probabilities:

— Prior Probability: Represents the initial belief or probability assigned to an event before observing any evidence.
— Likelihood: Quantifies the probability of observing the evidence given the occurrence of the event.
— Posterior Probability: Reflects the updated belief or probability of the event after considering the observed evidence.
— Relationship: Bayes’ theorem provides a formal mechanism for updating the prior probability based on the likelihood of the evidence.

3. Bayesian Inference:
— Essence: Bayesian inference is the process of updating beliefs or making predictions based on observed data using Bayesian probability principles.
— Specify a prior distribution that represents initial beliefs or uncertainty.
— Collect observed data and calculate the likelihood of the data given the model.
— Apply Bayes’ theorem to compute the posterior distribution, incorporating both prior beliefs and observed data.
— Use the posterior distribution for making predictions, estimating parameters, or performing inference tasks.

Bayesian probability offers a flexible and powerful framework for reasoning under uncertainty, enabling data scientists to incorporate prior knowledge, update beliefs based on observed data, and make informed decisions. By understanding the principles of Bayes’ theorem, prior, likelihood, and posterior probabilities, as well as the process of Bayesian inference, data scientists can leverage Bayesian methods to extract valuable insights from data, build robust models, and drive data-driven decision-making processes in diverse domains.

Give it :👏👏👏👏:
If you found this guide helpful , why not show some love? Give it a Clap 👏, and if you have questions or topics you’d like to explore further, drop a comment 💬 below 👇.. If you appreciate my hard work. Please follow me. That is the only way I can continue my Passion.

--

--

Rina Mondal
Women in Technology

I have an 8 years of experience and I always enjoyed writing articles. If you appreciate my hard work, please follow me, then only I can continue my passion.