Course Outline
• Introduction to Artificial Intelligence
• Introduction to Expert Systems
• Representation of Knowledge • Methods of Inference
• CLIPS
• Reasoning under Uncertainty • Design of Expert Systems
Introduction to Expert Systems
• What is an expert system?
• Concept and characteristics of ES
• ES technology
• ES tools
• ES elements
What is an expert system?
1• a computer system that emulates the decision-making ability of a human expert in a restricted domain [Giarratano & Riley 1998]
• Edward Feigenbaum
– “An intelligent computer program that uses knowledge and inference procedures to solve problems that are difficult enough to require significant human expertise for their solutions.” [Giarratano & Riley 1998]
• the term knowledge-based system is often used synonymously
What is an Expert System?
2• relies on internally represented knowledge to perform tasks
• utilizes reasoning methods to derive appropriate new knowledge
• usually restricted to a specific problem domain • some systems try to capture common-sense
knowledge
– General Problem Solver (Newell, Shaw, Simon) – Cyc (Lenat)
What is an expert system?
3• Main components
Knowledge Base
Inference Engine
User interface Explanation System facts
users
What is an expert system?
4• knowledge base
– contains essential information about the problem domain – often represented as facts and rules
• inference engine
– mechanism to derive new knowledge from the knowledge base and the information provided by the user
– often based on the use of rules
• user interface
– interaction with end users
Concept and characteristics of ES
1• knowledge acquisition
– transfer of knowledge from humans to computers – sometimes knowledge can be acquired directly
from the environment
• machine learning
• knowledge representation
– suitable for storing and processing knowledge in computers
Concept and characteristics of ES
2• inference
– mechanism that allows the generation of new conclusions from existing knowledge in a
computer
• explanation
– illustrates to the user how and why a particular solution was generated
ES Technology
1• strongly influenced by cognitive science and mathematics
– the way humans solve problems
– formal foundations, especially logic and inference
• production rules as representation mechanism
– IF … THEN type rules
– reasonably close to human reasoning – can be manipulated by computers – appropriate granularity
• knowledge “chunks” are manageable both for humans and for computers
ES Technology
2• rules can be used to formulate a theory of human information processing (Newell & Simon)
– rules are stored in long-term memory
– temporary knowledge is kept in short-term memory
– sensory input or thinking triggers the activation of rules – activated rules may trigger further activation
– a cognitive processor combines evidence from currently active rules
• this model is the basis for the design of many rule-based systems
ES Technology
3• Early ES Success Stories
– DENDRAL
• identification of chemical constituents
– MYCIN
• diagnosis of illnesses
– PROSPECTOR
• analysis of geological data for minerals
• discovered a mineral deposit worth $100 million
– XCON/R1
• configuration of DEC VAX computer systems • saved lots of time and millions of dollars
ES Technology
4• The Key to ES Success
– convincing ideas
• rules, cognitive models
– practical applications
• medicine, computer technology, …
– separation of knowledge and inference
• expert system shell
– allows the re-use of the “machinery” for different domains – concentration on domain knowledge
ES Technology
5• expert systems are not suitable for all types
of domains and tasks
– conventional algorithms are known and efficient
– the main challenge is computation, not knowledge
– knowledge cannot be captured easily
– users may be reluctant to apply an expert system to a critical task
ES Tools
• ES languages
– higher-level languages specifically designed for knowledge representation and reasoning
– SAIL, KRL, KQML, DAML
• ES shells
– an ES development tool/environment where the user provides the knowledge base
ES Elements
1• knowledge base
• inference engine
• working memory
• agenda
• explanation facility
• knowledge acquisition facility
• user interface
ES Elements
2- Structure
Knowledge Base Inference Engine Working Memory User Interface Knowledge Acquisition Facility Explanation Facility AgendaRule-Based ES
• knowledge is encoded as IF … THEN rules
– these rules can also be written as production rules
• the inference engine determines which rule antecedents are satisfied
– the left-hand side must “match” a fact in the working memory
• satisfied rules are placed on the agenda
• rules on the agenda can be activated (“fired”)
– an activated rule may generate new facts through its right-hand side
– the activation of one rule may subsequently cause the activation of other rules
Example Rules
Production Rules
the light is red ==> stop
the light is green ==> go
antecedent (left-hand-side)
consequent
(right-hand-side)
IF … THEN Rules
Rule: Red_Light
IF the light is red
THEN stop
Rule: Green_Light
IF the light is green
THEN go
antecedent
(left-hand-side)
consequent
19
MYCIN Sample Rule
Human-Readable Format
IF the stain of the organism is gram negative AND the morphology of the organism is rod
AND the aerobiocity of the organism is gram anaerobic THEN the there is strongly suggestive evidence (0.8)
that the class of the organism is enterobacteriaceae
MYCIN Format
IF (AND (SAME CNTEXT GRAM GRAMNEG) (SAME CNTEXT MORPH ROD)
(SAME CNTEXT AIR AEROBIC)
THEN (CONCLUDE CNTEXT CLASS ENTEROBACTERIACEAE TALLY .8)
20
Inference Engine Cycle
• describes the execution of rules by the inference engine
– conflict resolution
• select the rule with the highest priority from the agenda
– execution
• perform the actions on the consequent of the selected rule • remove the rule from the agenda
– match
• update the agenda
– add rules whose antecedents are satisfied to the agenda – remove rules with non-satisfied agendas
• the cycle ends when no more rules are on the agenda, or when an explicit stop command is encountered
Forward and Backward Chaining
• different methods of rule activation
– forward chaining (data-driven)
• reasoning from facts to the conclusion
• as soon as facts are available, they are used to match antecedents of rules • a rule can be activated if all parts of the antecedent are satisfied
• often used for real-time expert systems in monitoring and control
• examples: CLIPS, OPS5
– backward chaining (query-driven)
• starting from a hypothesis (query), supporting rules and facts are sought until all parts of the antecedent of the hypothesis are satisfied
• often used in diagnostic and consultation systems • examples: EMYCIN
Forward Chaining Example
1• Example:
Rule: elephant (x) mamal (x) mamal (x) animal (x) Fact: elephant (John) Reasoning:• Unification
The process of finding substitutions for variables to make arguments match
elephant (John) │x = John elephant (x) mamal (x) │ mamal (x) animal (x) │ animal (John)
Forward Chaining Example
2• Rule1:A1 and B1 then C1 Rule2:A2 and C1 then D2 Rule3:A3 and B2 then D3 Rule4:C1 and D3 then G • Facts:{A1,B1,A2,A3,B2} • Forward Reasoning {A1,B1,A2,A3,B2} {r1,r3} Fire r1 {A1,B1,A2,A3,B2,C1} {r1,r2,r3} Fire r2 {A1,B1,A2,A3,B2,C1,D2} {r1,r2,r3} Fire r3 {A1,B1,A2,A3,B2,C1,D2,D3} {r1,r2,r3,r4} {A1,B1,A2,A3,B2,C1,D2,D3, G } match match match match
Backward Chaining Example
1• Example
Rule: elephant (x) mamal (x) mamal (x) animal (x) Fact: elephant (John) Reasoning:• Helpful for asking the right questions
animal (John) │x = John mamal (x) animal (x) │ Elephant (x) mamaal (x) │ Elephant (John) (evidence)
Backward Chaining Example
2• Rule1:A1 and B1 then C1 Rule2:A2 and C1 then D2 Rule3:A3 and B2 then D3 Rule4:C1 and D3 then G Rule5:C1 and D4 then G' • Facts:{A1,B1,A2,A3,B2} • Backward Reasoning
– Assume G ' is true │r5
verify C1 and D4 Fail │ r1 verify A1 and B1 – Assume G is true │r4 Success verify C1 and D3 │r1 verify A1 and B1 verify A3 and B2 r3 x Goal
Production Systems
Rule-Based Expert Systems
Knowledge Base Inference Engine Rules Pattern Matching Facts Rete Algorithm Markov Algorithm Post Production Rules Conflict Resolution Action Execution
Post Production Systems
• production rules were used by the logician Emil L. Post in the early 40s in symbolic logic
• Post’s theoretical result
– any system in mathematics or logic can be written as a production system
• basic principle of production rules
– a set of rules governs the conversion of a set of strings into another set of strings
• these rules are also known as rewrite rules • simple syntactic string manipulation
• no understanding or interpretation is required • also used to define grammars of languages
Markov Algorithms
• in the 1950s, A. A. Markov introduced
priorities as a control structure for
production systems
– rules with higher priorities are applied first
– allows more efficient execution of production systems
– but still not efficient enough for expert systems with large sets of rules
Rete Algorithm
• developed by Charles L. Forgy in the late
70s for CMU’s OPS (Official Production
System) shell
– stores information about the antecedents in a network
– in every cycle, it only checks for changes in the networks
ES Advantages
• economical
– lower cost per user
• availability
– accessible anytime, almost anywhere
• response time
– often faster than human experts
• reliability
– can be greater than that of human experts
– no distraction, fatigue, emotional involvement, …
• explanation
– reasoning steps that lead to a particular conclusion
• intellectual property
ES Problems
• limited knowledge
– “shallow” knowledge
• no “deep” understanding of the concepts and their relationships – no “common-sense” knowledge
– no knowledge from possibly relevant related domains – “closed world”
• the ES knows only what it has been explicitly “told” • it doesn’t know what it doesn’t know
• mechanical reasoning
– may not have or select the most appropriate method for a particular problem – some “easy” problems are computationally very expensive
• lack of trust
Summary
• expert systems or knowledge based systems are used to represent and process in a format that is suitable for computers but still
understandable by humans
– If-Then rules are a popular format
• the main components of an expert system are
– knowledge base – inference engine
• ES can be cheaper, faster, more accessible, and more reliable than humans
• ES have limited knowledge (especially “common-sense”), can be difficult and expensive to develop, and users may not trust them for critical decisions