These are the slides from a talk given to Vaidya Fellows and others at the Institute of Ayurveda and Integrative Medicine (IAIM). Simple applications of Bayes' Rule show how inference can be done with clarity.
2. Question
If someone is a haemophiliac, what is your probability that this
person is a male?
If someone is a male, what is your probability that this person
is a haemophiliac?
3. Question
If someone is a haemophiliac, what is your probability that this
person is a male?
If someone is a male, what is your probability that this person
is a haemophiliac?
Haemophilia A (clotting factor VIII deficiency) is the most common form of the
disorder, present in about 1 in 5,000–10,000 male births.
6. Willing to be shot if you are wrong!
44%
44%
12%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Male%given%Haemophilia%
88%
12%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Haemophilia*given*Male*
Male given Hemophiliac (n=9) Haemophiliac given Male (n=9)
7. Willing to be shot if you are wrong! And, you are wrong!
44%
44%
12%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Male%given%Haemophilia%
88%
12%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Haemophilia*given*Male*
Male given Hemophiliac (n=9) Haemophiliac given Male (n=9)
8. Placing a 100% probability on anything implies
you are willing to be shot if you are wrong.
9. What if you thought that P(Haemophiliac|Male) =
P(Male|Haemophiliac)?
Male given Hemophiliac (n=9) Haemophiliac given Male (n=9)
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Male%given%Haemophilia%
44%
44%
12%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Haemophilia*given*Male*
88%
12%
0%#
Male%given%Haemophilia%
44%
44%
12%
instead of
10. What if you thought that P(Haemophiliac|Male) =
P(Male|Haemophiliac)?
Male given Hemophiliac (n=9) Haemophiliac given Male (n=9)
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Male%given%Haemophilia%
44%
44%
12%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Haemophilia*given*Male*
88%
12%
0%#
Male%given%Haemophilia%
44%
44%
12%
instead of
Associative Logic Error
11. Examples of Associative Logic Error
Naseeruddin Shah in Court Scene of “Khuda Key Liye”
Deen mey daari hai, daari mey deen nahi
The faithful have beards, but the beard does not have any faith
12. Examples of Associative Logic Error
What is the essence of Jainism?
Cultural Jains: Non-violence and vegetarianism
13. Examples of Associative Logic Error
What is the essence of Jainism?
Cultural Jains: Non-violence and vegetarianism
Mahavira
14. Examples of Associative Logic Error
What is the essence of Jainism?
Cultural Jains: Non-violence and vegetarianism
Mahavira
Essence: Aliveness of the Universe
15. Examples of Associative Logic Error
What is the essence of Jainism?
Cultural Jains: Non-violence and vegetarianism
Mahavira
You cannot die
Essence: Aliveness of the Universe
vs
Suicide
16. Question
If someone has lung cancer, what is your probability that this
person was a smoker?
If someone is a smoker, what is your probability that this
person will get lung cancer?
17. Smoker,(given(lung(cancer(
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Lung%cancer,%given%smoker%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Smoker given Lung Cancer (n=9) Lung Cancer given Smoker (n=9)
What do you notice?
33%
22%
44%
33%
22%
33%
18. 44%
44%
12%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Male%given%Haemophilia%
88%
12%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Haemophilia*given*Male*
Male given Hemophiliac (n=9) Haemophiliac given Male (n=9)
Smoker,(given(lung(cancer(
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Lung%cancer,%given%smoker%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Smoker given Lung Cancer (n=9) Lung Cancer given Smoker (n=9)
What do you notice?
33%
22%
44%
33%
22%
33%
19. 44%
44%
12%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Male%given%Haemophilia%
88%
12%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Haemophilia*given*Male*
Male given Hemophiliac (n=9) Haemophiliac given Male (n=9)
Condition Gender Joint
1 in 5000 males
is haemophiliac
0.01% * 95% =
0.01% * 5% =
99.99% * 50% =
99.99% * 50% =
95% of all hemophilia
cases are male
The Math of Probability
Prior Likelihood
20. 1 in 5000 males
is haemophiliac
95% of all hemophilia
cases are male
Joint
0.01% * 95% =
0.01% * 5% =
99.99% * 50% =
99.99% * 50% =
0.0095%
0.0005%
49.995%
49.995%
The Math of Probability
Condition Gender
Prior Likelihood
21. Joint
0.01% * 95% =
0.01% * 5% =
0.0095%
0.0005%
The Math of Probability
?
?
?
?
Condition Gender
99.99% * 50% =
99.99% * 50% =
49.995%
49.995%
Prior Likelihood
Pre-Posterior Posterior
22. Joint
0.01% * 95% =
0.01% * 5% =
0.0095%
0.0005%
The Math of Probability
Condition Gender
99.99% * 50% =
99.99% * 50% =
49.995%
49.995%
Prior Likelihood
Pre-Posterior Posterior
0.0095%
?
?
49.995%
23. Joint
0.01% * 95% =
0.01% * 5% =
0.0095%
0.0005%
49.995%
0.0005%
The Math of Probability
Condition Gender
99.99% * 50% =
99.99% * 50% =
49.995%
49.995%
Prior Likelihood
Pre-Posterior Posterior
0.0095%
49.995%
26. Joint
0.0095%
0.0005%
49.995%
0.019%
50% 0.0005%
The Math of Probability
Condition Gender
49.995%
49.995%
Prior Likelihood
Pre-Posterior Posterior
0.0095%
49.995%
50%
99.998%
0.001%
99.999%
27. 49.995%
0.019%
50% 0.0005%
The Math of Probability
Pre-Posterior Posterior
0.0095%
49.995%
50%
99.998%
0.001%
99.999%
In this case, your intuition
matched the math!
28. 100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
12%
49.995%
44%
44%
12%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
0.019%
50% 0.0005%
88%
The Math of Probability
Pre-Posterior Posterior
0.0095%
49.995%
50%
99.998%
0.001%
99.999%
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Male%given%Haemophilia%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
0%#
Haemophilia*given*Male*
Male given Hemophiliac (n=9) Haemophiliac given Male (n=9)
In this case, your intuition
matched the math!
29. 100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
12%
49.995%
44%
44%
12%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
0.019%
50% 0.0005%
88%
The Math of Probability
Pre-Posterior Posterior
0.0095%
49.995%
50%
99.998%
0.001%
99.999%
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Male%given%Haemophilia%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
0%#
Haemophilia*given*Male*
Male given Hemophiliac (n=9) Haemophiliac given Male (n=9)
In this case, your intuition
matched the math!
30. Now let’s work this example Instructions:
Smoker,(given(lung(cancer(
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Smoker given Lung Cancer (n=9)
1. Fill in the prior and likelihood
2. Calculate joint probability
3. Flipped tree
4. Place joints correctly
5. Calculate pre-posterior
probability (add up joints)
6. Calculate posterior probability
(divide joint by pre-posterior)
7. Report probability of lung
cancer given smoker
Put the probability you
thought of over here
31. Now let’s work this example
Smoker,(given(lung(cancer(
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Smoker given Lung Cancer (n=9)
Lung%cancer,%given%smoker%
33%
22%
33%
0%# 10%# 20%# 30%# 40%# 50%# 60%# 70%# 80%# 90%# 100%#
100%#
>80%#but#<100%#
>60%#but#<=80%#
>40%#but#<=60%#
>20%#but#<=40%#
>0%#but#<=20%#
0%#
Lung Cancer given Smoker (n=9)
CDC:
19.3%
of
all
Americans
are
smokers
(2010)
Na<onal
Cancer
Ins<tute:
226,000
Americans
in
2012
will
be
diagnosed
with
lung
cancer
US
Census
Bureau:
313
million
people
in
the
US
as
of
Apr
21,2012
%
with
lung
cancer:
0.07%
Lung
Cancer
Prognosis:
8.9%
of
around
25,000
lung
cancer
pa<ents
were
never
smokers;
therefore
91.1%
of
lung
cancer
pa<ents
were
smokers
32. So what’s the big deal about all this?
Bayesian mathematics is how our brain is actually wired.
It is the math of common sense.
Core of machine learning
Spam filters
33. Turns out this is how we normally learn
Alison Gopnik, TED Talk, “What Do Babies Think?”
34. Turns out this is how we normally learn
Alison Gopnik, TED Talk, “What Do Babies Think?”
41. The thing about binomials
Toss n independent coins
p : probability of 1 heads
p(k,n) : probability of getting k heads in n tosses
p(k,n) = C(n,k) * p^k * (1-p)^(n-k)