6-Uncertainty
6-Uncertainty
SCE408
Representing Uncertainty
Chapter 13.1 – 13.5
Propositional Logic
• A symbol in Propositional Logic (PL) is a symbolic
variable whose value must be either True or False,
and which stands for a natural language statement that
could be either true or false
Not Proposition
What time is now?
3
Propositional Logic
• Two types:
– Simple proposition:
• Single variable such as A
• Called Atomic sentence
– Complex proposition:
• Multi variable proposition A and B or C
• Called Complex sentence
4
Logic Operators
➢ A= today is Sunday A B ¬A A∧B A ∨B A ⇔ B
➢ B= today is national day T T F T T T
T F F F T F
❑ Operators
F T T F T F
• Not :¬
F F T F F T
• E.g. ¬A → today is not Sunday
• And : ∧
• E.g. A ∧ B → today is Sunday and today is national day
• Both should be true
• Or : ∨
• E.g. A ∨ B → today is Sunday or today is national day
• Either true or both
• Bi-Conditional /Equivalence : ⇔
• E.g. A ⇔ B → today is Sunday then today is national day
and If today is national day then today is Sunday
5
Logic Operators
• A= bring Tyson A B A⇒B
T T T
• B= defeat Tyson T F F
F T T
• Operators F F T
• Conditional : ⇒
• E.g. A ⇒ B → If you bring Tyson, I will defeat him
• A implies B
➢ Mean: ¬A ∨ B
7
Example
• Convert English statement to PL
8
Propositional Logic Syntax
9
Uncertainty in the World
• An agent can often be uncertain about the state of the world/domain
since there is often ambiguity and uncertainty.
• Plausible/probabilistic inference
• I’ve got this evidence; what’s the chance this conclusion is true?
• Ex:
✓I’ve got a sore neck; how likely am I to have meningitis?
✓A mammogram test is positive; what’s the probability that the
patient has breast cancer?
Uncertainty
• Say we have a rule:
if toothache then problem is cavity
11
Example of Uncertainty
• Assume a camera and vision system is used to estimate the
curvature of the road ahead.
• There's uncertainty about which way it curves!
– limited pixel resolution, noise in image.
– algorithm for “road detection” is not perfect.
13
Probability Notation
• A representation that is similar to Propositional
Logic but is more expressive in being able to
represent degrees of belief as probabilities.
14
Sample Space
• A space of events in which we assign probabilities
• Events can be binary, multi-valued, or continuous
• Events are mutually exclusive.
• Examples
– Coin flip/tossing: {head, tail}
– Die roll: {1,2,3,4,5,6}
– English words: a dictionary
– High temperature tomorrow: {-100, …, 100}
15
Random Variable
• A variable, X, whose domain is a sample space,
and whose value is (somewhat) uncertain.
• Examples:
X = coin flip outcome
X = first word in tomorrow’s NYT newspaper
X = tomorrow’s high temperature
• For a given task, the user defines a set of
random variables for describing the world
16
Random Variable
• Random Variables (RV):
– are capitalized (usually) e.g., Sky, Weather, Temperature.
– refer to attributes of the world whose "status" is unknown.
– have one and only one value at a time.
18
19
Probability for Discrete Events
• An agent’s uncertainty is represented by
P(A=a) or simply P(a)
– the agent’s degree of belief that variable A takes on
value a given no other information relating to A
22
The Axioms of Probability
1. 0 ≤ P(A) ≤ 1
2. P(true) = 1, P(false) = 0
3. P(A ∨ B) = P(A) + P(B) – P(A ∧ B)
23
The Axioms of Probability
▪ 0 ≤ P(A) ≤ 1
▪ P(true) = 1, P(false) = 0
▪ P(A ∨ B) = P(A) + P(B) – P(A ∧ B)
24
The Axioms of Probability
▪ 0 ≤ P(A) ≤ 1 The fraction of A can’t
▪ P(true) = 1, P(false) = 0 be bigger than 1
▪ P(A ∨ B) = P(A) + P(B) – P(A ∧ B)
Sample
space
25
The Axioms of Probability
▪ 0 ≤ P(A) ≤ 1
▪ P(true) = 1, P(false) = 0
▪ P(A ∨ B) = P(A) + P(B) – P(A ∧ B)
Sample
Valid sentence: e.g., “X=head or X=tail” space
26
The Axioms of Probability
▪ 0 ≤ P(A) ≤ 1
▪ P(true) = 1, P(false) = 0
▪ P(A ∨ B) = P(A) + P(B) – P(A ∧ B)
Sample
space
Invalid sentence:
e.g., “X=head AND X=tail”
27
The Axioms of Probability
▪ 0 ≤ P(A) ≤ 1
▪ P(true) = 1, P(false) = 0
▪ P(A ∨ B) = P(A) + P(B) – P(A ∧ B)
Sample
A space
28
Probability for Discrete Events
• Probability for more complex events, A
▪ P(A = “head or tail”) = 0.5 + 0.5 = 1 fair coin
▪ P(A = “even number”) = 1/6 + 1/6 + 1/6 = 0.5
fair 6-sided die
▪ P(A = “two dice rolls sum to 10”) = 1/36 +
1/36 + 1/36 = 3/36
29
Quiz
▪ P(A = “two dice rolls even numbers”) =?
▪ P(A=“two dice rolls sum to 10”) =?
▪ P(A = “two dice rolls even numbers” ∧ A=“two dice rolls sum to 10”) =?
30
Probability Distributions
❑ Given A is a RV taking values in〈a1, a2, … , an〉
✓ sum over all values in the domain of variable A is 1 because the domain is
mutually exclusive and exhaustive
31
Probability Table
• Weather
sunny cloudy rainy
200/365 100/365 65/365
32
34
Full Joint Probability Distribution
Weather
sunny cloudy rainy
Temp hot 150/365 40/365 5/365
cold 50/365 60/365 60/365
P(bird, ¬flier) =
P(bird ∨ flier) =
37
Unconditional / Prior Probability
• One’s uncertainty or original assumption about
an event prior to having any data about it or
anything else in the domain.
➢P(Coin = heads) = 0.5
➢P(Bird = T) = 0.0 + 0.2 + 0.04 + 0.01 = 0.22
• Compute by marginalization
We can write the following general marginalization rule for any
sets of variables Y and Z:
39
Marginal Probability
Weather
sunny cloudy rainy
Temp
hot 150/365 40/365 5/365
cold 50/365 60/365 60/365
∑ 200/365 100/365 65/365
40
Marginal Probability
Weather
sunny cloudy rainy ∑
Temp
hot 150/365 40/365 5/365 195/365
cold 50/365 60/365 60/365 170/365
41
Conditional Probability
• Conditional probabilities
– formalizes the process of accumulating evidence
and updating probabilities based on new evidence
– specifies the belief in a proposition (event, conclusion,
diagnosis, etc.) that is conditioned on a proposition
(evidence, feature, symptom, etc.) being true
• P(a | e): conditional probability of A=a
given E=e evidence is all that is known true
– P(a | e) = P(a ∧ e) / P(e) = P(a, e) / P(e)
– conditional probability can viewed as the joint probability
P(a, e) normalized by the prior probability, P(e)
https://www.mathsisfun.com/data/probability-events-conditional.html
42
Conditional Probability
• Conditional probabilities behave exactly like
standard probabilities; for example:
0 ≤ P(a | e) ≤ 1
➢ conditional probabilities are between 0 and 1
inclusive
• P(a1 | e) + P(a2 | e) + ... + P(ak | e) = 1
conditional probabilities sum to 1 where a1, …, ak are all
values in the domain of random variable A
• P(¬a | e) = 1 − P(a | e)
negation for conditional probabilities
43
Conditional Probability
• P(conjunction of events | e)
➢P(a ∧ b ∧ c | e) or as P(a, b, c | e)
is the agent’s belief in the sentence a ∧ b ∧ c
conditioned on e being true
• P(a | conjunction of evidence)
➢P(a | e ∧ f ∧ g) or as P(a | e, f, g)
is the agent’s belief in the sentence a conditioned on
e ∧ f ∧ g being true
44
Conditional Probability
The conditional probability P(A=a | B=b) is the fraction
of time A=a, within the region where B=b
45
Conditional Probability
Weather
sunny cloudy rainy ∑
Temp
hot 150/365 40/365 5/365 195/365
cold 50/365 60/365 60/365 170/365
P(Temp) = 〈195/365, 170/365〉
46
Full Joint Probability Distribution
Bird (B) Flier (F) Young (Y) Probability
T T T 0.0
T T F 0.2
T F T 0.04
T F F 0.01
F T T 0.01
F T F 0.01
F F T 0.23
F F F 0.5
P(¬B|F) = ?
P(F) = ?
49
Conditional Probability with
Multiple Evidence
50
Conditional Probability
• In general, the conditional probability is
P ( A = a, B ) P ( A = a, B )
P( A = a | B) = =
P( B) P( A = ai , B)
all ai