Explore Courses
Liverpool Business SchoolLiverpool Business SchoolMBA by Liverpool Business School
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA (Master of Business Administration)
  • 15 Months
Popular
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Business Administration (MBA)
  • 12 Months
New
Birla Institute of Management Technology Birla Institute of Management Technology Post Graduate Diploma in Management (BIMTECH)
  • 24 Months
Liverpool John Moores UniversityLiverpool John Moores UniversityMS in Data Science
  • 18 Months
Popular
IIIT BangaloreIIIT BangalorePost Graduate Programme in Data Science & AI (Executive)
  • 12 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with concentration in Generative AI
  • 3 Years
upGradupGradData Science Bootcamp with AI
  • 6 Months
New
University of MarylandIIIT BangalorePost Graduate Certificate in Data Science & AI (Executive)
  • 8-8.5 Months
upGradupGradData Science Bootcamp with AI
  • 6 months
Popular
upGrad KnowledgeHutupGrad KnowledgeHutData Engineer Bootcamp
  • Self-Paced
upGradupGradCertificate Course in Business Analytics & Consulting in association with PwC India
  • 06 Months
OP Jindal Global UniversityOP Jindal Global UniversityMaster of Design in User Experience Design
  • 12 Months
Popular
WoolfWoolfMaster of Science in Computer Science
  • 18 Months
New
Jindal Global UniversityJindal Global UniversityMaster of Design in User Experience
  • 12 Months
New
Rushford, GenevaRushford Business SchoolDBA Doctorate in Technology (Computer Science)
  • 36 Months
IIIT BangaloreIIIT BangaloreCloud Computing and DevOps Program (Executive)
  • 8 Months
New
upGrad KnowledgeHutupGrad KnowledgeHutAWS Solutions Architect Certification
  • 32 Hours
upGradupGradFull Stack Software Development Bootcamp
  • 6 Months
Popular
upGradupGradUI/UX Bootcamp
  • 3 Months
upGradupGradCloud Computing Bootcamp
  • 7.5 Months
Golden Gate University Golden Gate University Doctor of Business Administration in Digital Leadership
  • 36 Months
New
Jindal Global UniversityJindal Global UniversityMaster of Design in User Experience
  • 12 Months
New
Golden Gate University Golden Gate University Doctor of Business Administration (DBA)
  • 36 Months
Bestseller
Ecole Supérieure de Gestion et Commerce International ParisEcole Supérieure de Gestion et Commerce International ParisDoctorate of Business Administration (DBA)
  • 36 Months
Rushford, GenevaRushford Business SchoolDoctorate of Business Administration (DBA)
  • 36 Months
KnowledgeHut upGradKnowledgeHut upGradSAFe® 6.0 Certified ScrumMaster (SSM) Training
  • Self-Paced
KnowledgeHut upGradKnowledgeHut upGradPMP® certification
  • Self-Paced
IIM KozhikodeIIM KozhikodeProfessional Certification in HR Management and Analytics
  • 6 Months
Bestseller
Duke CEDuke CEPost Graduate Certificate in Product Management
  • 4-8 Months
Bestseller
upGrad KnowledgeHutupGrad KnowledgeHutLeading SAFe® 6.0 Certification
  • 16 Hours
Popular
upGrad KnowledgeHutupGrad KnowledgeHutCertified ScrumMaster®(CSM) Training
  • 16 Hours
Bestseller
PwCupGrad CampusCertification Program in Financial Modelling & Analysis in association with PwC India
  • 4 Months
upGrad KnowledgeHutupGrad KnowledgeHutSAFe® 6.0 POPM Certification
  • 16 Hours
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Science in Artificial Intelligence and Data Science
  • 12 Months
Bestseller
Liverpool John Moores University Liverpool John Moores University MS in Machine Learning & AI
  • 18 Months
Popular
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with concentration in Generative AI
  • 3 Years
IIIT BangaloreIIIT BangaloreExecutive Post Graduate Programme in Machine Learning & AI
  • 13 Months
