20 views

Uploaded by Nicholas Pindar Dibal

doch

- 289803
- Poi 150001
- IDA Review
- Pmr
- BLD 414 Notes
- A Detecção de Proteína Bence Jones Na Urina Pelo Teste de Calor
- Estimation of Area under the ROC Curve Using Exponential and Weibull Distributions
- 3671.ppt
- Comparing the effectiveness of Schirmer's test I and Non-invasive tear break-up time (NITBUT) for the assessment of dry eye among University students: A case-control study
- IMAGE QUALITY ASSESSMENT FOR FAKE BIOMETRIC DETECTION: APPLICATION TO FINGER-VEIN IMAGES.
- Study Guide - Probability and Counting Rules
- 8 - BMI 201 Presentation 8 Scotch
- Simple nomograms to calculate sample size in diagnostic studies.pdf
- 84-6691724a
- Statistical Aspects of Screening Tests
- Introduction to Probability and Statistics From a Bayesian Viewpoint_Part 2
- Stroke-2003-Ramsey-1252-7
- j.1740-9713.2004.026.x
- Silliker 4 System Presentation_Hardy
- Majority Vote and Decision Template Based

You are on page 1of 12

Introduction

Understanding of probability is must for a data science professional. Solutions to many data

science problems are often probabilistic in nature. Hence, a better understanding of probability

will help you understand & implement these algorithms more efficiently.

In this article, I will focus on conditional probability. For beginners in probability, I would strongly

recommend that you go through this article before proceeding further.

example, the probability of a customer from segment A buying a product of category Z in next 10

days is 0.80. In other words, the probability of a customer buying product from Category Z, given

that the customer is from Segment A is 0.80.

In this article, I will walk you through conditional probability in detail. Ill be using examples &

real-life scenarios to help you improve your understanding.

Table of Contents

1. Events Union, Intersection & Disjoint events

2. Independent, Dependent and Exclusive events

3. Conditional Probability

4. Bayes Theorem

5. Probability trees

6. Frequentist vs Bayesian definitions of probability

7. Open Challenges

Before we explore conditional probability, let us define some basic common terminologies:

1.1 EVENTS

An event is simply the outcome of a random experiment. Getting a heads when we toss a coin is

an event. Getting a 6 when we roll a fair die is an event. We associate probabilities to these events

by defining the event and the sample space.

The sample space is nothing but the collection of all possible outcomes of an experiment. This

means that if we perform a particular task again and again, all the possible results of the task are

listed in the sample space.

1

For example: A sample space for a single throw of a die will be {1,2,3,4,5,6}. One of these is

bound to occur if we throw a die. The sample space exhausts all the possibilities that can happen

when that experiment is performed.

We can define an event (C) of getting a 4 or 6 when we roll a fair die. Here event C is a union of

two events:

Event A = Getting a 4

Event B = Getting a 6

P (C) = P (A B)

In simple words we can say that we should consider the probability of (A B) when we are

interested in combined probability of two (or more) events.

Let C be the event of getting a multiple of 2 and 3 when you throw a fair die.

P (C) = P (A B)

2

We can now say that the shaded region is the probability of both events A and B occurring

together.

What if, you come across a case when any two particular events cannot occur at the same time.

For example: Lets say you have a fair die and you have only one throw.

Event A = {3,6}

Event B = {5}

As you can see, there is no case for which event A & B can occur together. Such events are called

disjoint event. To represent this using a Venn diagram:

intersection and disjoint events, we can talk about independence of events.

3

2. Independent, Dependent & Exclusive Events

Suppose we have two events event A and event B.

If the occurrence of event A doesnt affect the occurrence of event B, these events are called

independent events.

Getting heads after tossing a coin AND getting a 5 on a throw of a fair die.

Choosing a marble from a jar AND getting heads after tossing a coin.

Choosing a 3 card from a deck of cards, replacing it, AND then choosing an ace as the

second card.

Rolling a 4 on a fair die, AND then rolling a 1 on a second roll of the die.

In each of these cases the probability of outcome of the second event is not affected at all by the

outcome of the first event.

Lets take an example here. Suppose we win the game if we pick a red marble from a jar containing

4 red and 3 black marbles and we get heads on the toss of a coin. What is the probability of

