Expert Systems II: Inference Engines and Chaining Strategies
Overview of Expert Systems Components
Main Components and Human Interfaces:
Human Expert: Provides the domain-specific knowledge to be encoded into the system.
Knowledge Engineer: The individual who translates the expert's knowledge into a computer-understandable format.
Knowledge Base: The storage area for the rules and facts collected from the human expert.
Inference Engine: The "brain" of the expert system that processes rules and facts to derive conclusions.
User Interface: The medium through which the user interacts with the system.
User: The person seeking advice or information (who may not be an expert in the field).
The Inference Engine
Definition: The inference engine is responsible for drawing conclusions from the knowledge base.
Conceptual Examples of Inferencing:
Case 1: If given the facts "All boys have a mother" and "John is a boy," the inference engine can deduce that "John has a mother" without being explicitly told that specific fact.
Case 2: If given the facts "All men are mortal" and "Socrates is a man," the engine infers that "Socrates is mortal."
Knowledge Representation: This course focuses on inferring using knowledge represented in RULES.
Rule-based Expert Systems: Expert systems that store knowledge in the form of rules in their knowledge base.
The Inference Cycle: The engine cycles through three primary steps:
Match: Compare facts against the rules in the knowledge base.
Select/Fire: Select a specific rule to apply.
Execute: Carry out the action dictated by the rule.
Inference Strategies
Forward Chaining (Data-Driven):
Starts with available facts and uses rules to draw conclusions or take actions.
Best Use Cases: Prognosis, monitoring, and control systems.
Example Tools: CLIPS, OPS5.
Backward Chaining (Goal/Query-Driven):
Works backward from a specific goal or decision to look for rules that provide the necessary evidence to support that goal.
Best Use Cases: Diagnosis problems.
Example Tools: MYCIN.
Forward Chaining: Detailed Mechanics
Approach: It is data-driven, starting from information as it is received or basic ideas to reach a conclusion.
Mechanism: The computer analyzes the facts to find matches with the "IF" conditions of IF-THEN rules.
Behavioral Example: A salesperson uses forward chaining if they ask: "The customer wants comfort and has enough money (); what should I recommend to them?"
Step-by-Step Logic Example 1:
Rule Base:
Knowledge Base (Existing): ,
Process:
Facts and fire , producing fact .
Fact fires , producing fact .
Facts and (now in the KB) fire , producing fact .
Sequence: . The conclusion is .
Step-by-Step Logic Example 2:
Rule Base:
Knowledge Base (Existing): , , , ,
Process:
Fact triggers , creating .
Fact triggers , creating .
Facts trigger , creating .
Facts trigger , creating .
is not executed because fact is missing.
Sequence: .
Backward Chaining: Detailed Mechanics
Approach: It is goal-driven, starting from a hypothesized outcome and seeking evidence to support or contradict it.
Mechanism: This often involves testing intermediate hypotheses (sub-hypotheses).
Behavioral Example: A salesperson uses backward chaining if they ask: "Do I recommend a Rolls Royce to this customer or not?" They start with the conclusion and work toward the explanation.
Step-by-Step Logic Example 1:
Rule Base: Same as Forward Chaining Example 1. ()
Goal:
Process:
To prove , the system needs and ().
To prove , the system needs (). Fact exists.
To prove , the system needs and (). Facts and exist.
Sequence: .
Step-by-Step Logic Example 2:
Rule Base: Same as Forward Chaining Example 2. ()
Goal:
Process:
To prove , it needs and (). exists.
To prove , it needs (). and exist.
To prove , it needs (). exists.
Sequence: .
Practical Case Study: Car Diagnosis Expert System
Rules Provided:
Rule 1: IF the engine is getting gas AND the engine will turn over THEN the problem is spark plugs.
Rule 2: IF the engine does not turn over AND the lights do not come on THEN the problem is battery or cables.
Rule 3: IF the engine does not turn over AND the lights do come on THEN the problem is the starter motor.
Rule 4: IF there is gas in the fuel tank AND there is gas in the carburetor THEN the engine is getting gas.
Forward Chaining Scenario:
Existing Knowledge: (Gas in fuel tank), (Gas in carburetor), (Engine will turn over).
Deduction: (Engine is getting gas).
Further Deduction: (Problem is spark plugs).
Conclusion: The problem is spark plugs.
Backward Chaining Scenario:
Goal (): The problem is spark plugs.
Deduction: The system checks Rule 1. It needs "turn over" and "getting gas." It finds "turn over" in the knowledge base but must trigger Rule 4 to prove "getting gas."
Real-World Application: NHS 111 Online
System Details: A popular expert system used by the National Health Service (UK) website. Doctors have collated symptom-illness rules to triage patients.
Information Gathering Steps:
Identity: Sex, Age, and Location (Postcode).
Emergency Filtering: Checks for critical conditions (signs of heart attack, stroke, severe breathing difficulty, severe injuries, seizures, or heavy bleeding).
Topic Identification: User selects primary symptom (e.g., "Sneezing").
Triage Questions: Assessing illness severity (e.g., "Have you stopped usual daily activities?", "Are you breathing harder when doing nothing?", "Fever results?").
Outcomes/Advice Generated:
Speak to GP within 24 hours.
Speak to GP urgently (within 1 hour).
Phone 999 for an ambulance.
Self-care instructions (rest, fluids, paracetamol, ibuprofen guidelines).
Appropriateness of Expert Systems
Criteria for using an Expert System:
The solution justifies the development cost and effort.
Human expertise is scarce or not universally available.
The problem involves symbols and reasoning rather than just numbers.
Domain is well-structured and does not require "common sense."
Traditional computing methods (standard algorithms) are insufficient.
Experts are available, cooperative, and articulate.
The problem has a manageable size and scope.
System Requirements:
Ability to handle uncertain data (e.g., "I don't know").
Limited to a specific area of expertise.
Must explain the reasoning behind its advice.
Strengths and Weaknesses
Strengths:
Consistency in repetitive tasks and decisions.
Maintains massive levels of technical information.
Reduces training costs for human employees.
Centralizes decision-making power.
Efficiency and speed in problem-solving.
Synthesizes the intelligence of multiple experts.
Minimizes human error and oversight.
Provides strategic advantages against competitors.
Weaknesses:
Requires extensive, detailed knowledge during build.
Knowledge domain is strictly restricted.
Not all knowledge can be formatted as IF-THEN rules.
Requires consensus among experts (which may not exist).
Experts may struggle to explain their logic.
Knowledge acquisition is time-consuming.
Difficulty in adapting to changing environments (lack of flexibility).
Inability to recognize when it cannot provide an answer.
Questions & Interaction
Decision Rule:
To prove a decision: Use Backward Chaining.
To find all possible solutions: Use Forward Chaining.
Knowledge Base Transition: The notes demonstrate how facts (Knowledge Base) transition to New Knowledge as rules fire during the forward chaining process.