Bestseller
IIITBIIITBExecutive Program in Generative AI for Leaders
  • 4 Months
upGradupGradAdvanced Certificate Program in GenerativeAI
  • 4 Months
New
IIIT BangaloreIIIT BangalorePost Graduate Certificate in Machine Learning & Deep Learning (Executive)
  • 8 Months
Bestseller
Jindal Global UniversityJindal Global UniversityMaster of Design in User Experience
  • 12 Months
New
Liverpool Business SchoolLiverpool Business SchoolMBA with Marketing Concentration
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA with Marketing Concentration
  • 15 Months
Popular
MICAMICAAdvanced Certificate in Digital Marketing and Communication
  • 6 Months
Bestseller
MICAMICAAdvanced Certificate in Brand Communication Management
  • 5 Months
Popular
upGradupGradDigital Marketing Accelerator Program
  • 05 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Corporate & Financial Law
  • 12 Months
Bestseller
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in AI and Emerging Technologies (Blended Learning Program)
  • 12 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Intellectual Property & Technology Law
  • 12 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Dispute Resolution
  • 12 Months
upGradupGradContract Law Certificate Program
  • Self paced
New
ESGCI, ParisESGCI, ParisDoctorate of Business Administration (DBA) from ESGCI, Paris
  • 36 Months
Golden Gate University Golden Gate University Doctor of Business Administration From Golden Gate University, San Francisco
  • 36 Months
Rushford Business SchoolRushford Business SchoolDoctor of Business Administration from Rushford Business School, Switzerland)
  • 36 Months
Edgewood CollegeEdgewood CollegeDoctorate of Business Administration from Edgewood College
  • 24 Months
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with Concentration in Generative AI
  • 36 Months
Golden Gate University Golden Gate University DBA in Digital Leadership from Golden Gate University, San Francisco
  • 36 Months
Liverpool Business SchoolLiverpool Business SchoolMBA by Liverpool Business School
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA (Master of Business Administration)
  • 15 Months
Popular
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Business Administration (MBA)
  • 12 Months
New
Deakin Business School and Institute of Management Technology, GhaziabadDeakin Business School and IMT, GhaziabadMBA (Master of Business Administration)
  • 12 Months
Liverpool John Moores UniversityLiverpool John Moores UniversityMS in Data Science
  • 18 Months
Bestseller
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Science in Artificial Intelligence and Data Science
  • 12 Months
Bestseller
IIIT BangaloreIIIT BangalorePost Graduate Programme in Data Science (Executive)
  • 12 Months
Bestseller
O.P.Jindal Global UniversityO.P.Jindal Global UniversityO.P.Jindal Global University
  • 12 Months
WoolfWoolfMaster of Science in Computer Science
  • 18 Months
New
Liverpool John Moores University Liverpool John Moores University MS in Machine Learning & AI
  • 18 Months
Popular
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with concentration in Generative AI
  • 3 Years
Rushford, GenevaRushford Business SchoolDoctorate of Business Administration (AI/ML)
  • 36 Months
Ecole Supérieure de Gestion et Commerce International ParisEcole Supérieure de Gestion et Commerce International ParisDBA Specialisation in AI & ML
  • 36 Months
Golden Gate University Golden Gate University Doctor of Business Administration (DBA)
  • 36 Months
Bestseller
Ecole Supérieure de Gestion et Commerce International ParisEcole Supérieure de Gestion et Commerce International ParisDoctorate of Business Administration (DBA)
  • 36 Months
Rushford, GenevaRushford Business SchoolDoctorate of Business Administration (DBA)
  • 36 Months
Liverpool Business SchoolLiverpool Business SchoolMBA with Marketing Concentration
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA with Marketing Concentration
  • 15 Months
Popular
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Corporate & Financial Law
  • 12 Months
Bestseller
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Intellectual Property & Technology Law
  • 12 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Dispute Resolution
  • 12 Months
IIITBIIITBExecutive Program in Generative AI for Leaders
  • 4 Months
New
IIIT BangaloreIIIT BangaloreExecutive Post Graduate Programme in Machine Learning & AI
  • 13 Months