winning?

We need to find the probability of both getting a red marble and a heads in a coin toss.

P (A) = 4/7

P (B) = 1/2

We know that there is no effect of the color of the marble on the outcome of the coin toss.

P (A B) = P (A) * P (B)

4

In the above example, lets define event A as getting a Red marble from the jar. We then keep the

marble out and then take another marble from the jar.

Will the probabilities in the second case still be the same as that in the first case?

Lets see. So, for the first time there are 4/7 chances of getting a red marble. Lets assume you

got a red marble on the first attempt. Now, for second chance, to get a red marble we have 3/6

chances.

If we didnt get a red marble on the first attempt but a white marble instead. Then, there were 4/6

chances to get the red marble second time. Therefore the probability in the second case was

dependent on what happened the first time.

Quiz 1: If you have a Jack and your next card is dealt with a new deck of cards the probability of

you obtaining a jack again is? Are these events dependent or independent?

Mutually exclusive events are those events where two events cannot happen together.

The easiest example to understand this is the toss of a coin. Getting a head and a tail are mutually

exclusive because we can either get heads or tails but never both at the same in a single coin toss.

A set of events is collectively exhaustive when the set should contain all the possible outcomes of

the experiment. One of the events from the list must occur for sure when the experiment is

performed.

the entire range of the possible outcomes.

Consider the outcomes even (2,4 or 6) and not-6 (1,2,3,4, or 5) in a throw of a fair die. They

are collectively exhaustive but not mutually exclusive.

2. Getting three heads or three tails when three coins are flipped.

3. Conditional Probability

Conditional probabilities arise naturally in the investigation of experiments where an outcome of

a trial may affect the outcomes of the subsequent trials.

5

We try to calculate the probability of the second event (event B) given that the first event (event

A) has already happened. If the probability of the event changes when we take the first event into

consideration, we can safely say that the probability of event B is dependent of the occurrence of

event A.

Drawing a second ace from a deck given we got the first ace

Finding the probability of having a disease given you were tested positive

Finding the probability of liking Harry Potter given we know the person likes fiction

And so on.

Event B is the condition that we know or the event that has happened.

We can write the conditional probability as , the probability of the occurrence of event

A given that B has already happened.

Lets play a simple game of cards for you to understand this. Suppose you draw two cards from a

deck and you win if you get a jack followed by an ace (without replacement). What is the

probability of winning, given we know that you got a jack in the first turn?

We need to find

P(A) = 4/52

6

Here we are determining the probabilities when we know some conditions instead of calculating

random probabilities. Here we knew that he got a jack in the first turn.

Suppose you have a jar containing 6 marbles 3 black and 3 white. What is the probability of

getting a black given the first one was black too.

P (A) = 3/6

P (B) = 2/5

Example: Rahuls favorite breakfast is bagels and his favorite lunch is pizza. The probability of

Rahul having bagels for breakfast is 0.6. The probability of him having pizza for lunch is 0.5. The

probability of him, having a bagel for breakfast given that he eats a pizza for lunch is 0.7.

Lets define event A as Rahul having a bagel for breakfast, Event B as Rahul having a pizza for

lunch.

P (A) = 0.6

P (B) = 0.5

7

If we look at the numbers, the probability of having a bagel is different than the probability of

having a bagel given he has a pizza for lunch. This means that the probability of having a bagel is

dependent on having a pizza for lunch.

Now what if we need to know the probability of having a pizza given you had a bagel for breakfast.

i.e. we need to know . Bayes theorem now comes into the picture.

4. Bayes Theorem

The Bayes theorem describes the probability of an event based on the prior knowledge of the

conditions that might be related to the event. If we know the conditional probability ,

we can use the bayes rule to find out the reverse probabilities .

For the previous example if we now wish to calculate the probability of having a pizza for

lunch provided you had a bagel for breakfast would be = 0.7 * 0.5/0.6.

8

If multiple events Ai form an exhaustive set with another event B.

Lets take the example of the breast cancer patients. The patients were tested thrice before the

oncologist concluded that they had cancer. The general belief is that 1.48 out of a 1000 people

have breast cancer in the US at that particular time when this test was conducted. The patients

were tested over multiple tests. Three sets of test were done and the patient was only diagnosed

