Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Uncertainty: CSE-345: Artificial Intelligence

Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

Uncertainty

CSE-345: Artificial Intelligence


Uncertainty
What shall an agent do when not all is crystal clear?

Different types of uncertainty effecting an agent:


The state of the world?
The effect of actions?

Uncertain knowledge of the world:


Inputs missing
Limited precision in the sensors
Incorrect model: action  state due to the complexity
A changing world
Uncertainty
Let action At = leave for airport t minutes before flight
Will At get me there on time?

Problems:
1) partial observability (road state, other drivers' plans, etc.)
2) noisy sensors (traffic reports)
3) uncertainty in action outcomes (flat tire, etc.)
4) immense complexity of modeling and predicting traffic

(A1440 might reasonably be said to get me there on time but I'd have
to stay overnight in the airport ...)
Right thing to do-the rational decision-therefore depends on both the relative
importance of various goals & the likelihood that & degree to which, they will
achieved.
Rational Decisions
A rational decision must consider:
– The relative importance of the sub-goals
– Utility theory
– The degree of belief that the sub-goals will be achieved
– Probability theory
Decision theory = probability theory + utility theory :
Principle of maximum expected utility (MEU)-
“The agent is rational if and only if it chooses the action that
yields the highest expected utility, averaged over all possible
outcomes of the action”
Using FOL for (Medical) Diagnosis
 p Symptom(p, Toothache)  Disease(p, Cavity)
Not correct...

 p Symptom(p, Toothache)  Disease(p, Cavity)


 Disease(p, GumDisease)  Disease(p,
WisdomTooth)
Not complete...

 p Disease(p, Cavity)  Symptom(p, Toothache)


Not correct...
Handling Uncertain Knowledge
Problems using first-order logic for diagnosis:
Laziness:
Too much work to make complete rules.
Too much work to use them
Theoretical ignorance:
Complete theories are rare
Practical ignorance:
We can’t run all tests anyway

Probability can be used to summarize the laziness and


ignorance !
Probability
Compare the following:
1) First-order logic:
“The patient has a cavity”
2) Probabilistic:
“The probability that the patient has a cavity is 0.8”

1) Is either valid or not, depending on the state of the


world
2) Validity depends on the agents perception history, the
evidence
Probability
Subjective or Bayesian probability:
Probabilities relate propositions to one's own state of knowledge
e.g., P(A25 | no reported accidents) = 0.06

These are not claims of some probabilistic tendency in the


current situation (but might be learned from past experience of
similar situations)

Probabilities of propositions change with new evidence:


e.g., P(A25 | no reported accidents, 5 a.m.) = 0.15
Probability
Probabilities are either:

Prior probability (unconditional , “obetingad”)


Before any evidence is obtained

Posterior probability (conditional , “betingad”)


After evidence is obtained
Probability
Notation for unconditional probability for a proposition A: P(A)

Ex: P(Cavity)=0.2 means:


“the degree of belief for “Cavity” given no extra
evidence is 0.2”

Axioms for probabilities:

1. 0  P( A) 1
2. P(True) =1, P( False) = 0
3. P( A  B) =P( A) + P( B) - P( A  B)
Random variable
 A random variable has a domain of possible values
 Each value has a assigned probability between 0 and 1
 The values are :
Mutually exclusive (disjoint): (only one of them are true)
Complete (there is always one that is true)

Example: The random variable Weather:


P(Weather=Sunny) = 0.7
P(Weather=Rain) = 0.2
P(Weather=Cloudy) = 0.08
P(Weather=Snow) = 0.02
Random Variable
The random variable Weather as a whole is said
to have a probability distribution which is a
vector (in the discrete case):
P(Weather) = [0.7 0.2 0.08 0.02]

(Notice the bold P which is used to denote the prob.distribution)


Random variable - Example
Example - The random variable Season:
P(Season = Spring) = 0.26 or shorter: P(Spring)=0.26
P(Season = Summer) = 0.20
P(Season = Autumn) = 0.28
P(Season = Winter) = 0.26
The random variable Season has a domain
<Spring, Summer, Autumn, Winter>
and a probability distribution:
P(Season) = [0.26 0.20 0.38 0.26]
The values in the domain are :
Mutually exclusive (disjoint): (only one of them are true)
Complete (there is always one that is true)
Probability Model
 Begin with a set  - the sample space
e.g., 6 possible rolls of a die.
   is a sample point/possible world/atomic event

 A probability space or probability model is a sample space with


an assignment P() for every   
0  P()  1
Σ P () = 1
e.g., P(1)  P(2)  P(3)  P(4)  P(5)  P(6)  1/6.

 An event A is any subset of 


