Conditional Probablity & Bayes’ Theorem for Data Science Table of Contents Conditional Probability The law of total probability Bayes’ Theorem When to use Conditional Probability & when to use Bayes’ Theorem? Let’s think higher together!


Tips on how to approach a real-world problem? Bringing mathematical theorems & data together

Okay. You studied Probability in High School & in College. You realize the best way to calculate Probability of a coin toss or the probabilities of finding a certain coloured ball in a bag. You remember the formula . You remember the definition —

Great! So, I actually have a challenge for you.

In the event you can solve it, be at liberty to skip this blog and provides yourself a pat! But in the event you can’t solve this problem, no must worry either. Just give this blog a read and let’s grow together ❤

Here’s the issue —

How would you go about this? Let’s see.

What is definitely our Problem Statement here?

To estimate how the weather affects punctuality of the flights, after taking a take a look at the provided sample space, we are able to assume that we want to estimate what’s the probability of the flight being late if it’s raining.

How can we calculate this probability?

We have now to calculate the probabilty of the flight arrival being late . From our provided sample space, two data points that heed this use case are P(late, rain) and P(on time,rain).

Hence, the full probability of it raining is P(late, rain) + P(on time,rain).

And, the probability of the flight being late when it’s raining is P(late,rain).

So the probability of the flight being late when there may be rain wil be –

I actually have a follow-up query though.

Suppose, your aunt is arriving on the airport tomorrow and you desire to to know the way likely it’s for her flight to be on time. From the above example, you recall that P (on time| no rain) = 14/20, P (on time | rain) = 1/20.After trying out a weather website, you establish that P (rain) = 0.2. Now, how can we integrate all of this information to estimate the your aunt’s arrival?

Consider, P (late|rain) = 0.75, P (late|no rain) = 0.125.

We have now to calculate the .

Consider three events A, B, and C. Events B and C are distinct from one another (P(rain) and P(no rain)), while event A intersects with each events . We have no idea the probability of event A . Nonetheless, we all know the probability of event A under condition B and the probability of event A under condition C .

The full probability rule states that by utilizing the 2 conditional probabilities, we are able to find the probability of event A.

The formula goes like this —

where, C represents all events A intersects with. In our case , it can be

Just tweaking the formula for conditional probability P(A/B)= P(A ∩ B) / P(B), we get —

Substituting this within the formula for total probability and searching at what information now we have to this point, we are able to create an answer this manner —

We have now the full probability of P(rain). Hence, we are able to calculate total probability of i.e 1 — P(rain).

Now, consider this scenario

You explain above mentioned probabilistic model to your friend. You tell them that your aunt arrived late but you don’t mention if it rained or not. Now, in the event that they need to calculate the probability of it raining, they’ll’t directly consider P(rain)=0.2 as mentioned in the sooner problem.

It’s because now we have to think about the brand new information in regards to the occured event of aunt arriving late to calculate if it rained.

That’s where Bayes Theorem comes into the image.

Bayes’ theorem provides a option to revise existing predictions or theories given recent or additional evidence.

Mathematically, you might represent it as —

P (A|B) = [P (A) *P (B|A)] / P (B)

where, B is the extra information to be considered.

So, now we have to calculate P(rain | late).

We all know that P(rain)=0.2 and P(late) we are able to calculate as = (0.75)*(0.2)+(0.125)*(0.8)=



In on a regular basis situations, conditional probability is a probability where additional information is already known. Finding the probability of a team scoring higher in the following match as they’ve a former Olympian for a coach is a conditional probability in comparison with the probability when a random player is hired as a coach.



What are your thoughts on this topic?
Let us know in the comments below.


0 0 votes
Article Rating
Newest Most Voted
Inline Feedbacks
View all comments

Share this article

Recent posts

Would love your thoughts, please comment.x