Expert Systems
Expert Systems
Knowledge-based Systems
• Knowledge
– Understanding of a subject or domain
– Sum of what is currently known
– Sort of information that people use to solve problems.
• Knowledge includes:
– facts, concepts, procedures, models, heuristics, examples.
• Knowledge may be:
– specific or general
– exact or fuzzy
– procedural or declarative
• Expert
– Someone who possess knowledge
– Specifically, “Domain Expert”
– Possess deep knowledge i.e both facts and rules
What is an Expert System ?
• A computer system which is capable of
performing at the level of a human expert in a
narrow domain.
• Therefore, an expert system can, to a certain
extent, act as a substitute for the expert from
whom the knowledge was taken.
Rule: IF-THEN
Fact
Inference Engine
Explanation facilities
User Interface
Basic Structure of an
Expert System User
Structure of an Expert System
• Knowledge Base
– Contains domain knowledge useful for problem
solving
– Knowledge is represented as a set of rules
• Database
– Includes set of facts used to match against the IF
condition
• Inference Engine
– Carries out the reasoning to reach a solution
– Links rules in KB with facts in database
Structure of an Expert System
• Explanation facilities
– Enables users to ask the expert system how a
particular solution has been reached and why a
particular fact is needed.
– System must explain its reasoning and justify its
advice
• User Interface
– Means of communication between user and
expert system
Some additional components
• External Interface
– For the expert system to interact with external
programs, data, files etc.
• Developer Interface
– Knowledge base editors
• For logging facilities
– Debugging aids
– Input/output facilities
• Runtime knowledge acquisition
External
Database External program
Inference Engine
Explanation facilities
Developer
User Interface
Interface
Knowledge
User Expert
Engineer
Main Players in Expert System
Development
• Domain Expert
– Expert in the field
– Willing to devote time and share knowledge
• Knowledge Engineer
– Designing, building and testing
– Selects appropriate task for the expert system
– Interview domain expert and establishes reasoning
used by the expert and tries to model it for the
program
– Selecting development software
– Testing, revising and integrating
Main Players in Expert System
Development
• Programmer
– Writes programs to develop knowledge-base ,
database, inference engine and user interface
• Project Manager
– Leader of the development team
– Keeps the project on track
• End-User
– Persons who will use the expert system
Expert System Shell
• It is an expert system without the knowledge
base and the database
• Ready made program where the knowledge
engineer encodes the rules and facts
Important Characteristics of Expert
Systems
• Narrow, specialized domain
• Apply heuristics (thumb rules) to guide reasoning
• Clear separation of knowledge from control
structures
• Can trace the rules applied and provide
explanation
• Allows inexact reasoning
• Are allowed to make mistakes
• Allows improvement of quality through
addition/modification of rules
Inference Techniques in an Expert
System
• Knowledge-base : Rules and Database : Facts
• Inference Engine : compares rules in KB with
fact in DB and if match the rule is fired.
• The inference engine must decide which rules
have to be fired.
• Two ways
– Forward Chaining
– Backward Chaining
Forward Chaining
• Data driven reasoning
– Reasoning starts from known data and proceeds
– Each time only topmost rule is executed
– Fired rule adds new fact to database
– A rule can be executed only once
– Process stops when no further rule can be added.
Database
A B C D E
Knowledge base
Y&DZ
X&B&EY
AX
CL
L&MN
Database
A B C D E
Knowledge base
Y&DZ
X&B&EY
AX
CL
L&MN
Database
A B C D E
Knowledge base
Y&DZ
X&B&EY
AX
CL
L&MN
Database
A B C D E
L X
Knowledge base
Y&DZ
X&B&EY
AX
CL
L&MN
Database
A B C D E
L X
Knowledge base
Y&DZ
X&B&EY
AX
CL
L&MN
Database
A B C D E
Y L X
Knowledge base
Y&DZ
X&B&EY
AX
CL
L&MN
Database
A B C D E
Y L X
Knowledge base
Y&DZ
X&B&EY
AX
CL
L&MN
Database
A B C D E
Y L X z
Knowledge base
Y&DZ
X&B&EY
AX
CL
C&LN
Disadvantage of Forward Chaining
• Many rules may be executed which may not
be related to the goal.
Backward Chaining
• Goal-Driven Reasoning
• Expert system starts from the goal and
matches with rules which has the goal in the
THEN side
• If such a rule is found and its IF part matched
the facts in the database, then the rule is fired
and the goal is proved.
More of Backward Chaining
• If the facts matching the IF side is not found,
then put rule in a stack and set up a sub-goal
which is the IF part of the selected rule.
• Process continues till no more rules are found
to prove the sub-goal.
Database
A B C D E
Knowledge base
Y&DZ
X&B&EY
AX
CL
Goal : Z
C&LN
Database
A B C D E
Knowledge base
Y&DZ
X&B&EY
AX
CL
Sub Goal :
C&LN
Y
Database
A B C D E
Knowledge base
Y&DZ
X&B&EY
AX
CL
Sub Goal :
C&LN
X
Database
A B C D E
Knowledge base
Y&DZ
X&B&EY
AX
CL
Sub Goal :
C&LN
X
Database
A B C D E
X Y
Knowledge base
Y&DZ
X&B&EY
AX
CL
Sub Goal :
C&LN
Y
Database
A B C D E
X Y Z
Knowledge base
Y&DZ
X&B&EY
AX
CL
Sub Goal :
C&LN
Z
Conflict Resolution
• If two or more matching rules are found then
determine which rule will be fired
• For Example,
(1) A B
(2) A C
What is the order in which the rules will be fired?
If Forward Chaining, then order is (1) and (2)
• Ordering of rules is important.
Conflict Resolution Methods
• Stop when goal is reached.
Eg. (1) A B
(2) A C
If B is goal then do not fire (2)
• Assign priorities to rules and fire according to
priorities
Eg.(1) A B (Priority 100)
(2) A C (Priority 99)
Fire (1)
Conflict Resolution Methods
• Longest Matching Strategy :Fire most specific rule
Eg. (1) A & B & C D
(2) A X
Fire (1)
• Fire data most recently entered : attach time tags
Eg (1) A & B & C D [12.25 PM 09/11/09]
(2) A X [12.55 PM 09/11/09]
Fire (2)
Advantages of Rule-Based Systems
• Natural Language Representation
• Uniform Structure
• Separation of knowledge from processing
• Dealing with incomplete and uncertain
knowledge
Disadvantages of Rule-Based Systems
• Opaque relations between rules
• Ineffective search strategy
• Inability to learn