with cancer if she tested positive in all three of them.

Lets first compute the probability of having cancer given that the patient tested positive in the

first test.

P (cancer) = 0.00148

Since we do not have any other information, we believe that the patient is a randomly sampled

individual. Hence our prior belief is that there is a 0.148% probability of the patient having cancer.

The complement is that there is a 100 0.148% chance that the patient does not have CANCER.

Similarly we can draw the below tree to denote the probabilities.

9

Lets not try to calculate the probability of having cancer given that he tested positive on the first

test i.e. P (cancer|+)

To calculate the probability of testing positive, the person can have cancer and test positive or he

may not have cancer and still test positive.

This means that there is a 12% chance that the patient has cancer given he tested positive in the

first test. This is known as the posterior probability.

Lets now try to calculate the probability of having cancer given the patient tested positive in the

second test as well.

10

Now remember we will only do the second test if she tested positive in the first one. Therefore

now the person is no longer a randomly sampled person but a specific case. We know something

about her. Hence, the prior probabilities should change. We update the prior probability with the

posterior from the previous test.

Nothing would change in the sensitivity and specificity of the test since were doing the same test

again. Look at the probability tree below.

Lets calculate again the probability of having cancer given she tested positive in the second test.

To calculate the probability of testing positive, the person can have cancer and test positive or she

may not have cancer and still test positive.

Now we see, that a patient who tested positive in the test twice, has a 93% chance of having

cancer.

11

6. Frequentist vs Bayesian Definitions of probability

A frequentist defines probability as an expected frequency of occurrence over large number of

experiments.

The Bayesian view of probability is related to degree of belief. It is a measure of the plausibility

of an event given incomplete knowledge.

The frequentist believes that the population mean is real but unknowable and can only be estimated

from the data. He knows the distribution of the sample mean and constructs a confidence interval

centered at the sample mean. So the actual population mean is either in the confidence interval or

not in it.

This is because he believes that the true mean is a single fixed value and does not have a

distribution. So the frequentist says that 95% of similar intervals would contain the true mean, if

each interval were constructed from a different random sample.

The Bayesian definition has a totally different view point. They use their beliefs to construct

probabilities. They believe that certain values are more believable than others based on the data

and our prior knowledge.

The Bayesian constructs a credible interval centered near the sample mean and totally affected by

the prior beliefs about the mean. The Bayesian can therefore make statements about the population

mean by using the probabilities.

7. Open Challenges

In the cancer example taken above, try calculating the probability of a patient having cancer

provided the patient is tested positive in the third test as well.

In an exam, there is a problem that 60% of students know the correct answer. However,

there is 15% chance that a student picked the wrong answer even if he/she knows the right

answer And there is also a 25% chance that a student does not know the right answer but

guessed it correctly. If a student did get the problem right, what is the chance that this

student really knows the answer?

12

- 289803Uploaded byRatna Ochhalina
- Poi 150001Uploaded byRoberto López Iracheta
- IDA ReviewUploaded byArisa Rosyada
- PmrUploaded byscribmed
- BLD 414 NotesUploaded byshmokeytokey
- A Detecção de Proteína Bence Jones Na Urina Pelo Teste de CalorUploaded byCarla Pereira
- Estimation of Area under the ROC Curve Using Exponential and Weibull DistributionsUploaded byBONFRING
- 3671.pptUploaded byKharisma Rizqiah Wahyuni
- Comparing the effectiveness of Schirmer's test I and Non-invasive tear break-up time (NITBUT) for the assessment of dry eye among University students: A case-control studyUploaded byEditor IJTSRD
- IMAGE QUALITY ASSESSMENT FOR FAKE BIOMETRIC DETECTION: APPLICATION TO FINGER-VEIN IMAGES.Uploaded byIJAR Journal
- Study Guide - Probability and Counting RulesUploaded byAlbert John
- 8 - BMI 201 Presentation 8 ScotchUploaded byPedroMartins
- Simple nomograms to calculate sample size in diagnostic studies.pdfUploaded byAbas Suherli
- 84-6691724aUploaded byDorin Triff
- Statistical Aspects of Screening TestsUploaded byShairuz Caesar Briones Dugay
- Introduction to Probability and Statistics From a Bayesian Viewpoint_Part 2Uploaded bylovedigger
- Stroke-2003-Ramsey-1252-7Uploaded byTeuku M. Febriansyah
- j.1740-9713.2004.026.xUploaded bysjalum22
- Silliker 4 System Presentation_HardyUploaded bypdiaz79
- Majority Vote and Decision Template BasedUploaded byAzizi van Abdullah
- BaxterUploaded byasghar
- 47.IJMPERDAPR201947Uploaded byTJPRC Publications
- TJMCS2014Uploaded byAshraf Sayed Abdou
- faktor inflamasi baruUploaded byDidi Alfadani
- 11 Maths Important Questions Chapter16 ProbabilityUploaded byRoy
- Example 3Uploaded bysum
- A Decrease of Human Leucocyte Antigen-DR Expression OnUploaded byRido Banar Ekaputra
- ICSOLpaperUploaded byKusumaningrum Wijayanti
- 9e326566e2e23c17980e228de7169ddf5a27Uploaded byTanveer
- skittlesUploaded byapi-339610059

