Title: Rule Based Systems
1Rule Based Systems
Rule based systems / Knowledge based systems/
Expert Systems have played and plays an
important role in the AI industry. A report from
from 1993 by John Durkin Reports on Over 2500
Developed Expert Systems Application
areas Agriculture, Business, Chemistry,
Communications, Computer Systems, Education,
Electronics, Engineering, Environment, Geology,
Image processing, Information Management, Law,
Manufacturing, Mathematics, Medicine,
Meteorology, Military, Mining, Power Systems,
Science, Space Technology, Transportation Types
of systems Rule Based, Frame Based, Fuzzy
Logic, Case Based, Neural Network
2Architecture of a typical expert system
Knowledge base
User interface Question-and-answer Menu
driven Natural language Graphic inteface
Knowledge- base editor
General knowledge- base
Inference engine
User
Case-specific data
Explanation subsystem
Expert system shell
3AI in Medicine (USA 1970)
- Stanford
- MYCIN - blood infections
- Rutgers
- CASNET - casual reasoning
- MIT
- PIP - renal disease
- Stanford
- Pittsburgh
- Internist internal medicine
- the primary goal of this field is to develop
computer programs that perform efficiently and
are able to explain their reasoning and
conclusions to their users
4MYCINS knowledge base
- About 400 diagnostic rules
- About 5 therapy rules
5Why Mycin?
- Diagnose likely infecting organisms in blood and
meningitis infections - Use test results and information about patient
supplied by doctor - Prescribe an effective antibiotic treatment
- Do this early in the course of the disease,
before all possible information is available - To counteract
- - overuse of antibiotics
- - irrational use of antibiotics
- -maldistribution of expertise
6Mycin system for diagnosis og meningitis and
bacteremia (bacterial infections)
IF the site of the culture is blood, and
the identity of the organism is not
known with certainty, and the stain of the
organism is gramneg, and the morphology of the
organism is rod, and the patient has been
seriously burned THEN there is weakly
suggestive evidence (0.4) that the
identity of the organism is pseudomonas
7MYCIN diagnosis rule (2)
IF the site of the culture is blood, and
the identity of the organism is gramneg, and
the morphology of the organism is rod, and
the patient is a compromised host THEN there
is suggestive evidence (0.6) that the
identity of the organism is pseudomonas-Aeruginosa
8MYCIN diagnosis rule (3)
Rule 3 IF (1) stain of organism is gram-positive
and (2) morphology of organism is coccus and
(3) growth-conformation of the organism is
clumps THEN there is suggestive evidence (0.7)
that identity of organism is staphylococcus.
9MYCIN diagnosis rule (3) (CEFAX notation )
rule 3 if stain of organism is gram_positive
and morphology of organism is coccus and
growth_conformation of organism is clumps then
0.7 certainty identity of organism is
staphylococcus.
10MYCIN Therapy Selection Rule
IF You are considering giving chloramphenicol,
and the patient is less than 1 week old THEN
it is definite (1.0) that chlorampericol is
contraindicated for this patient Justification
Newborn infants may develop vasomusculular
collapse due to an immaturity of the liver and
kidney functions resulting in decreased
metabolism of chloramphenicol
11How does MYCIN create confidence in the user
Answering Why? (Why did you ask
that?) Answering How (How did you arraive at
that conclusion?) Answering Why not X? (Why did
you not consider X?) Mycins simple rule format
and friendly explanations in English are the
key.
12MYCIN Explanation
User Why didnt you consider Streptococcus
as a possiblity for Organism-
1 MYCIN The following rule could have been used
to determine that the identoty of Organism-1 was
streptococcus Rule 33 But Clause 2 (the
morphology of the organism is Coccus) was
already known to be false for Organism-1, so the
rule was never tried.
13How MYCIN looks to the userTherapy
recommendation
REC-1 My preferred therapy recommendation is as
follows In order to cover for items lt1 2 3 4
5Z Give the following in combination 1
Kanamycin Dose 750 mg (7.5 mg(kg)q12h IM (or
IV) for 28 days Comments Modify dose in renal
failure 2 Penicillin Dose 2,500,000
units (2500 units/kg) q4h IV for 28 days
14Emycin and expert system shell
MYCIN has later been developed, and separated
into to parts An expert system shell EMYCIN
(empty MYCIN) A knowledg base The expert
system shell EMYCIN is the mother of all expert
system shells. One simplified version is called
CEFAX is implemented at NTNU in Prolog
15Rule based system as a reasoning system
If we look aside from the uncertainties in MYCIN,
the system can be regarded as logical inference
system, where the explanation is the proof tree
of the reasoning.
A bank clerk shall approve loans for customers.
He collects the basic information about the
customer, which is represented as a set of
variables
Basic variables APP (the appraisal on the
collateral is greater than the loan
amount) RATING (The applicant has a good credit
rating) INC (The applicants income exceeds his
expenses) BAL (The applicant has an excellent
balance sheet) Derived variables OK (The loan
should be approved) COLLAT(The collateral for the
loan is satisfactory) PYMT (The applicant is able
to make the loan payments) REP (The applicant has
a good financial reputation)
16The loan approval rule base
He follows the banks guidelines, which can be
stated as follows (1) COLLAT ? PYMT ? REP ?
OK (2) APP ? COLLAT (3) RATING ? REP (4)
INC ? PYMT (5) BAL ? REP ? OK
17A loan application case
Mr John Smith has applied for a loan. His case
is APP is true, INC is true, RATING is
true, BAL is true That his loan can be approved
follows from the following proof tree (Rule
numbers in parentheses)
approval
OK
OK (1)
(5)
COLLAT PYMT REP BAL
REP (2) (4) (3)
(3)
APP INC RATING
RATING
18The loan approval as a rule based system
rule 4 if inc is true then 1.0 certainty
pymt is true. rule 5 if bal is true and
rep is true then 1.0 certainty ok is true.
rule 1 if collat is true and pymt is true
and rep is true then 1.0 certainty ok
is true. rule 2 if app is true then 1.0
certainty collat is true. rule 3 if rating
is true then 1.0 certainty rep is true.
19A loan approval real dialog
User Why do you believe that the loan should be
approved System Because the collateral for the
loan is satisfactory, and the applicant is able
to make the loan payments, and the applicant has
a good financial reputation. User Why do you
believe that the applicant has a good financial
reputation ? System Because the credit-rating
service said that the applicant has a good credit
rating. User Why did you ask me about whether
or not the applicants income exceeds his
expenses ? System Because I was trying to
establish whether or not the applicant is able to
make the loan payments. User Why are you trying
to establish whether or not the applicant is able
to make loan payments. System Because that is
one of the criteria whether or not the loan
should be approved. User Why are you trying to
establish whether or not the loan should be
approved ? System Because you asked me to.
20An expert system loan approval dialog
?- eval ok. What is the certainty of app is
true --gt 1.0. What is the certainty of inc is
true --gt why. I ask because rule 4 if inc is
true then 1.00 certainty pymt is true . I ask
because rule 1 if collat is true and pymt is
true and rep is true then 1.00 certainty ok
is true . The last conclusion was your original
problem . What is the certainty of inc is true
--gt 1.0. What is the certainty of rating is true
--gt 1.0. What is the certainty of bal is true
--gt 1.0. ok is true IS PROVED ( 1.00) (help./
how./ ok./ quit./ ) ?
21Loan approval proof
Dialog and proof of Loan approval are shown
here PRO/loanapproval.txt PRO/loanproof.txt
22ok is true IS PROVED ( 1.00) (help./ how./ ok./
quit./ ) ? how. BECAUSE contributions
by rule 1 ok is true IS PROVED (
1.00) BECAUSE collat is true IS
PROVED ( 1.00) BECAUSE
by rule 2 collat is true IS
PROVED ( 1.00) BECAUSE
app is true IS PROVED ( 1.00)
BECAUSE app is true
is given AND pymt is true IS
PROVED ( 1.00) BECAUSE by rule 4
pymt is true IS PROVED ( 1.00)
BECAUSE inc is true IS
PROVED ( 1.00) BECAUSE
inc is true is given AND
rep is true IS PROVED ( 1.00)
BECAUSE by rule 3
rep is true IS PROVED ( 1.00)
BECAUSE rating is true IS PROVED
( 1.00) BECAUSE
rating is true is given by rule 5
ok is true IS PROVED ( 1.00) BECAUSE
bal is true IS PROVED ( 1.00)
BECAUSE bal is true is given
AND rep is true IS PROVED ( 1.00)
BECAUSE by rule 3 rep is
true IS PROVED ( 1.00) BECAUSE
rating is true IS PROVED ( 1.00)
BECAUSE
rating is true is given
23The Certainty Factor model for uncertainty
handling
Rule 3 IF (1) stain of organism is gram-positive
and (2) morphology of organism is coccus and
(3) growth_conformation of the organism is
clumps THEN there is suggestive evidence (0.7)
that identity of organism is staphylococcus.
The uncertainty model is based on certainties
which are numbers between 1 and 1. The example
0.7 is a rule parameter that modifies the
certainty of the conclusion.
24Uncertainty vs Ignorance
00
00
0
1
MB MI
MD
The origin is based on belief intervals. Measure
of Belief 0.0 -- 1.0 Measure of Disbelief
0.0 -- 1.0 Certainty Factor MB MD - 1.0
-- 1.0 Measurements of Ignorance 1.0
(MBMD) Measurement of inconsistency MBMD 1.0
( -MI) Uncertainty Is it raining in Trondheim
tomorrow ? Ignorance Is it raining in Kuala
Lumpur tomorrow ?
25Statistical interpretations
Characteristics
Values Ranges 0
lt MB lt 1
0 lt MD lt 1
-1 lt CF lt 1 Certain True
Hypothesis MB1 P(HE) 1
MD0
CF 1 Certain False Hypothesis
MB0 P(-HE) 1
MD1
CF -1 Lack of evidence
MB0 P(HE) P(H) MD0
CF
0 Contradictory evidence MB1
MD1
CF 0
26Manipulation of CF-values
Usually, we use only one CF value, so we dont
distinguish between ignorance and inconsistency.
CF rule principle if P then CF
certainty Q CF(P)
parameter CF(Q)
computed defined
computed
CF(P) CF CF(P) gt0 0
otherwise
CF(Q)
27Antecedent Combination Rule
The CF values of the premise is computed together
If A and B then CF C
(CF 0.6)
A CF(A) (0.5) B
CF(B) (0,7) CF(A and B)
min(CF(A),CF(B)) (0.5) CF (C ) CF CF(A and
B) (0.3) Similarily CF(A or B) max
(CF(A),CF(B)) CF(not B) - CF(B)
28Serial Combination Rule
The CF-values are chained together with the rule
applications
IF AA THEN CF1 B
CF(AA)0.5 (0.7) gt
CF(B)0.35 IF B THEN CF2 C
(0.35) (0.3) gt CF(C)
0.105
29Paralell combination rule
Accumulation of CF-values, contribution from
several rules
- IF AA1 then xx R ( CF(R1) P)
- IF AA2 then yy R ( CF(R1) Q)
- CF(R) P Q PQ (in the simple case)
R
Q
P
30Motivation for Parallel rule
Supppose B1 and B2 are two independent stochastic
variables, and that B B1 or B2 Then P(B)
P(B1 or B2) P(B1) P(B2)
P(B1 and B2) P(B1) P(B2)
P(B1)P(B2) which corresponds to the rule
CF(R) CF(R1) CF(R2) CF(R1)CF(R2)
31The complete parallel rule
CF1
CF2 CF1CF2 (CF1,CF2 gt0) CFparallel(CF1,CF2)
CF1 CF2 CF1CF2 (CF1,CF2 lt 0)
(CF1 CF2) (CF1CF2 lt0)
_
_________________
(1
min(CF1,CF2))
32Motivation for complete parallel rule
Historically, the parallel rule for CF values of
opposite sign was just CF CF1 CF2 e.g.
CF10.999 (damn sure) CF2
- 0.799 gt CF 0.2 which is
unreasonably low The revised rule gives
CF 0.995 (almost damn sure) BUT the old
rule also had the defect that it was
not associative and not commutative
33Mathematical properties of the revised parallel
rule
The parallel rule has some good and obviously
required properties The CF parallel combination
rule has some very nice (and obviously required)
mathematical properties - it is associative,
i.e. evidence may be grouped arbitrarily - it is
commutative, i.e. the sequence of evidence is
irrelevant - it has a zero element, (CF 0)
that has no effect - it is symmetric, i.e.
equal but opposite evidence cancel out However,
the CF parallel combination rule is not
idempotent C C - CC gt C (if C gt0)
(If you repeat the same weakly supported
postulate sufficiently often, it will be
regarded as certain after a while . -)