P(A) = Σ{  A} P()
e.g., P(die roll < 4) = 1/6 + 1/6 + 1/6 = 1/2
The Joint Probability Distribution
Assume that an agent describing the world using the
random variables X1, X2, ..Xn.

The joint probability distribution (or ”joint”) assigns


values for all combinations of values on X1, X2,
..Xn.

Notation: P(X1, X2, ..Xn) (i.e. P bold)


The Joint Probability Distribution
 Joint probability distribution for a set of r.v.s gives the
probability of every atomic event on those r.v.s (i.e., every
sample point)
P( Weather, Cavity) = a 4 x 2 matrix of values:

Weather = sunny rain cloudy snow


Cavity = true 0.144 0.02 0.016 0.02
Cavity = false 0.576 0.08 0.064 0.08

 Every question about a domain can be answered by the joint


distribution because every event is a sum of sample points
Example - P(Season, Weather)

Weather
Season Sun Rain Cloud Snow

Spring 0.07 0.03 0.10 0.06 0.26 P(Spring)


Summer 0.13 0.01 0.05 0.01 +0.20 P(Summer)
Autumn 0.05 0.05 0.15 0.03 +0.28 P(Autumn)
Winter 0.05 0.01 0.10 0.10 +0.26 P(Winter)
0.30 0.10 0.40 0.20
P(Sun)+P(Rain)+P(Cloud)+P(Snow) = 1.00

Example: P(Weather=Sun  Season=Summer) = 0.13


Conditional Probability
 The Posterior prob. (conditional prob.) after obtaining evidence:
Notation:
P( A|B ) means: “The probability of A given that all we know is B”.
Example:
P( Sunny | Summer ) = 0.65
Is defined as: P(A B) if P(B)  0
P(A | B) =
P(B)
Can be rewritten as the product rule:
P(A  B) = P(A|B)P(B) = P(B|A)P(A)
“For A and B to be true, B has to be true, and A has to be true given B”
Conditional Probability

For the entire random variables:

P ( A, B ) = P ( B )P ( A | B )

should be interpreted as a set of equations for all possible values


on the random variables A and B.
Example:

P(Weather, Season) = P( Season)P(Weather | Season)


Conditional Probability
A general version holds for whole distributions, e.g.,
P(Weather,Cavity) = P(Weather|Cavity) P(Cavity)
(View as a 4 x 2 set of equations)

Chain rule is derived by successive application of


product rule:
P(X1,...,Xn) = P(X1,...,Xn-1) P(Xn | X1,...,Xn-1)
= P(X1,...,Xn-2)P(Xn-1 | X1,...,Xn-2) P(Xn | X1,...,Xn-1)
= ...
= ni=1 P(Xi | X1,...,Xi-1)
Inference by enumeration
Inference by enumeration
Try Yourself
P(Toothache)
P(Cavity)
P(Toothache|cavity)
P(Cavity|toothache v catch)
Independence
Bayes’ Rule
The left side of the product rule is symmetric w.r.t B and A:

P ( A  B ) = P ( A) P ( B | A)
P( A  B) = P( B) P( A | B)

Equating the two right-hand sides yields Bayes’ rule:

P( A | B) P( B)
P ( B | A) =
P ( A)
Bayes' Rule
Useful for assessing diagnostic probability from causal probability:

P(Effect|Cause)P(Cause)
P(Cause|Effect) =
P(Effect)
Example of Medical
Diagnosis using Bayes’ rule
Known facts:
Meningitis causes stiff neck 50% of the time.
The probability of a patient having meningitis (M) is 1/50,000.
The probability of a patient having stiff neck (S) is 1/20.
Question:
What is the probability of meningitis given stiff neck ?
Solution:
P(S|M)=0.5 P(S | M) P(M) 0.5  1 / 50000
P(M) = 1/50,000 P(M | S) = = = 0.0002
P(S) 1 / 20
P(S) = 1/20
Note: posterior probability of meningitis still very small!!
Example
• A doctor knows that the disease meningitis
causes the patient to have a stiff neck, say,
50% of the time and whiplash 80% of the time
The doctor also knows some unconditional
facts: the prior probability of a patient having
meningitis is 1/50,000, and having whiplash is
1/10,000. If a patient comes to a doctor which
treatment will be given to him and why?
Solution

P(S | M) P(M)
P(M | S) =
P(S)

P(S| W) P(W)
P(W | S) =
P(S)
Try Yourself
• A doctor knows that pneumonia causes a fever
95% of the time. She knows that if a person is
selected randomly from the population, there is
a 10−7 chance of the person having
pneumonia. 1 in 100 people suffer from fever.
You go to the doctor complaining about the
symptom of having a fever (evidence). What is
the probability that pneumonia is the cause of
this symptom (hypothesis)?

You might also like