Handling Uncertainties
Download
Report
Transcript Handling Uncertainties
Planning Chapter 7
article 7.4
Production Systems Chapter 5 article 5.3
RBS Chapter 7
article 7.2
RBS
Expert System:
A SYSTEM that mimics a human expert
Human experts always have in most case
some vague (not very precise) ideas about
the associations
Handling uncertainties is a essential part of
an expert system
Expert systems are RBS with some level of
uncertainty incorporated in the system
CS 331/531 Dr M M Awais
2
RBS
Choosing a Problem
Costs:
Technical Problems:
Choose problems that justify the development cost
of the expert systems
Choose a problem that is highly technical in nature
problems with Well-formed knowledge are the best
choice.
Highly specialized expert requirements, solution time
for the problem is not short time.
Cooperation from an expert:
Experts are willingly to participate in the activity.
CS 331/531 Dr M M Awais
3
RBS
Choosing a Problem
Problems that are not suitable
Problems for which experts are not available
at all, or they are not willingly to participate
Problems in which high common sense
knowledge is involved
Problems which involve high physical skills
CS 331/531 Dr M M Awais
4
RBS
ES Architecture
Explanation
system
interface
user
Inference
engine
Knowledge
Base
editor
Case
specific
Data
Knowledge
Base
Expert System Shell
CS 331/531 Dr M M Awais
5
RBS
ES Architecture
Uses Menus, NLP, etc…
Which is used to interact
With the users
Explanation
system
interface
user
Inference
engine
Knowledge
Base
editor
Case
specific
Data
Knowledge
Base
Expert System Shell
CS 331/531 Dr M M Awais
6
RBS
ES Architecture
Implements the
reasoning methods
Generally backward chaining
Explains why a decision
is taken, uses keywords
Such as HOW, WHY etc…
Explanation
system
interface
user
Updates the KB
Inference
engine
Knowledge
Base
editor
Case
specific
Data
Knowledge
Base
Expert System Shell
CS 331/531 Dr M M Awais
7
RBS
ES Architecture
Pre-solved problems,
Frequently referred cases
Explanation
system
interface
user
Inference
engine
Knowledge
Base
editor
Expert System Shell
CS 331/531 Dr M M Awais
Case
specific
Data
Knowledge
Base
Collection of facts
And rules
8
RBS
Shells
General purpose toolkit/shell is problem
independent
Shells commercially available
CLIPS is one such shell
Freely available
CS 331/531 Dr M M Awais
9
RBS
Reasoning with Uncertainty
Case Studies:
MYCIN
Implements certainty factors approach
INTERNIST: Modeling Human Problem
Solving
Implements Probability approach
CS 331/531 Dr M M Awais
10
RBS
RBS: Handling Uncertainties
How to handle vague concepts?
Why vagueness occurs?
All rules are not 100% deterministic
Certain rules are often true but not always
Headache may be caused in flu, but may
not always occur
An expert may not always be sure about
certain relations and associations
CS 331/531 Dr M M Awais
11
RBS
First Source of Uncertainty:
The Representation Language
Possible States are large
Single representation may correspond to multiple
states, which the agent can’t represent
distinguishably
Languages are generally less expressive
on(A,B) on(B,Table) on(C,Table) clear(A) clear(C)
A
B
A
C
C
B
CS 331/531 Dr M M Awais
A
B
C
12
RBS
Second source of Uncertainty:
Imperfect Observation of the World
Observation of the world can be:
Partial, e.g., a vision sensor can’t see
through obstacles (lack of percepts)
R1
R2
The robot may not know whether
there is dust in room R2
CS 331/531 Dr M M Awais
13
RBS
Second source of Uncertainty:
Imperfect Observation of the World
Observation of the world can be:
Partial, e.g., a vision sensor can’t see
through obstacles
Ambiguous, e.g., percepts have multiple
possible interpretations
A
C
B
on(a,b) on(a,c)
CS 331/531 Dr M M Awais
14
RBS
Second source of Uncertainty:
Imperfect Observation of the World
Observation of the world can be:
Partial, e.g., a vision sensor can’t see
through obstacles
Ambiguous, e.g., percepts have multiple
possible interpretations
Incorrect
CS 331/531 Dr M M Awais
15
RBS
Third Source of Uncertainty:
Ignorance, Laziness, Efficiency
Laziness/Efficiency:
An action may have a long list of preconditions, e.g.:
Drive-Car:
have(keys) empty(gas-tank) battery-Ok
ignition-Ok flat-Tires stolen(Car) ...
Medical Treatment
symptoms(p,toothache) disease(p, cavity)
The writer may not list all the condition
Results in incorrect representation or several
interpretations
CS 331/531 Dr M M Awais
16
RBS
Third Source of Uncertainty:
Ignorance, Laziness, Efficiency
Ignorance:
Theoretical: The domain knowledge in itself may not
be complete. The domain knowledge may not have a
complete theory
e.g. many instances in Medical science are
unexplainable
Practical Ignorance: The domain knowledge is
complete but the implementing it in an real/artificial
environment may be difficult.
e.g., some tests may yield poor results due to low
instrument precision
CS 331/531 Dr M M Awais
17
RBS
Modelling Uncertainty
Non-deterministic model:
Uncertainty is represented by a set of possible
values, e.g., a set of possible worlds, a set of
possible effects,
Probabilistic model:
Uncertainty is represented by a probabilistic
distribution over a set of possible values
Case specific models: Certainty factors used in
MYCIN
Fuzzy models
CS 331/531 Dr M M Awais
18
RBS
Example:
Non-deterministic: list all possible states,
belief state represents all the states of the
world that are possible at a given time or at a
given stage of reasoning
Probabilistic: probability is attached to each
state to measure its likelihood to be the actual
state
0.2
0.3
0.4
CS 331/531 Dr M M Awais
0.1
19
RBS
Probabilities ?
Probabilities: frequency interpretation
Relative occurrence of a particular state defined by
the probabilistic distribution
0.2
0.3
0.4
0.1
This state would occur
20% of the times
CS 331/531 Dr M M Awais
20
RBS
Example
We have a Dentist D who meets a new patient
D is interested in only one thing: whether Patient has a
cavity, which D models using the proposition Cavity
Before making any observation, D’s belief state is:
Cavity
p
Cavity
1-p
This means that if D believes that a fraction p of
patients have cavities
CS 331/531 Dr M M Awais
21
RBS
Example
Now an observation is made ‘toothache’
D’s belief state wrt toothache is:
toothache
p
toothache
1-p
Can the observation and the effect be related
i.e. cavity and toothache (YES), How?
CS 331/531 Dr M M Awais
22
RBS
Example
Lets relate the two:
The patient has a cavity if he / she has toothache
This sentence suffers from laziness and/or ignorance.
Why? It may not be necessary that every patient that
suffers from toothache may also have cavity. Then in
order to capture real situation we may keep on
increasing the reasons of toothache I.e,
The patient has cavity or gum problem or … if he /she
suffers from toothache.
Is there a simple way to solve this problem. YES
Attach probability to initial rule and that would
summarize the uncertainty caused because of laziness
and ignorance
CS 331/531 Dr M M Awais
23
RBS
Example
Lets relate the two:
The patient has a cavity if he / she has toothache
Probability of 0.7 (70% chance)
70% summarizes:
Cases in which all the factors needed for cavity to cause
toothache are present
And cases in which the patient has both cavity and toothache
but the two are unconnected
30% summarizes
all the other possible causes of toothache that we are too
lazy/ignorant to confirm or deny
CS 331/531 Dr M M Awais
24
RBS
Making decisions under uncertainty
P(A1 gets me to goal | …)
P(A2 gets me to goal | …)
P(A3 gets me to goal | …)
P(A4 gets me to goal | …)
= 0.04
= 0.70
= 0.95
= 0.99
Which action to choose?
Depends on my preferences for missing flight vs. time
spent waiting, etc.
Probability theory: summarizes uncertainties
Utility theory: represents and infers preferences
Decision theory = probability theory + utility theory
CS 331/531 Dr M M Awais
25
RBS
Probability
Degree of believe in a fact ‘x’, P(x)
P(H): degree of believe in H, when supporting evidence
is NOT given, H is the hypothesis
Joint Probabilities
P(H|E): degree of believe in H, when supporting
evidence is given, E is the evidence supporting
hypothesis
P(H|E): conditional probability
CS 331/531 Dr M M Awais
26
RBS
Prior probability
Prior or unconditional probabilities of propositions
e.g., P(Cavity = true) = 0.1 and P(Weather = sunny) = 0.72
Probability distribution gives values for all possible
assignments:
P(Weather) = <0.72,0.1,0.08,0.1> (normalized, i.e., sums to 1)
Joint probability distribution for a set of random variables
gives the probability of every atomic event on those random
variables
P(Weather,Cavity) = 4 × 2 matrix of values:
Weather =
Cavity = true
Cavity = false
sunny rainy cloudy snow
0.144 0.02 0.016 0.02
0.576 0.08 0.064 0.08
CS 331/531 Dr M M Awais
27
RBS
Conditional Probability
P(H|E): conditional probability is given
through a LAW (RULE)
P(H|E)=P(H^E)/P(E)
where P(H^E) is the probability of H and E
occurring together (both are TRUE): joint
CS 331/531 Dr M M Awais
28
RBS
Inference: Joint Prob.
CS 331/531 Dr M M Awais
29
RBS
Reasoning
P(toothache) = 0.108 + 0.012 + 0.016 + 0.064 = 0.2
CS 331/531 Dr M M Awais
30
RBS
Reasoning
Can also compute conditional probabilities:
P(cavity | toothache) = P(cavity toothache)
P(toothache)
=
0.016+0.064
0.108 + 0.012 + 0.016 + 0.064
= 0.4
CS 331/531 Dr M M Awais
31
RBS
Without Joint distributions
Conditional Probabilities are found,
Single evidence: Simple
If multiple evidences are available then
BAYESIAN Updating is done through the use of
conditional independence
Find the conditional probabilities directly through
the chain rule
CS 331/531 Dr M M Awais
32
RBS
Evaluating: Conditional Probability
P(H|E): P(Heart Attack|shooting arm pain)
Two approaches can be adopted:
Asking an expert about the frequency of it
happening
Finding the probability from the given data
Second Approach
Collect the data for all the patients
complaining about the shooting arm pain.
Find the proportion of the patients that had
an heart attack from the data collected in
step 1
CS 331/531 Dr M M Awais
33
RBS
Evaluating: Conditional Probability
P(H|E): P(Heart Attack|shooting arm pain)
Probability of Disease given symptoms
VS
P(E|H): P(shooting arm pain|Heart Attack)
Probability of symptoms given Disease
Which is easier to find of the two?
Perhaps P(E|H) is easier
CS 331/531 Dr M M Awais
34
RBS
Evaluating: Conditional Probability
P(H|E): P(Heart Attack|shooting arm pain)
Probability of Disease given symptoms
Headache is mostly experienced when a
patient suffers from flu, fever, tumor, etc…
Find out whether a patient suffers from
tumor, given headache
Collect the data for all the headache
patients, and then find the proportion of
patients that have tumor.
CS 331/531 Dr M M Awais
35
RBS
Evaluating: Conditional Probability
P(E|H): P(shooting arm pain|Heart Attack)
Probability of symptoms given Disease
Headache is mostly experienced when a
patient suffers from flu, fever, tumor, etc…
Find out whether a tumor patient suffers
from headache
Collect the data for all the tumor patients,
and then find the proportion of patients that
have headache
CS 331/531 Dr M M Awais
36
RBS
Evaluating: Conditional Probability
Generally speaking P(E|H): P(shooting
arm pain|Heart Attack) is easier to
find.
Therefore the we need to convert
P(H|E) in terms of P(E|H)
P(H|E)=P(H^E)/P(E)
P(H|E)=[P(E|H)*P(H)]/P(E)
CS 331/531 Dr M M Awais
37
RBS
Evaluating: Conditional Probability
More than one evidence
Independence of events
P(H|E1^E2)=P(H^E1^E2)/P(E1^E2)
P(H|E1^E2)=[P(E1|H)* P(E2|H)*
P(H)]/(P(E1)*P(E2))
CS 331/531 Dr M M Awais
38
RBS
Other Approaches
CS 331/531 Dr M M Awais
39
RBS
Certainty Factors (CF)-MYCIN
CF for rules CF(R)
CF for Pre-conditions CF(PC)
From the experts
From the end user
CF for conclusions CF(cl)
CF(cl)=CF(R)*CF(PC)
CS 331/531 Dr M M Awais
40
RBS
Certainty Factors (CF)
CF for rules CF(R)
CF(R) = 0.6
CF for Pre-conditions CF(PC)
IF A then B
IF A (0.4) then B
CF(A)= 0.4
CF for conclusions CF(cl)
CF(B)=CF(R)*CF(A)= 0.6*0.4=0.24
CS 331/531 Dr M M Awais
41
RBS
Finding Overall CF for PC
If A(0.1) and B(0.4) and C(0.5) Then D
Overall CF(PC)=min(CF(A),CF(B),CF(C))
CF(PC)=0.1
If A(0.1) or B(0.4) or C(0.5) Then D
Overall CF(PC)=max(CF(A),CF(B),CF(C))
CF(PC)=0.5
CS 331/531 Dr M M Awais
42
RBS
CFs for same conclusion rules
When the conclusions are same and certainty
factors are positive:
CF(R1)+CF(R2) – CF(R1)*CF(R2)
When the conclusions are same and the
certainty factors are both negative
CF(R1)+CF(R2) + CF(R1)*CF(R2)
Otherwise: both conclusions are same but have
different signs
[CF(R1)+CF(R2)] / [1 – min ( | CF(R1) | , | CF(R1) |]
CS 331/531 Dr M M Awais
43
RBS
Example
Please see the class handouts
CS 331/531 Dr M M Awais
44
RBS
CS 331/531 Dr M M Awais
45