Bestseller
upGradupGradData Science Bootcamp with AI
  • 6 Months
New
upGradupGradAdvanced Certificate Program in GenerativeAI
  • 4 Months
New
KnowledgeHut upGradKnowledgeHut upGradSAFe® 6.0 Certified ScrumMaster (SSM) Training
  • Self-Paced
upGrad KnowledgeHutupGrad KnowledgeHutCertified ScrumMaster®(CSM) Training
  • 16 Hours
upGrad KnowledgeHutupGrad KnowledgeHutLeading SAFe® 6.0 Certification
  • 16 Hours
KnowledgeHut upGradKnowledgeHut upGradPMP® certification
  • Self-Paced
upGrad KnowledgeHutupGrad KnowledgeHutAWS Solutions Architect Certification
  • 32 Hours
upGrad KnowledgeHutupGrad KnowledgeHutAzure Administrator Certification (AZ-104)
  • 24 Hours
KnowledgeHut upGradKnowledgeHut upGradAWS Cloud Practioner Essentials Certification
  • 1 Week
KnowledgeHut upGradKnowledgeHut upGradAzure Data Engineering Training (DP-203)
  • 1 Week
MICAMICAAdvanced Certificate in Digital Marketing and Communication
  • 6 Months
Bestseller
MICAMICAAdvanced Certificate in Brand Communication Management
  • 5 Months
Popular
IIM KozhikodeIIM KozhikodeProfessional Certification in HR Management and Analytics
  • 6 Months
Bestseller
Duke CEDuke CEPost Graduate Certificate in Product Management
  • 4-8 Months
Bestseller
Loyola Institute of Business Administration (LIBA)Loyola Institute of Business Administration (LIBA)Executive PG Programme in Human Resource Management
  • 11 Months
Popular
Goa Institute of ManagementGoa Institute of ManagementExecutive PG Program in Healthcare Management
  • 11 Months
IMT GhaziabadIMT GhaziabadAdvanced General Management Program
  • 11 Months
Golden Gate UniversityGolden Gate UniversityProfessional Certificate in Global Business Management
  • 6-8 Months
upGradupGradContract Law Certificate Program
  • Self paced
New
IU, GermanyIU, GermanyMaster of Business Administration (90 ECTS)
  • 18 Months
Bestseller
IU, GermanyIU, GermanyMaster in International Management (120 ECTS)
  • 24 Months
Popular
IU, GermanyIU, GermanyB.Sc. Computer Science (180 ECTS)
  • 36 Months
Clark UniversityClark UniversityMaster of Business Administration
  • 23 Months
New
Golden Gate UniversityGolden Gate UniversityMaster of Business Administration
  • 20 Months
Clark University, USClark University, USMS in Project Management
  • 20 Months
New
Edgewood CollegeEdgewood CollegeMaster of Business Administration
  • 23 Months
The American Business SchoolThe American Business SchoolMBA with specialization
  • 23 Months
New
Aivancity ParisAivancity ParisMSc Artificial Intelligence Engineering
  • 24 Months
Aivancity ParisAivancity ParisMSc Data Engineering
  • 24 Months
The American Business SchoolThe American Business SchoolMBA with specialization
  • 23 Months
New
Aivancity ParisAivancity ParisMSc Artificial Intelligence Engineering
  • 24 Months
Aivancity ParisAivancity ParisMSc Data Engineering
  • 24 Months
upGradupGradData Science Bootcamp with AI
  • 6 Months
Popular
upGrad KnowledgeHutupGrad KnowledgeHutData Engineer Bootcamp
  • Self-Paced
upGradupGradFull Stack Software Development Bootcamp
  • 6 Months
Bestseller
KnowledgeHut upGradKnowledgeHut upGradBackend Development Bootcamp
  • Self-Paced
upGradupGradUI/UX Bootcamp
  • 3 Months
upGradupGradCloud Computing Bootcamp
  • 7.5 Months
PwCupGrad CampusCertification Program in Financial Modelling & Analysis in association with PwC India
  • 5 Months
