0% found this document useful (0 votes)
27 views54 pages

CSE440 Lec 2 Rule-Based

The document discusses rule-based expert systems, including their basic characteristics, architecture, knowledge representation using rules, and inference methods like forward and backward chaining. It also covers explanation capabilities and knowledge base editing.

Uploaded by

Sumaiya Sadia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views54 pages

CSE440 Lec 2 Rule-Based

The document discusses rule-based expert systems, including their basic characteristics, architecture, knowledge representation using rules, and inference methods like forward and backward chaining. It also covers explanation capabilities and knowledge base editing.

Uploaded by

Sumaiya Sadia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 54

Artificial Intelligence

Lecture #2: Rule-based Expert


system

Dr. Md. Sazzad Hossain, PhD(Japan)


Professor
Department of CSE
Mawlana Bhashani Science and Technology University
Email: [email protected]

1
Contents
 Expert System: Introduction
 Expert System: Basic Characteristics
 Expert System: Basic Architecture
 Structure of Rule-Based Expert System
 Advantages & Disadvantages of Rule-based Expert
System
 Inference Process
 Forward Chaining and Backward Chaining
 Conflict Resolutions
Expert System: Introduction

 A set of programs that manipulate encoded knowledge to solve


problems in a specialized manner.
 Knowledge is a theoretical or practical understanding of a subjects or
domain.
 Those who posses knowledge are called experts
 Knowledge is obtained from expert source
 Knowledge is Coded in a form that is suitable to use
 Anyone can be considered a domain expert if he or she has deep
knowledge and strong practical experience in a particular domain
 An expert is a skillful person who can do things other people cannot.
Expert System: Introduction (Cont.)

 A computer Program Capable of performing at a


human-expert level in a narrow problem domain
area is called an expert system.
 The most popular expert systems are rule-based
expert systems
Expert System
Basic Characteristics
 Should have high-quality performance
 Use knowledge rather than data
 Capable of explaining how a particular conclusion
is reached and why requested information is needed
 Use symbolic representation and perform inference
through symbolic computation
 Often reason with knowledge about themselves
Expert System:Basic Architecture
Explanation
module

I/O Interface Inference Case history


Engine

Editor
Knowledge Working
Base Memory

Learning
module
The knowledge Base
 Contains the domain knowledge useful for problem
solving. In a rule-based expert system, the knowledge is
represented as a set of rules.
 Any rule consists of two parts: IF
(Antecedent/Condition)---------------THEN
(Consequent/Action).
 IF –the ‘traffic light’ is green------THEN the action is ‘Go’
 IF –the ‘traffic light’ is red------THEN the action is ‘Stop’
 The Database includes a set of Facts used to match against
IF (condition) parts of rules stored in the knowledge base
Inference Engine

 The inference engine carries out the reasoning


whereby the expert system reaches a solution.
 It links the rules given in the knowledge-base with the facts
provided in the database
 Accepts user input query
 Responses to questions through the I/O
Inference Process (1 of 4)

 In rule-based expert system, the domain


knowledge is represented by a set of IF-THEN
production rules and data is represented by a set
of facts about the current situation.

 The inference engine compares each rule stored in


the knowledge base with facts contained in the
database.
Inference Process (2 of 4)
Done in three stages:
 match  select  execute
 Match : contents of the working memory are compared to
the facts and rules contained in the knowledge base
 Select: When consistent match found the corresponding
rules are placed in the conflict set.
 Execute: When all matched rules are placed in the conflict
set one of the rules is selected for execution
Inference Process (3 of 4)

Database

Fact: A is X Fact: B is y

Match Fire

Knowledge base

Rule: IF A is x THEN B is y

Figure : The inference engine cycles via a match-fire procedure


Inference Process (4 of 4)

 The matching of the IF parts to the facts produces


inference chains.
 The inference engine must decide when the rules
have to be fired. There are two principal ways in
which rules are executed:
 Forward Chaining
 Backward Chaining
Inference Process: Forward Chaining

It’s the data-driven reasoning.


The reasoning starts from the known data and
proceeds forward with that data.
Each time only the topmost rule is executed.
When fired, the rule adds a new fact in the
database.
Any rule can be executed only once.
The match-fire cycle stops when no further rules
can be fired.
Inference Process: Forward Chaining

Let’s see an example


Inference Process: Forward Chaining
Database Database
A B C D E A B C D E

X X L

Match Fire Match Fire


Knowledge-Base Knowledge-Base
Y&D Z Y&D Z
X&B&EY X&B&EY
AX AX
CL CL
L&MN L&MN

Cycle #1
Inference Process: Forward Chaining
Database
Database
A B C D E
A B C D E
X L Y
X L Y Z

Match Fire
Match Fire
Knowledge-Base
Knowledge-Base
Y&D Z
Y&D Z
X&B&EY
X&B&EY
AX
AX
CL
CL
L&MN
L&MN

Cycle #2 Cycle #3
Inference Process: Backward Chaining

It’s the goal-driven reasoning.


Here an expert system has the goal and the
inference engine attempts to find the evidence to
prove it.
First the knowledge base is searched to find rules
that might have the desired solution.
Such rules must have the goal in their THEN
parts. If such rule is found and its IF part matches
data in the database, then the rule is fired and the
goal is proved.
Inference Process: Backward Chaining
Database
Database
A B C D E
A B C D E

Z
Y

Knowledge-Base
Knowledge-Base
Y&D Z
Y&D Z
X&B&EY
X&B&EY
AX
AX
CL
CL
L&MN
L&MN

