1. Uncertainty and Decision Theory
2. Basic Prob. Theory
3. Prior and posterior probabilities
4. Bayes' Rule
5. Random variable
6. Different types of probability distribution
2. Uncertainty
Agents may need to handle uncertainty, whether due to
βΈPartial observability β partial sensor information whatβs my current state!
βΈNondeterminism β what will be the state after performing a sequence of action!
βΈOr a combination of both.
Our previous agents (problem solving, logical) handle uncertainty by
βΈKeeping track of a belief state - a representation of the set of all possible world states that it might be in.
βΈGenerating a contingency plan that handles every possible eventuality that its sensors may report during execution.
Problems:
βΈImpossibly large and complex belief-state representation due to partial observability
βΈContingent plan can grow arbitrarily large and unlikely contingencies
βΈHow to compare the merits of one plan with another if no guarantee to reach the goal can be assured.
2
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
3. Uncertainty >> Diagnosis problem
Problem: A dental patientβs toothache
Way 1:
Toothache β Cavity
But there exists a lot more reasons for Toothache β¦ β¦
Toothache β Cavity v GumProblem v Abscess β¦ β¦
Way 2(reverse):
Cavity β Toothache
But not all cavities cause pain.
Diagnosis Problem Complexities:
βΈLaziness
βΈTheoretical ignorance
βΈPractical ignorance
3
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
4. Uncertainty >> Diagnosis problem
Problem: A dental patientβs toothache
Way 1:
Toothache β Cavity
But there exists a lot more reasons for Toothache β¦ β¦
Toothache β Cavity v GumProblem v Abscess β¦ β¦
Way 2(reverse):
Cavity β Toothache
But not all cavities cause pain.
Complexities:
βΈLaziness
βΈTheoretical ignorance
βΈPractical ignorance
4
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
Can we reach a
logical decision from
either direction!!!!
5. Uncertainty >> Diagnosis problem
Problem: A dental patientβs toothache
Way 1:
Toothache β Cavity
But there exists a lot more reasons for Toothache β¦ β¦
Toothache β Cavity v GumProblem v Abscess β¦ β¦
Way 2(reverse):
Cavity β Toothache
But not all cavities cause pain.
Complexities:
βΈLaziness
βΈTheoretical ignorance
βΈPractical ignorance
5
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
Can we reach a
logical decision from
either direction!!!!
An agent can at best
provide a degree of
belief that is
probability
6. Decision Theory
Logical Agent
β believes each sentence to be true/false/has no opinion.
Probabilistic Agent
β determines the numerical degree of belief for each sentence between 0 and 1.
β provides a way of summarizing the uncertainty that comes from our laziness and ignorance.
β probability statements are made with respect to a knowledge state, not with respect to the real world.
Decision Theory
β An agent is rational if and only if it chooses the action that yields the highest expected utility, averaged over
all the possible outcomes of the action.
Decision Theory = Probability theory + Utility theory
Probability Theory β agent can make probabilistic predictions of action outcomes
Utility Theory β select the action with highest expected utility.
6
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
7. Probability Theory >> Sample Space
Sample space(π) :
The set of all possible worlds(π) is called the sample space.
The possible worlds i.e. πβs are
ο§ Mutually exclusive β two possible worlds canβt both be the case
ο§ Exhaustive β one possible world must be the case
For example,
7
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
Experiment Sample Space
Flipping a coin {H, T}
Tossing a die {1, 2, 3, 4, 5, 6}
Flipping a coin and then flipping it a second time if a head occurs. If a tail
occurs on the first flip, then a die is tossed once.
{HH, HT, T1, T2, T3, T4, T5, T6}
Three items are selected at random from a manufacturing process. Each item
is inspected and classified defective, D, or, non-defective, N
{DDD, DDN, DND, DNN,
NDD, NDN, NND, NNN}
14. Probability Theory >> Additive Rule
Example 2:
If the probabilities are, respectively, 0.09, 0.15, 0.21, and 0.23 that a person purchasing a new automobile will
choose the color green, white, red, or blue, what is the probability that a given buyer will purchase a new automobile that
comes in one of those colors?
Soln :
Event a = purchasing a green automobile
Event b = purchasing a white automobile
Event c = purchasing a red automobile
Event d = purchasing a blue automobile
So,
P(a U b U c U d) = P(a) + P(b) + P(c) + P(d) = 0.09 + 0.15 + 0.21 + 0.23 = 0.68
14
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
15. Probability Theory >> Complement Rule
If π and πβ are complementary events then,
P(π) + P(πβ) = 1
Example 1:
If the probabilities that an automobile mechanic will service 3, 4, 5, 6, 7, or 8 or more cars on any given workday
are, respectively, 0.12, 0.19, 0.28, 0.24, 0.10, and 0.07, what is the probability that he will service at least 5 cars on his next day
at work?
Soln :
Event a = servicing at least 5 cars
Event aβ = servicing less than 5 cars
Here,
P(aβ) = 0.12 + 0.19 = 0.31
So P(a) = 1 β P(aβ) = 1 β 0.31 = 0.69
15
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
25. Probability Theory >> Bayesβ Rule
Example 2:
A manufacturing firm employs three analytical plans for the design and development of a particular product.
For cost reasons, all three are used at varying times. In fact, plans 1, 2, and 3 are used for 30%, 20%, and 50% of the products,
respectively. The defect rate is different for the three procedures as follows: P(D|P1) = 0.01, P(D|P2) = 0.03, P(D|P3) = 0.02,
where P(D|Pj) is the probability of a defective product, given plan j. If a random product was observed and found to be
defective, which plan was most likely used and thus responsible?
Soln:
P(p1 | D) =
π π1 π(π·|π1)
π π1 π(π·|π1)+π π2 π(π·|π2)+π π3 π(π·|π3)
= 0.158
P(p2 | D) =
π π2 π(π·|π2)
π π1 π(π·|π1)+π π2 π(π·|π2)+π π3 π(π·|π3)
= 0.316
P(p3 | D) =
π π3 π(π·|π3)
π π1 π(π·|π1)+π π2 π(π·|π2)+π π3 π(π·|π3)
= 0.526
Plan 3 is most likely as the probability is higher.
25
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
26. Probability Theory >> Bayesβ Rule - Practices
Problem 1 >>
A diagnostic test has a probability 0.95 of giving a positive result when applied to a person suffering from a
certain disease, and a probability 0.10 of giving a (false) positive when applied to a non-sufferer. It is estimated that 0.5% of
the population are sufferers. Suppose that the test is now administered to a person about whom we have no relevant
information relating to the disease (apart from the fact that he/she comes from this population). Calculate the following
probabilities:
(a) that the test result will be positive;
(b) that, given a positive result, the person is a sufferer;
(c) that, given a negative result, the person is a non-sufferer;
(d) that the person will be misclassified.
Answer: 0.10425, 0.0455, 0.9997, 0.09975
26
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
27. Probability Theory >> Bayesβ Rule - Practices
Problem 2 >>
There are two boxes containing coins. The first box contains 60 gold coins and 40 silver coins. The second box
contains 30 gold coins and 70 silver coins. One of the two boxes is randomly chosen (both boxes have probability 0.5 of
being chosen) and then a coin is picked up at random from the chosen box. If a silver coin is picked up, what is the
probability that it comes from the first box?
Answer: 4/11
27
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
28. Probability Theory >> Bayesβ Rule - Practices
Problem 3 >>
Alice has two coins in her pocket, a fair coin (head on one side and tail on the other side) and a two-headed
coin (head on both sides). She picks one at random from her pocket, tosses it and obtains head. What is the probability that
she flipped the fair coin?
Answer: 1/3
28
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
29. Probability Theory >> Random Variable
A random variable has a domain of possible values. Each value has an assigned probability between 0 and 1. Random
variable names start with Uppercase letter and values are all Lowercase. The values are:
βΈMutually Exclusive (disjoint) β only one of them are true
βΈComplete β there is always one that is true
Discrete random variable β set of possible outcomes is countable.
For example, The random variable Weather has domain of possible values {sunny, rain, cloudy, snow}. The assigned
probabilities are as follow:
P(Weather=sunny) = 0.7
P(Weather=rain) = 0.2
P(Weather=cloudy) = 0.08
P(Weather=snow) = 0.02
Probability of all the possible values a random variable is represented as a vector of numbers and is called Probability
Distribution.
P(Weather) = 0.7, 0.2, 0.08, 0.02
29
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
30. Probability Theory >> Probability Distribution - Discrete
Discrete Probability Distribution:
- A vector of numbers representing the probabilities of all the possible values of a random variable.
- For example, P(Weather) = 0.6, 0.1, 0.29, 0.01 assuming predefined order π π’πππ¦, ππππ, ππππ’ππ¦, π πππ€
- Tabular representation:
- If X represents a random variable, then for each possible outcome x of X,
ΰ·
π₯
P(X = x) = 1
30
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
w sunny rain cloudy Snow
P(Weather = w) 0.6 0.1 0.29 0.01
31. Probability Theory >> Probability Distribution - Conditional
Conditional Probability Distribution:
- P(X | Y) = vector of numbers representing the probabilities of P(X=xi | Y=yj) for each possible i, j
- Tabular representation of the conditional probability distribution of random variable A, given the evidence random
variables B and C
- Sum of the probabilities for each row is 1
31
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
B C P(A=+a|B,C) P(A= -a|B,C)
+b +c 0.95 0.05
+b -c 0.94 0.06
-b +c 0.29 0.71
-b -c 0.001 0.999
32. Probability Theory >> Probability Distribution - Joint
Joint Probability Distribution:
- Probability distributions of multiple random variables.
- Consider all possible combinations of values of the variables.
- Tabular representation of the joint distribution of two random variables Weather and Season is as follow:
P(Weather, Season)
- If X and Y represents two random variables then,
Ο π₯ Ο π¦ π(π = π₯, π = π¦) = 1
32
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
Weather
Season
Sunny Rain Cloud Snow
Spring 0.07 0.03 0.10 0.06
Summer 0.13 0.01 0.05 0.01
Autumn 0.05 0.05 0.15 0.03
Winter 0.05 0.01 0.10 0.10
33. Probability Theory >> Probability Distribution β Full Joint
Full Joint Probability Distribution:
- Full joint probability distribution is a joint distribution for all of the random variables.
- It can be considered as the βknowledge baseβ from which answers to all questions may be derived.
- For example, full joint distribution for the Toothache, Cavity, Catch world is as follow,
- For example,
- P(cavity β¨ toothache) = 0.108 + 0.012 + 0.072 + 0.008 + 0.016 + 0.064 = 0.28
- P(cavity) = 0.108 + 0.012 + 0.072 + 0.008 = 0.2
33
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
34. Probability Theory >> Marginalization
Marginalization/Summing out:
- The process of sum up the probabilities for each possible value of the other variables.
- General Marginalization Formula:
P(Y) = Ο π§βπ π·(π, π§)
P(Cavity=cavity)
= Ο π§β{πΆππ‘πβ,ππππ‘βππβπ} π·(πππ£ππ‘π¦, π§)
= P(cavity, catch, toothache) + P(cavity, Β¬catch, toothache) + P(cavity, catch, Β¬ toothache) + P(cavity, Β¬ catch, Β¬ toothache)
= 0.108 + 0.012 + 0.072 + 0.008
= 0.2
34
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
35. Probability Theory >> Practices
Problem 1 >>
A survey has been done on UIU students to assess their interest in hostel accommodation. The data obtained is
as follows:
200 students participated in the survey, half of them male students. Among the male students, 50 were
juniors(first and second year) with 70% interested in hostel accommodation and the rest were seniors with 60% interested in
hostels. Among the females, 60 were juniors with 80% interested in hostels and the rest were seniors with 50% interested in
hostels.
βΈBased on this data, construct a full joint distribution among the three random variables Gender(G), Category(C) and
Interest in hostel accommodation(H).
βΈCalculate the following probabilities from your table:
i. Probability of a student being a junior.
ii. Probability of a female student not being interested in hostels.
35
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
36. Probability Theory >> Practices
Solution >>
P(J) = 35/200 + 48/200 + 15/200 + 12/200 = 110/200
P(F β Β¬ H) = 12/200 + 20/200 = 32/200
36
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
M F
J H 35/200 48/200
Β¬H 15/200 12/200
S H 30/200 20/200
Β¬H 20/200 20/200
37. Probability Theory >> Practices
Problem 2 >>
A survey has been done in a furniture shop that sells both furniture and electronics items to assess the
probability of customers being interested in each type of product. The data obtained is as follows:
200 customers participated in the survey, 60% of them male. Among the male customers 40 are young, 30 are
middle-aged and the rest are old. Among the young males, 20% are interested in buying furniture and the rest in electronics.
The middle-aged male group is divided equally in both sections. For the old males, 30 are interested in furniture and the rest
in electronics. The women group has 20 young, 30 middle-aged and 30 old customers. Among the young women, half are
interested in buying electronics and the rest in furniture. In both the middle-aged and the old womenβs group one-third are
interested in buying electronics and the rest in furniture.
βΈBased on this data, construct a full joint distribution among the three random variables Gender(G), Age(A) and Type of
Product(T).
βΈCalculate the following probabilities from your table:
i. Probability of a customer being interested in Electronics.
ii. Probability of an old customer not being interested in Furniture.
37
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU
38. Probability Theory >> Practices
Problem 3 >>
A survey has been done on final year students of a university to assess their interest in final year project/thesis.
The data obtained is as follows:
100 students participated in the survey, half of them male students. Among the male students 20 are interested
in project, others in thesis. In the project group, 5 like software engineering, 10 like AI and the rest like networking. In the
thesis group, 10 like software engineering, 15 like AI and the rest like networking. Among the female students 30 are
interested in project. Among these 30 students, 12 like software engineering, 10 like AI and United International University
(UIU) Dept. of Computer Science & Engineering (CSE) the rest like networking. Among the female students interested in
thesis, 10 like software engineering, 5 like AI and the rest like networking.
βΈBased on this data, construct a full joint distribution among the three random variables Gender(G), Subject(S) and Type of
work(T).
βΈCalculate the following probabilities from your table:
i. Probability of a student being interested in thesis.
ii. Probability of a male student not liking AI.
38
Mohammad Imam Hossain | Lecturer, Dept. of CSE | UIU