- RrrrrrrUploaded byNicholas Pindar Dibal
- Hoteling R CodeUploaded byNicholas Pindar Dibal
- EulaUploaded byKotol
- practoUploaded byNicholas Pindar Dibal
- code last day.txtUploaded byNicholas Pindar Dibal
- Draft Sup ThesisUploaded byNicholas Pindar Dibal
- Import RdataUploaded byNicholas Pindar Dibal
- Final Code Note 2Uploaded byNicholas Pindar Dibal
- Code Last DayUploaded byNicholas Pindar Dibal
- Table 4.docxUploaded byNicholas Pindar Dibal
- agunsoyUploaded byNicholas Pindar Dibal
- Table 4Uploaded byNicholas Pindar Dibal
- Farewell Speech by TheUploaded byNicholas Pindar Dibal
- Missingness and OutliersUploaded byNicholas Pindar Dibal
- Research Proposal to UniversityUploaded byNicholas Pindar Dibal
- Peronal LetterheadedUploaded byNicholas Pindar Dibal

- 8 Ways to Raise Your VibrationUploaded byAmarrdiip Siingh
- ICT Hub Think Tank - New Media Case StudiesUploaded byBlackpool Community News at Scribd
- Capabilities Marine RisersUploaded bymesserklinge
- Ureaplasma urealiticumUploaded byChristianGB
- Quality ControlUploaded byMiguelThax
- Separating Fact From Fiction in the IoniUploaded byKoray Konuk
- [International Series on Microprocessor-Based and Intelligent Systems Engineering 23] John Harris (Auth.) - An Introduction to Fuzzy Logic Applications (2000, Springer Netherlands)Uploaded bysrikaanth3811
- 448_Lee Hooper DehydrationUploaded bySafriDarmaputra
- Active Manual EnglishUploaded byNashwan Hamoud Alwarafi
- A Guide to Conducting a Systematic Literature Review OfUploaded byDarryl Wallace
- PCR 702Uploaded byGuvnor Zhiwomi Iyakwari
- Final ReportUploaded bySparsh Geraa
- Biophys 2011-10-20Uploaded byOwen Brazil
- Chanduví Analysis - ValuesUploaded byJosephine Fisher
- CHAPTER IUploaded byAR Aye Cee
- Moms Exam 1 Study GuideUploaded byNate Demissie
- MODULE 6Uploaded bySim Belsondra
- OPJ -3D Printing for Urban DesignUploaded byrobert voigt
- sciencelessonUploaded byapi-345123708
- Nano FluidsUploaded bystonexcold
- Wick and Bult 2009Uploaded byNikolaRadojičić
- 1mark MCQUploaded bysrivaas131985
- PhiloUploaded by'mCharity Tonii
- Analysis - WikipediaUploaded byJohn
- PetroScan June 2016Uploaded byVenu Angirekula
- Organizations Wants to Make Consumer More RationalUploaded byPunit Nema
- TablesUploaded bybob
- AT Command Set for Nokia GSM Products.pdfUploaded byHao Nv
- Affiliated Colleges With CSVTUUploaded byamitwwe007
- 40583%28275%2977Uploaded bysanpornu