upGrad KnowledgeHutupGrad KnowledgeHutSAFe® 6.0 POPM Certification
  • 16 Hours
upGradupGradDigital Marketing Accelerator Program
  • 05 Months
upGradupGradAdvanced Certificate Program in GenerativeAI
  • 4 Months
New
upGradupGradData Science Bootcamp with AI
  • 6 Months
Popular
upGradupGradFull Stack Software Development Bootcamp
  • 6 Months
Bestseller
upGradupGradUI/UX Bootcamp
  • 3 Months
PwCupGrad CampusCertification Program in Financial Modelling & Analysis in association with PwC India
  • 4 Months
upGradupGradCertificate Course in Business Analytics & Consulting in association with PwC India
  • 06 Months
upGradupGradDigital Marketing Accelerator Program
  • 05 Months

Conditional Probability Explained with Real Life Applications

Updated on 14 November, 2024

10.4K+ views
6 min read

What Is Conditional Probability?

Conditional probability, in probability theory, is defined as the measure of the likelihood of an event occurring, assuming that another event or outcome has previously occurred. It is expressed as the multiplication of the probability of the previously occurred event with the probability of the conditional event that has occurred in succession. 

So, if we have events A and B where P(B)>0, we calculate the conditional probability of A when B has already occurred, P(A | B) as

P(A | B)=P(A∩B)P(B)

  • | is used to denote “given” in “cases where another event occurs”
  • ∩ is used to denote intersection

While computing the conditional probability, it is assumed that we are aware of the outcome of event B. This is especially useful since the information of an experiment’s outcome is often unknown. 

Let’s understand this with an example: 

  • We have an event A where we assume that an individual who has applied to a university will be accepted. The probability of them getting accepted is 70%. 
  • We have another event B where there is a 50% chance that accepted students will be assigned dormitory housing. 

Hence, we calculate the conditional probability as, 

Probability (Students Accepted and Dormitory Assigned) = P (Dormitory Assigned | Students Accepted) × P (Students Accepted)

= (0.50)*(0.70) = 0.35

With conditional probability, we are looking at both events A and B, their relationship with each other where a student is both accepted to the university and is assigned dormitory housing.

In contrast, unconditional probability is defined as the measure of the probability that an event will occur regardless of whether it is preceded by another event or has other conditions given.

Real-Life Applications of Conditional Probability

Conditional probability finds extensive use in different fields such as insurance and calculus. It is also applicable in politics. Let’s assume there is an expected re-election of a president. The results will depend on the preferences of those eligible to vote and the probability of the outcome of television advertising campaigns. 

In another example, let’s assume that the probability of rain in your area is 40% as specified by the weather. However, this outcome is largely dependent on:

  • Whether there are clouds forming in your area
  • Whether there is the possibility of a cold front arriving in your area
  • Whether the clouds are being pushed away by another front

The conditional probability will depend on each of the above events. 

Bayes’ Theorem

Introduced by mathematician Thomas Bayes, Bayes’ theorem or Bayes’ Rule or Bayes’ Law is a mathematical equation that helps calculate conditional probability. Using Bayes’ theorem, we can revise (update) existing measures of probability when new evidence or additional information comes to light.

Bayes’ theorem finds use in finance where accountants use it to determine the risk of loaning money to a borrower. In addition to this, it is also useful in statistics and inductive logic.

Bayesian statistics is based on Bayes’ theorem where it is possible to predict events on the basis of new evidence, thereby leading to more dynamic and accurate estimates. 

Enrol for the Machine Learning Course from the World’s top Universities. Earn Masters, Executive PGP, or Advanced Certificate Programs to fast-track your career.

Conditional Probability Example with Python

In this example, we will use conditional probability to determine the probability of a student getting an A grade (80%+) in Physics, provided that they skip a minimum of 10 classes.

To begin with, inspect the dataset you download from kaggle:

import pandas as pd

df = pd.read_csv(‘student-alcohol-consumption/student-mat.csv’)