Pass 1: Goal: Z Pass 2: Sub-goal: y


Inference Process: Backward Chaining
Database
Database
A B C D E
A B C D E

? X

X
Match Fire
Knowledge-Base
Knowledge-Base
Y&D Z
Y&D Z
X&B&EY
X&B&EY
AX
AX
CL
CL
L&MN
L&MN

Pass 3: Sub goal:X Pass 4: Sub goal:X


Inference Process: Backward Chaining
Database Database
A B C D E A B C D E
X Y X Y Z

Match Fire Match Fire


Knowledge-Base Knowledge-Base
Y&D Z Y&D Z
X&B&EY X&B&EY
AX AX
CL CL
L&MN L&MN

Pass 5: Sub-goal: Y Pass 6:Goal: Z


Forward vs. Backward Chaining

Forward Chaining Backward Chaining


planning, control diagnosis
data-driven goal-driven (hypothesis)
bottom-up reasoning top-down reasoning
find possible conclusions find facts that support a given
supported by given facts hypothesis
similar to breadth-first search similar to depth-first search
antecedents (LHS) control consequents (RHS) control
evaluation evaluation
Explanation
 The Explanation facilities enable the user to ask the expert
system how particular conclusion is reached and why a
specific fact is needed.
 Explanation module trace the chain of rules fired during a
consultation with the user (the sequence of rules that led to
the conclusion).
 Explanation module must be able to explain why certain
information is needed by the inference engine to complete
a step in the reasoning process
Editor: Building knowledge base
 Special editor used by the developers:
 to create new rules for addition to the knowledge base,
 to delete outmoded rules, or
 to modify existing rules in some way.
 Editor of this type is designed to provide consistency test
for the newly created rules, to add missing condition to a
rule to reformat a newly created rule.
The I/O interface

 The external interface allows an expert system to


work with external data files and programs written
in conventional programming language.
 User communicate with the system in a more natural
way.
 The system must have special prompt and special
vocabulary which encompasses the terminology of
the given domain of expertise.
Structure: Rule-Based Expert System

Knowledge base Database

Rule: IF…THEN Fact

Inference engine

Explanation facilities

User interface

User
Conflict Resolutions in
Rule-Based Systems

 Let’s see an example….


What is Conflict?

A situationwhen two or more actions are found for


only one condition

Or, When two or more rules are fired at a time.


Example of Conflict

Rule 1 Rule 2

IF IF
The Agent has two legs The Agent has two legs
AND The Agent has two hands AND The Agent has two hands
AND The Agent can sleep AND The Agent can sleep

THEN THEN

The Agent is a Man The Agent is not a Man


How to Resolve A Conflict?

According to Yoshiaki Shirai and Saburo Tsuji:

They are Three methods to resolve conflict in a rule-


based system:
 Fire the rule with the Highest priority
 Fire the rule with the Longest Match
 Fire the rule with the Data most recently entered
Fire the rule with the Highest priority

 How can you define the Highest Priority?


 Let’s see how a Robo girl defines priority
A Robo Girl

It’s just an
example. I’ll say
later about this
robot.
Partner Ballroom Dance Robot
(OBDR).
 The Kosuge-Wang Laboratory
in Tohoku Univ. (Division of
Mechanical Engineering, Dept.
of Bioengineering and
Robotics), Nomura Unison
Inc., and Torowazo Inc.
teamed up to develop this
Partner Ballroom Dance
Robot(OBDR).

 This robot was exhibited at the


Prototype Robot Exhibit at EXPO
2005 Aichi Japan.

 The used information in these


slides are just to make examples.
They are not true.
Will you
Agent 1 dance with
me?

Robo girl has given the priority 90


Will you
Agent 2 dance with
me?

Robo girl has given the priority 10 !!


 Result is …
 And the next ……
What’s the priority? (90+90) = 180 ??
Method 1
Highest Priority
Rule 1 Rule 2

IF (Priority 90) IF (Priority 10)

The Agent asks to dance The Agent asks to dance


AND The Agent’s age is below 35 AND The Agent’s age is above 60

THEN THEN

Say ‘Yes’ and Dance Say ‘Sorry Sir!’


Method 2: Longest Match

Rule 1 Rule 2

IF IF
The Agent is in the front The Agent is in the front

AND The Agent is a man AND The Agent is a man


AND The Agent is bowing

THEN THEN

Say ‘Hello’ Bow


1. Agent is in the
front

2. Agent is a man

3. Agent is bowing
 SO…..
Robot is bowing……..
Method 3
Let’s see a photograph of Mr.
Bob taken Last Year.
Date of photograph April 24, 2021
Now see a photograph of This
Year.
Date of photograph February 10, 2024
Method 3
Timestamp
Rule 1 Rule 2

IF IF

The Question is “Is Mr. Bob The Question is “Is Mr. Bob
bald?” bald?”
[08:16PM 10/02/2023] [08:16PM 10/02/2024]

THEN THEN

Say ‘Yes’ Say ‘NO’


So now on 10/02/2024

• Is Mr. Bob bald?



ANSWER IS NO
Rule-Based Expert Systems
Advantages & Disadvantages
Advantages:
 natural knowledge representation

 uniform structure

 separation of knowledge from its processing

Disadvantages:
 especially opaque relations between rules

 ineffective search strategy and

 inability to learn.
End of Presentation

Questions/Suggestions

Thanks to all !!!

You might also like