Professional Documents
Culture Documents
1
-5-
Let E1, E2, E3,…… En be mutually exclusive and exhaustive events associated
with a random experiment, and let A be an event that occurs with some Ei. Then,
Example 1
One of two boxes contains 4 red balls and 2 green balls and the second box contains
4 green and 2 red balls. By design, the probabilities of selecting box 1 or box 2 at random
are 1/3 for box 1 and 2/3 for box 2.
a) Given that the ball selected is red, what is the probability it was selected from the first
box?
b) Given that the ball selected is red, what is the probability it was selected from the
second box?
c) Compare the results in parts a) and b) and explain the answer.
Solution to Example 1
The conditional probability that a selected ball is red given that it is selected from box1
is given by
The conditional probability that a selected ball is red given that it is selected
from box 2 is given by
2
-5-
a. The question is to find the conditional probability that the ball is selected from
box given that it is red, is given by Bayes' theorem.
b. The question is to find the conditional probability that the ball is selected from
box 2 given that it is red, is given by Bayes' theorem.
c. The two probabilities calculated in parts a) and b) are equal. Although there are
more red balls in box1 than in box2 (twice as much), the probabilities calculated
above are equal because the probabilities of selecting box2 is higher (twice as
much) than the probability of selecting box1. Bayes' theorem takes all the
information into consideration.
Example 2
1% of a population have a certain disease and the remaining 99% are free from
this disease. A test is used to detect this disease. This test is positive in 95% of the
people with the disease and is also (falsely) positive in 2% of the people free from the
disease. If a person, selected at random from this population, has tested positive, what
is the probability that she/he has the disease?
Solution to Example 2
3
-5-
The probability that a person has the disease given that it has tested positive is
given by Bayes' theorem:
Note that even when a person tests positive that does not mean that she/he has the
disease; and that is because the number of disease free (99%) is much higher that those
who have the disease (1%).
Let us clarify the results obtained above using some concrete numbers.
Suppose that 1000 people are tested
Disease Free are: 99%×1000=990 and 2%×990=19.8≈20 test positive
People with disease: 1%×1000=10 and 95%×10=9.5=9.5≈10 test positive
Percentage of those who test positive but do not have the disease is:
9.5 / (19.8 + 9.5) = 0.32 which is the probability P(D|TP) computed above.
H.W:
Three factories produce light bulbs to supply the market. Factory A produces 20%,
50% of the tools are produced in factories B and 30% in factory C. 2% of the bulbs
produced in factory A, 1% of the bulbs produced in factory B and 3% of the bulbs
produced in factory C are defective. A bulb is selected at random in the market and found
to be defective. What is the probability that this bulb was produced by factory B?
Bayesian networks
Bayesian networks are a type of probabilistic graphical model that uses Bayesian
inference for probability computations. Bayesian networks aim to model conditional
dependence, and therefore causation, by representing conditional dependence by edges
in a directed graph. Through these relationships, one can efficiently conduct inference on
the random variables in the graph through the use of factors.
4
-5-
T T 0.95 0.05
T F 0.94 0.06
F T 0.29 0.71
F F 0.001 0.999
5
-5-
The alarm ‘A’ node can be ‘true’ or ‘false’ ( i.e may have rung or may not have rung). It
has two parent nodes burglary ‘B’ and fire ‘F’ which can be ‘true’ or ‘false’ (i.e may have
occurred or may not have occurred) depending upon different conditions.
Person ‘P1’ –
A P (P1=T) P (P1=F)
T 0.95 0.05
F 0.05 0.95
The person ‘P1’ node can be ‘true’ or ‘false’ (i.e may have called the person ‘gfg’ or not)
. It has a parent node, the alarm ‘A’, which can be ‘true’ or ‘false’ (i.e may have rung or
may not have rung ,upon burglary ‘B’ or fire ‘F’).
Person ‘P2’ –
A P (P2=T) P (P2=F)
T 0.80 0.20
F 0.01 0.99
The person ‘P2’ node can be ‘true’ or false’ (i.e may have called the person ‘gfg’ or
not). It has a parent node, the alarm ‘A’, which can be ‘true’ or ‘false’ (i.e may have
rung or may not have rung, upon burglary ‘B’ or fire ‘F’).
6
-5-
Disadvantages:
1. Classification costs are high.
2. Large amount of memory required to store the data, and each query involves
starting the identification of a local model from scratch.
7
-5-
Linear models
Generalized linear models GLMs can be used to construct the models for
regression and classification problems by using the type of distribution which best
describes the data or labels given for training the model. Below given are some types
of datasets and the corresponding distributions which would help us in constructing
the model for a particular type of data (The term data specified here refers to
the output data or the labels of the dataset).
1. Binary classification data – Bernoulli distribution
2. Real valued data – Gaussian distribution
3. Count-data – Poisson distribution