Title: Part II Methods of AI
1Part IIMethods of AI
- Chapter 3
- Knowledge and Reasoning
2Part II Methods of AI
Chapter 3 Knowledge Representation and Reasoning
3.1 Summary of Logic and Reasoning
3.2 Reasoning Deduction Systems
3.3 Rulebased Reasoning
3.4 Knowledge Representation General Issues
3.5 Knowledge Representation Semantic Nets
3.6 Knowledge Representation Description Logics
33.3 Reasoning
XPS Rule based Systems
4(No Transcript)
5Whats the idea ?
6Why XPS?
XPS
multiply
the knowledge of human experts
preserve
7Structure of an XPS
Expert
User
General (static) knowledge
Knowledge acquisition
Case-base (dynamical) knowledge
Explanation
Interviewer
Problem solving component
Intermediary resultssolution hypotheses
8MYCIN in Consultation Mode
- System What is the patient's name?
- User George Washington
- System What is the patient's age?
- User 252 years
- System Is the patient male or female?
- User Male
- System What are the symptoms?
- User Headache dizziness upset stomach high fever
- System When did these symptoms first appear?
- User December 13,1799
- System I conclude that the patient has a viral
infection , my recommendation is that he should
take two aspirin, drink plenty of fluid, get lots
of rest and call me in the morning. - Note George Washington died the next day of a
viral infection no antibiotics
9TEIRESAS-MYCIN Explanation Mode (I)
- Mycin has been informed that a patient has
contracted meningitis while - in hospital. Doctors wish to interrogate Mycin to
check this diagnosis. - Mycin then asks the doctors this question
- Mycin Is Meningitis a hospital acquired illness?
- Doctor why?
- Mycin 2.0 this will aid in determining the
orgamisms that might be causing the infection - It has already established
- 2.1 the infection that requires therapy is
meningitis - 2.2 organisms were not seen on the stain of
this pending csf culture - 2.3 the type of infection is bacterial
- 2.4 neurosurgery is not one of the relevant
items of patient 100 - 2.5 the age of patient 100 is greater than 25
- therefore if 2.6 the infection was acquired
while the patient was in hospital then there is
evidence that the organisms that might be causing
the infection are E coli(0.75) staphylococcus-coag
-pos(0.3) pseudomonas-aeruginosa(0.3)
klebsiella-pneumoniae(0.5)
10TEIRESIAS-MYCIN Explanation Mode (II)
- If the doctors wanted to know how something was
concluded they might ask - Doctor How 2.3
- The system then reponds with
- Mycin The following rules concluded about the
likelihood that the type of the infection is
bacterial - 2.7 RULE148 (0.19)
- 2.8 RULE500 (0.51)
- 2.9 RULE501 (0.95)
- 3.0 RULE502 (0.97)
- 3.1 RULE526 (0.98)
- 3.2 RULE504 (0.97)
- 3.3 RULE524 (0.98)
- The system takes the doctors through the
production system AND/OR - tree to explain its conclusions. The numbers in
brackets are called - certainty factors because little can be
absolutely certain. The certainty - factors range from -1 to 1 where -1 means
absolutely not and 1 - absolutely so and 0 undecided either way.
11Toulmins Argumentation Scheme
therefore
Qualifier, inference result
Facts
if not
cause
Inference rule
Exception rule
because of
support
COGNITIVE SCIENCE
12Toulmins argumentation scheme An example
therefore
The offeredused car is old
Probably, the offered used car is cheap
if not
cause
Used cars are cheapmost of the time
The offered used caris a collectors item
because of
Used things loose their valuewhen time goes by,
because they break down more often etc.
13Basic principles of XPS (1)
Every production rule has two parts
A
B
Assumption Antecedence Evidence If-Part Left hand
side (LHS) Condition
Conclusion Consequence Hypotheses Then-Part Right
hand side (RHS) Action
Productions are evaluated over a (data) pool (not
data base!) that is named working memory (WM)
or at applications in cognitive psychology
denoted as short-term memory (STM)
14Basic principles of XPS (2)
There are two modes of evaluating production
rules
Backward chaining
Forward chaining
A
B
A
B
Data controlled inference Antecedence-oriented
inference Bottom-up inference If-added
methods LHS-controlled chaining
Goal controlled inference Consequence-oriented
inference Top-down inference If-needed
methods RHS-controlled chaining
15Production Rule Systems
Facts
(( car_no DÜW-AW 205) motor_status
on) oil_control on) air_pressure 0,1 bar) ...)
Rules
(1) IF (motor_status on) AND
(oil_control on) THEN WRITE(Stop
motor) AND SET (motor_status off)
(2) IF (car_no x) AND (air_pressure y)
AND (LESS y 1.5) THEN WRITE( x
has a flat tire)
16General Structure of Production Rules
Simple rules
IF B1 ? B2 ? ? Bn THEN DO A1 ? A2 ? ?
Am ELSEDO C1
Example
IF the site of the culture is throat AND the
organism is streptococcus THEN there is strong
evidence that the subtype is not of group-D
17(No Transcript)
18Architecture of a Production System
data base
rules
C1 C2 ? A1 C3 ? A2 C1 C3 ? A3 C4 ? A4 C5 ?
A5
C5 C1 C3
Rule interpreter
recognition
action
conflict set
match
productionrules againstdata base
C3 ? A2 C1 C3 ? A3 C5 ? A5
C3 ? A2
evaluate A2
19Recall first intro lecture!
Evaluation
positive
negative
20Examples taken from Mycin (1)
Rules encoding relationship between identity of
infecting organisms and possible therapies
21Examples taken from Mycin (2)
Rules encoding exclusion relationship between
therapies and other diagnoses
22Examples taken from Mycin (3)
Rules to establish the possible identity of the
infecting organism
23Examples taken from Mycin (4)
Rules supporting established possibilities
24Examples taken from Mycin (5)
Rules to establish the alternative possible
identities of the infecting organism
25Examples taken from Mycin (6)
Rules describing actions to take and to select
the best therapy
26Translation of the Rules
IF the stain of the organism is GRAMNEG AND the
morphology of the organism is ROD AND the
aerobicity of the organism is AEROBIC THENDO there
is strongly suggestive evidence (0.8) that the
class of the organism is enterobacteriaceae
Translated into
(AND (Same CNTXT STAIN GRAMNEG) (Same CNTXT
MORPH ROD) (Same CNTXT AIR AEROBIC))
Premise
Action
( Conclude CNTXT class ENTEROBACT. TALLY 0.8)
27Rules with Certainty Factors
IF C1(w1) ? C2(w2) ? ? Cn(wn) THEN
DO A(W)
Example
IF the organism is gram-pos AND the organism
grows in chains AND the morphology is
spherical THEN by 70 evidence the organism is
streptococcus
28Calculation of the Total Evidence
General Formula Evidence Preconditions _at_
Evidence of the Rule Total Evidence
- Example (Streptococcus) with MIN-Calculation
- Evidence of Rule 70
- GRAM-POS 100
- CHAINS 60
- SPHERE 70
min 60
Total Evidence 6070 42
29Calculation of the Total Evidence
General Formula Evidence Preconditions _at_
Evidence of the Rule Total Evidence
- Example (Streptococcus) with MULT-Calculation
- Evidence of Rule 70
- GRAM-POS 100
- CHAINS 60
- SPHERE 70
Mult 1007060 42
Total Evidence 4270 29,4
30Calculation of the Total Evidence
Evidence Preconditions _at_ Evidence of the Rule
Total Evidence
- Evidence Amplification
- given W1 the evidence of rule 1
- W2 the evidence of rule 2
- then calculate W as the new total
evidence with
Example W1 42 as before W2 50 for
STREPTOCOCCUS
W 0.42 (1 - 0.42)0.5 71
31Rules with Certainty Factors
- Positive and negative evidence
- separate calculations
- EVGes EVPos EVNeg
- Context-dependent Calculation of Total Evidence
-
Problem MYCIN-mechanism often too uniform
Solution Evidence Classes
given W1, W2 as before
W FR (W1 W2)
where FR is a function that is different for
different classes of rules
32CONTEXT Classification of Rules in MYCIN
- CUL rules rules for some culture
- CURCUL rules rules for current culture
- CURORG rules rules for the current organism
- DRG rules rules for drugs
- OP rules rules for operations
- PAT rules rules concerning patients
- PDRG rules rules for already administered drugs
- PROGR rules rules for previously isolated
organisms - ORG rules rules for every organism
33Rules with Certainty Factors
- Final Remark
- Evidence Theory, Probability Theory and
Certainty Factors have become an independent
(AI-) research field on its own, and all the
previous calculations are just ad hoc solutions
that worked empirically in the past . - See Special Lecture on Uncertainty and
Probability
34Structured Rules (mapping relations)
Condition
Action
Default
Context
Example (causal relations)
IF (COND serious diarrhea AND longer than two
days) (CTXT malabsorprion) (DFLT no bicarbonat
therapy) THEN medium metabolic acidosis with a
normal anion ELSE light metabolic acidosis with
normal anions
35Knowledge Sources in MED-II
- Focus of attention
- Dynamic chaining
36Processing the Rules Processing the Conditions
Part
- Pattern matching
- e.g., (John takes ?drug)
- Unification
- (bilateral matching as in resolution principle)
- Association
- e.g., (F12 W1) ? (Z19 24) where F12 and W1 have
some intuitive meaning (e.g. serious
diarrhea) - Predicates
- e.g., (before T1 T2) or
- e.g., some LISP-function triggering further
rules
37Processing the Rules A Rule Interpreter
- Rule Interpreter the abstract machine
DATA ? DATA BASIS UNTIL data fulfils termination
DO BEGIN Choose rule R applicable on
DATA DATA ? R (DATA) END
Problem Choose
Control Structure !
38An empirical Solution Processing the Rules in
MYCIN
39More ad hocery and Engineering The
Findout Mechanism in MYCIN
40A More General Solution
- General Procedure
- Process the rules
- Add item to working memory
- Remove item from working memory
Tasks
- Matching ? naive match (unification)
problem unifications in one cycle - Conflict resolution
- Act (e.g. print, add, delete etc.)
41The RETE Algorithm
SOAR
OPS 5
ACT-R
rule database
working memory(WM)
r elements
w elements
p1 ? p2 ? ? pn ? act1 ? act2 ...
ACTIONS add, delete elements from WM, print etc.
42Processing Steps
- Compile rules into net (inclusive constraints)
- Insert working memory (WM) entries
- Perform actions and modify net
- Shared representation of same LHS (elimination of
rules) - Example delete(A) ? bigger impact (propagated
through net)
43Example
D
AD
add E
E(2)
A
B
AB
C
add D
C(5)
B(2)
D(2)
A(1)
B(3)
A(2)
E
delete A
B(4)
? B(x)
? C(y)
? add D(x)
A(x)
? B(y)
? D(x)
? add E(x)
A(x)
? B(x)
? E(y)
? delete A(x)
A(x)
44Examples for resolution strategies
Conflict Resolution for competing rules
- No duplication
- Prefer rules referring to recent WM elements
- Prefer rules that are more specific
- Prefer actions with higher priority
A General Programming Language for Rule based
Systems
OPS-5
45OPS-5 Basic Syntax and its Elements
1) Structure of the Database
2) Structure of the Production Rules
46Monkey World XPS
- (p HoldsObject-Ceiling
- (goal status active
- type holds
- objid ltO1gt)
- (physical-object id ltO1gt
- weight light
- at ltpgt
- on ceiling)
- (physical-object id ladder
- at ltpgt
- on floor)
- (monkey on ladder holds NIL)
- -(physical-object on ltO1gt)
- --gt
- (write (crlf) Grab ltO1gt (crlf))
- (modify 2 on NIL)
- (modify 4 holds ltO1gt)
- (modify 1 status satisfied) )
47FERPLAN Production Rule
FERPLAN XPS Assembly Planing for workpiece
productions (Fertigungsplanung)
48More Conditions
49Actions
50The Working Memory of OPS5
- The Working Menory (Database) consists of pairs
- (lttime-taggt, ltwm-elementgt)
- lttime-taggt
- Creation or last modification time of the
element - The larger the time-tag value, the more recent
the element is - Can be used for conflict resolution
- ltwm-elementgt as before.
51Control Strategies
52More Control strategies
- Exhaustive Forward Search
- Exhaustive Backward Search
- Generate-and-Test
- Partitioning into Phases
- Establish-Refine
- Hypothesize-and-Test
- Constraint Propagation
- Opportunistic Scheduling (via an Agenda)
- Knowledge Levels
53Establish-Refine Strategy
54(No Transcript)
55(No Transcript)
56(No Transcript)
57Summary XPS
- Power of XPSs results from great deal of
domain-specific knowledge not from a single
powerful technique - The required knowledge is about a particular area
and well defined - Usually build with aid from experts, who are
willing to spend effort in transferring their
expertise - Knowledge transfer is incremental
- Amount of knowledge depends on task (40 to
thousands) - Control structure depends system characteristics
- Non-domain specific parts can be extracted and
reused to build XPS for other domains
58Major Problems in XPS
- Brittleness
- XPS have no general knowledge to fall back on
- Lack of Meta-Knowledge
- XPS cannot reason about their own behaviour
- Knowledge Acquisition
- Despite tools to assist knowledge acquisition,
this is the major bottleneck to apply XPS
techniques in other domains. - Validation
- Mesuring of system performance difficult no
means to quantify use of knowledge correctness
proofs are impossible