df.head(3)
Go through the number of records:

len(df)

#=> 395

We will only take the following columns into account: the number of absences and final grades.

Now, create a new boolean column grade_A to show if a student’s final score is 80% or higher. 

Multiply by 5:

df[‘grade_A’] = np.where(df[‘G3’]*5 >= 80, 1, 0)

Create a new boolean column high_absenses having value 1 denoting students who missed a minimum of 10 classes.

df[‘high_absenses’] = np.where(df[‘absences’] >= 10, 1, 0)

Create another column so we can easily build a pivot table:

df[‘count’] = 1

Remove all the other columns:

df = df[[‘grade_A’,’high_absenses’,’count’]]

df.head()

Building a pivot table:

pd.pivot_table(

    df, 

    values=’count’, 

    index=[‘grade_A’], 

    columns=[‘high_absenses’], 

    aggfunc=np.size, 

    fill_value=0

     )

Now, we can proceed to our calculation: 

  • P(A) denotes the probability of a student scoring an A grade (80% or greater).
  • P(B) is the probability that a student has missed a minimum of 10 classes.
  • P(A|B) is the probability that a student has scored an 80%+ grade, given that he/she missed a minimum of 10 classes. 

P(A) = (35 + 5) / (35 + 5 + 277 + 78) = 0.10126…

P(B) = (78 + 5) / (35 + 5 + 277 + 78) = 0.21012…

P(A ∩ B) = 5 / (35 + 5 + 277 + 78) = 0.0126582…

P(A|B) = P(A ∩ B) / P(B) = 0.06

As per our calculations, the probability that a student has scored an 80%+ grade, given that he/she missed a minimum of 10 classes is at least 6%.

Conditional Probability of Independent Events

We also have events, say A and B where both are independent events, which means the occurrence of event A has no relation with the occurrence of event B.

In such a case, the conditional probability P(B|A) is essentially P(B). 

P(B|A)= P(B)

Similarly, the conditional probability P(A|B) is essentially P(A).

 P(A|B)= P(A)

Conditional Probability of Mutually Exclusive Events

As per probability theory, when we talk about events that can not occur at the same time, we are talking about mutually exclusive. To put it simply, if event A has occurred, event B cannot occur simultaneously. Therefore, in such cases, the probability is always zero.

P(B|A)= 0 and P(A|B)= 0

Law of Total Probability

We use the multiplication rule to determine the probability of complex cases. 

As per the multiplication rule, we calculate the probability of events, E and F, both of which are observing events, by multiply the probability of the observing event F and observing event E, given that event F has already been observed.

P( E1 ⋂ E2 ⋂….. ⋂En)=P( E1) P(E2 | E1)………P(En | E1…………En-1)

Now, let’s assume we have a sample space S comprising three disjoint events X, Y, Z. Therefore

P(A)=P(A ⋂ X) +P(A ⋂ Y) +P(A ⋂ Z)

Now, as per the multiplication rule, the law of total probability can be expressed as 

 P(A)= P(A|X) P(X) +P(A|Y) P(Y) +P(A| Z) P(Z)

Conclusion

Understanding conditional probability is necessary to master complex probability estimations that are carried out using Bayes’ theorem. If you’d like to learn in-depth about conditional probability and the Bayes’ theorem, we recommend joining our Master of Science in Machine Learning & AI

upGrad’s platform of 40,000+ provides opportunities for peer-to-peer collaboration and 360° job assistance at top firms. With rigorous training through hands-on projects, case studies, live lectures, students can master the complicated concepts of probability and leverage them to deploy Machine Learning models. 

Lead the AI-driven technological revolution. Apply Now! 

Frequently Asked Questions (FAQs)

1. What is Joint Probability?

It is the measure of the probability of two events occurring simultaneously at the same point in time. In simple words, joint probability the likelihood of event B occurring at the same point in time as event A.

2. Is conditional probability commutative or not?

It is not commutative.

3. What is the need for conditional probability?

Conditional probability makes it easier to estimate the probability of an event based on the conditioned evidence which depends on first principles.