Professional Documents
Culture Documents
Topic 2A Expert Systems
Topic 2A Expert Systems
Topic 2A Expert Systems
AI 2
Expert Systems (ES)
- what they are
• Can be
• consistent, unbiased substitutes for human experts
• repository for domain-specific knowledge
• Work by
• capturing human expertise about a specific area, or domain
• applying deductive reasoning to infer conclusions
• Not self-adaptive
• can not learn by themselves, all knowledge encoded and maintained by
humans
AI 3
Why expert systems?
AI 4
Some advantages of ES
AI 5
Applications of expert systems
AI 6
Applications of expert systems (cont’d)
• US public sector agencies making use of expert systems
• Environmental Protection Agency
• Immigration and Naturalisation Service
• Postal Service
• Internal Revenue Service
• Department of Energy
• British National Health Service ES with 11,200 rules used to evaluate the
performance of medical care providers
AI 7
Structure of an expert system
User Knowledge-
Interface: base editor
- Menu-
driven Knowledge-base
User Inference
- GUI
engine
- Natural Working memory
language
Explanation
sub-system
• Working memory stores initial facts specific to the problem at hand, intermediate
conclusions and hypotheses for this run
• User interface
• Allows user to enter relevant facts by answering questions asked by the system
• Enables use of the explanation sub-system by asking why and how questions
• Explanation system keeps track of reasoning process so that the user can verfiy
conclusions
AI 9
Knowledge representation using rules
AI 10
Knowledge representation using rules (cont’d)
AI 11
An example rule-base – the mortgage loan case
(Zahedi '93)
• The domain expertise needed for approving a mortgage loan contains the
following knowledge base:
• To get a mortgage loan,
• the applicant must have a steady job,
• acceptable income,
• good credit ratings; and
• the property should be acceptable.
• If applicant does not have a steady job, then they must have adequate
assets.
•
• The amount of loan cannot be more than 80 percent of the property
value, and the applicant must have 20 percent of the property value in
cash.
AI 12
An example rule-base – the mortgage loan
case (cont’d)
• The definition of a steady job:
• Applicant should have been at the present job for more than two years.
• The definition of adequate assets:
• Applicant’s properties must be valued at ten times the amount of the loan,
or the applicant must have liquid assets valued at five times the amount of
the loan.
• An acceptable property:
• Either located in the bank’s lending zone with no legal constraints, or is on
the bank’s exception list.
• The definition of adequate income:
• If applicant is single, then mortgage payment must be less than 70 percent
of their net income.
• If applicant is married, then mortgage payment must be less than 60
percent of the family net income.
AI 13
The mortgage loan case rule-base–
1. IF the applicant has a steady job
AND the applicant has adequate income
AND the property is acceptable
AND the applicant has good credit ratings
AND the amount of loan is less than 80% of the property value
AND the applicant has 20% of the property value in cash
THEN approve the loan
AI 14
The mortgage loan case rule-base–
AI 15
The mortgage loan case rule-base–
AI 16
Reasoning in a rule-based expert system
• Deductive reasoning:
• reasoning process starts with a set of premises already proven or
accepted
• new facts or conclusions are derived based on the premises using
rules of inference
AI 17
Rules of inference used in expert system
reasoning
• “Reasoning” based on the following rules of inference borrowed from
propositional logic:
• Modus ponens
• Hypothetical syllogism
• Modus tollens
and Boolean logic:
True AND True = True, True AND False = False,
False AND False = False, True OR False = True,
True OR True = True, False OR False = False etc.
• Modus ponens
Given a rule, if the antecedent is true, conclude that the consequent is also true.
Given IF X THEN Y
then if X is true
conclude: Y is true
AI 18
Rules of inference used in expert system
reasoning (cont’d)
• Hypothetical syllogism
When the consequent of one rule is the antecedent of a second rule, then
we can establish a third rule whose antecedent is that of the first rule
and whose consequent is that of the second.
IF X THEN Y
IF Y THEN Z
conclude: IF X THEN Z
AI 19
ES Reasoning process using multiple inferencing
• Multiple inferencing involves use of more than one rule for drawing a
conclusion
• The inference engine matches facts in the working memory with rules in
the rule-base to determine which rules apply
• More than one rule may match a fact. So all matching rules are put in a
conflict set by the inference engine
• The inference engine selects one rule from the conflict set and “fires”
(applies) it
• As a result of applying a rule, a new fact may be inferred, which is added to the
working memory
AI 20
ES Reasoning – conflict resolution
• The expert system may come to a halt (no more changes to working
memory) or repeat the match-and-fire cycle depending on the latest
inference
• Different order of selecting rules from the conflict set may result in
different outcomes
• Order of rule firing is determined by meta rules . The order can be made
to be
• independent of problem
• specific to a problem
AI 21
ES Reasoning – conflict resolution (cont’d)
AI 22
ES Reasoning – conflict resolution (cont’d)
• Fire rules with a large number of conditions on the LHS first (specificity)
Eg. (Negnevitsky 2005),
• Rule 1:
IF the season is autumn
AND the sky is cloudy
AND the forecast is rain
THEN advice is ‘stay home’
• Rule 2:
IF the season is autumn
THEN advice is ‘take an umbrella’
AI 23
Reasoning using forward and backward
chaining
• In backward chaining
• multiple inference starts with a goal
• It finds the rule whose consequent matches the goal
and goes backward to the antecedent part of the rule
• It then tries to establish the truth value of the antecedent part of the rule
• It does this by establishing the truth values of the propositions in the
antecedent
• This is done by finding rules having consequents matching the propositions
• If no such rule is found in the rule base, the user is asked to provide
information to establish the truth of the propositions
AI 24
Backward chaining in the mortgage loan example
Reasoning process starts with the goal: Approve loan for an applicant
• This goal is the consequent of rules (1) and (2).
• Assume rules are tested sequentially from the beginning of the rule base
• Rule (1) is fired, and its propositions become the current goals.
• The first proposition test is whether the applicant has a steady job.
• This is in the consequent of rule (3).
It asks the user if the applicant has a job.
If the answer is no, the inference engine does not go any further in (3). Since
‘applicant has a steady job’ is not true, it does not go any further with rule (1)
either
• As the goal could not be reached from rule (1), the inference engine tries rule (2)
next to establish the goal.
AI 25
The mortgage loan case rule-base –
1. IF the applicant has a steady job
AND the applicant has adequate income
AND the property is acceptable
AND the applicant has good credit ratings
AND the amount of loan is less than 80% of the property value
AND the applicant has 20% of the property value in cash
THEN approve the loan
AI 26
The mortgage loan case rule-base –
AI 27
The mortgage loan case rule-base –
6. IF the applicant is married
AND mortgage payment is less than 60% of the family net
income
THEN the family income is adequate
AI 28
Backward chaining in the mortgage loan example
(cont’d)
• The first proposition in rule (2) is if the applicant has adequate assets. This
becomes the current goal.
•
• Inference engine searches the rule base from the beginning to see which
rule has this proposition as its consequent.
It finds rule (8).
• So it asks the user if the applicant has properties with a value greater than
ten times the loan.
AI 29
Backward chaining in the mortgage loan
example (cont’d)
• If the answer is yes, the inference engine concludes that the applicant
has adequate assets and attempts to check the truth value of other
conditions in rule (2).
• If the answer is no, then the system asks whether the applicant has
liquid assets greater than five times the loan.
• If the user says no, the inference engine does not go any further because
it has failed to establish the truth of the goal. This means that the goal of
approving the loan cannot be supported.
AI 30
Forward Chaining
• The second method of multiple inferencing is
forward chaining
• The system requires the user to provide facts pertaining to the problem
• The inference engine tries to match each fact with the antecedent of a rule
• If the match succeeds, the rule fires and the truth of the consequent of that rule is
established, and is added to known facts of the case currently in working memory
• This process continues until the inference engine has drawn all possible
conclusions by matching facts to antecedents of rules in the knowledge base
AI 31
Forward Chaining example
• Assume the knowledge base consists of the following rules:
1.IF A THEN C
2.IF D THEN E
3.IF B AND C THEN F
4.IF E OR F THEN G
AI 32
Forward vs. Backward Chaining
• Forward chaining is data driven because it starts with the data about the case
and moves forward from the antecedents of rules to conclude their
consequents.
• Some expert system products allow for combining the two methods of
multiple inference.
AI 33
Dealing with uncertainty
• But in expert systems applied to real life problems uncertainty may arise:
• within the knowledge domain
• due to expert and knowledge engineer
• due to the user
AI 34
Dealing with uncertainty (cont’d)
AI 35
Dealing with uncertainty (cont’d)
AI 36
Calculation of rule confidence factor (cf) for
uncertain facts
A scheme for dealing with uncertainty
• Let P1 and P2 be two propositions and cf(P1) and cf(P2),
their certainty parameters
• Then
cf(P1 AND P2) = min (cf(P1), cf(P2))
cf(P1 OR P2) =max (cf(P1), cf(P2))
AI 37
Calculation of rule cf for uncertain facts
(cont’d)
• Example:
• IF interest rates fall (cf=0.6)
AND taxes are reduced (cf=0.8)
THEN stock market rises (Rule cf=0.9)
• The cf of the conclusion that the stock market is rising can be calculated
to be
(min(0.6,0.8) * 0.9 = 0.6 * 0.9 = 0.54
• If more than one rules lead to the same conclusion, the final conclusion
is given maximum cf value of all these rules
• CF system works, but only under fairly restrictive conditions (eg single
connections between rules)
AI 38
Uncertainty handling using probability theory
• There are schemes for handling uncertainty based on probability theory, but they
suffer from practical limitations
AI 39
REFERENCES
• AI Expert, October 1991 – presents applications of expert systems
• Dhar, V., & Stein, R., Seven Methods for Transforming Corporate Data into
Business Intelligence., Prentice Hall 1997, Ch 7
AI 40