You are on page 1of 43

IF . .

THEN KR Using rules


ECA (Event Condition Action)
RULES
. APLLICATIONS
EXAMPLES
1. If flammable liquid was spilled, call the fire
department.
2. If the pH of the spill is less than 6, the spill
material is an acid.
3. If the spill material is an acid, and the spill smells
like vinegar, the spill material is acetic acid.
( are used to represent rules)
FACTS

[][][]

MATCH EXECUTE

[][][]

Fig. 1 the rule Interpreted cycles through a


Match- Execute sequence
FACTS

A flammable Spill smells The spill


The pH of the
liquid was like vinegar material is
spill is < 6
spilled an acid

EXECUTE
MATCH
New fact added to the KB
RULES

If the pH of the spill is less than 6,the spill


material is acid

Fig.2 Rules execution can modify the facts


in the knowledge base
FACTS

A flammable The pH of the Spill smells The spill ACETIC


liquid was spill is < 6 like vinegar material is ACID
spilled an acid

MATCH

If the spill material is an acid and the spill


smells like vinegar, the spill material is
acetic acid EXECUTE

RULES

Fig.3 Facts added by rules can match rules


FACTS

A flammable The pH of the Spill smells


liquid was spill is < 6 like vinegar
spilled

EXECUTE Fire
MATCH dept
is
called

If a flammable liquid was spilled, call the


fire department

RULES

Fig.4 Rule execution can affect the real world


The spill
The pH of
material is
the spill is < 6
an acid

The spill
material is
an acetic
acid

Spill smells
like vinegar

Fig.5 Inference chain for inferring the spill material


A A
A E A E E
G E H H G
G C G C C H
C H B D F
B
B D B F D Z

MATCH EXECUTE EXECUTE


MATCH EXECUTE MATCH

F &B  Z F &B  Z F &B  Z


C &D  F C &D  F C &D  F
A D A D A D

RULES RULES
RULES

Fig. 6 An example of forward chaining


A D
F
C Z
B
Fig. 7 Inference chain produced by Fig. 6
FACTS FACTS FACTS FACTS FACTS FACTS FACTS FACTS FACTS
Step A E
A EH 1 2 A E 3 AE 4 A E 5 A E 7 A EH 8 AE H
G HC G H G H G H G CH
6 A E
G B C B B C B C B C B G H C
G GD FC
B D F BC BZ

Z not here F not


C here D not A here
here
here Have Have Have Z
C&D F&B
Want F

Want Z Want D Want A


Want
Get
F here C
Need to get C D Need to
Get A Execute Execute Execute
F
B

F&B  Z Z F&B  Z F&B  Z F&B  Z F&B  Z F&B  Z F&B  Z F&B  Z F&B  Z


D
C&D F C&D F C&D F C&D F C&D F C&D F C&D F C&D F C&D F
A D h A D A D A D
h
A D A D A D A D A D
e e
r r
RULES e RULES RULES RULES e RULES RULES RULES RULES RULES

Fig. 8 An example of Backward Chaining


Figure 1 ANTECEDENTS CONSEQUENTS

…… ……
……
…… ……
Rn If if1
if2
:
then then1
then2
:
Z1 If ?x has hair
then ?x is a mammal
Z2 If ?x gives milk
then ?x is a mammal
Z3 If ?x has feathers
then ?x is a bird
Z4 If ?x flies
?x lays eggs
then ?x is a bird
Z5 If ?x is a mammal
?x eats meat
then ?x is carnivore

Z6 If ?x is a mammal
?x has pointed teeth
?x has claws
?x has forward-pointing eyes
then ?x is carnivore

Z7 If ?x is a mammal
?x has hoops
then ?x is an ungulate

Z8 If ?x is a mammal
?x chews cud
then ?x is an ungulate
Z9 If ?x is a carnivore
?x has tawny color
?x has dark spots
then ?x is a cheetah

Z10 If ?x is a carnivore
?x has tawny color
?x has dark spots
then ?x is a tiger

Z11 If ?x is an ungulate
?x has long legs
?x has long neck
?x has tawny color
?x has dark spots
then ?x is a giraffe
Z12 If ?x is a ungulate
?x has white color
?x has black strips
then ?x is a zebra

Z13 If ?x is a bird
?x does not fly
?x has long legs
?x has long neck
?x is black and white
then ?x is a ostrich

Z14 If ?x is a bird
?x does not fly
?x has swim
?x is black and white
then ?x is a penguin
Z15 If ?x is a bird
?x is a good flyer
then ?x is an albatross

Stretch has hair.


Stretch chews cud.
Stretch has long legs.
Stretch has long neck.
Stretch has tawny color .
Stretch has dark spots.
Fired first
Has
hair is a mammal
Z1

Fired second
Chews cud is an ungulate
Z8

Fired third
Has long legs
is a
Has long neck Z11 giraffe
Has tawny color

Has dark sports

FIGURE: 2
Has forward-pointing eyes Fourth rule used

Has claws
Has pointed teeth
Z6 is a carnivore

Third rule used


Has
hair is a mammal
Z1

Second rule used

Eats meat is a carnivore


Z5 First rule used

Has tawny color


Z9
Has dark sports
is a cheetah
FIGURE: 3
Has Skin
ANIMAL
Ross Quillian
. Can Move Around

Eats

. Has Wings
Breathes

Bird Can fly Fish


Has feathers Is Pink

Shark . Can Bite


Salmon . Is Edible
Is Dangerous

. Can Sing
.
Ostrich
Has Long Thin Legs

Is all
Swims
Upstream to
Canary lay Eggs
Is Yellow Can’t fly

Fig. 1 A Typical Semantic Network


PENGUIN DOG

INST SUBC
SUBC

VICTOR POODLE TERRIOR


LIKES
INST
LIKES
CHARLEY

Fig. 5 Semantic Network with Property Relations


PENGUIN

INST

VICTOR

Fig.2 Simple Semantic Network


1. Victor is a Penguin

2. All Penguins are birds

3. All Birds are animals

4. All Mammals are animals

5. Charles is a Poodle

6. All dogs are mammals

7. All Poodle are Dogs

8. All Terriors are Dogs

Fig. 3 Facts about the Animal Kingdom


ANIMAL

SUBC SUBC

BIRD MAMMAL
SUBC SUBC

PENGUIN DOG

INSTANCE SUBC SUBC

VICTOR POODLE
TERRIER

INST

CHARLEY
From fig. 2

Fig. 4 A larger Semantic Network


ANIMAL
CAN FLY
SUBC SUBC

PROP BIRD MAMMAL RUN

SUBC SUBC PROP

CAN BARK
PENGUIN DOG PROP
SUBC
INST SUBC
TERRIER
PROP
HOSTILE VICTOR POODLE

LIKES PROP
LIKES
INST FRIENDLY

PROP
CHARLEY
BLACK

FIG.6 COMPLEX Semantic Network with properties


DOG

SUBC SUBC

POODLE LABRADOR RETRIEVER

INST INST

SUSIE
CHARLEY

PROP PROP

BLACK

Fig. 7 What can we do with this network ?


NAME
SLOT – 1 Filler
SLOT – 2 Filler
SLOT – 3 Filler
. . SUBS
. .
. .
SLOT - N Filler
Inheritance
INST
Link

Slot / Filler
Pair INST
INST

A Frame

Fig. 8 The Structure of a Frame System


HOME LOGIC OF FRAMES
ANIMAL
EARTH
. SLOT . CHRIS

. INST

DOG . INST

. SUBC CHARLEY
INST
. SLOT
.
. OWNER
SLOT
. . BLACK
SLOT INST

COLOR . . .
Fig- 9 Inheritance in a simple frame system
Conceptual Dependency

• Knowledge representation in natural language


sentences
• The goal is to represent the knowledge in a way
that:
– Facilitates drawing inference from the
sentences
– Is independent of the language in which the
sentences were originally stated.
p O R man
to
I ATRANS book < I
from
Symbols
• Arrow – direction of dependency
• Double arrows – two way link between actor and
action.
• P indicates past tense
• ATRANS is one of the primitive acts used by the
theory. It indicates transfer of possession.
• O indicates object case relation.
• R indicates the recipient case relation.

Fig.1 A sample conceptual dependency


Representation.
PRIMITIVES
• ATRANS- Transfer of an abstract relationship
• PTRANS- Trans of physical location of an object
• PROPLE- Application of physical force to an object
• MOVE - Movement of a body part by its owner (e.g.. Kick)
• GRASP - Grasping of an object by an actor
• INGEST
- Ingestion of an object by an animal (e.g. Eat)
• EXPEL- Expulsion of something from the body of an animal
(e.g. Tell)
• MTRANS - Transfer of mental information (e.g. Say)
• SPEAK - Production of sounds (e.g. Say)
• ATTEND – Focusing of a sense organ toward a stimulus (e.g. Listen)

Dependencies among the Conceptualization


There are four primitives conceptual categories from which
dependency structures can be built. They are :
ACTS Actions
PPs Objects (picture products)
AAs Modifiers of action (action aiders)
PAs Modifiers of PPs (picture aiders)

Rules Examples of their use English version of


p the example
1. PP ACT John PTRANS John ran
Rule 1 describes the relationship between an actor and the
event he or she causes – Two way dependency – p past tense.
2. PP ⇚⇛ PA John ⇚⇛ (height > average) John is tall
Rule 2 describes the relationship between PP and a PA that is
being asserted to describe it. Many state description such as
height, are represented in CD as numeric scales.
3. PP ⇚⇛ PP Jhon ⇚⇛ doctor John is a doctor.
Rule 3 describes the relationship between two PPs one of
which belongs to the set defined by the other.
4. PP boy
A nice boy
PA nice
Rule 4 describes the relationship between a PP and an attribute
that has already been predicted of it. Direction – toward PP

5. PP dog
Poss-by John’s dog
PP John
Rule 5 describes the relationship between two PPs, one of which
provides a particular kind of information about the other. Three
types of information are:
Possession – POSS-BY Location – LOC
Physical containment – CONT
The direction of arrow – towards the concept
6. ACT
O PP John PROPEL
O cart
John pushed the cart
Rule 6 describes the relationship between ac ACT and the PP that is the
object of ACT. The direction of the arrow is toward the ACT since the
context of the specific ACT determines the meaning of the object relation.

R PP
7. ACT
< PP
John
P R
John ATRANS
< Mary

book
John took the book from Mary
Rule 7 describes the relationship between an ACT and the source and the
recipient of the ACT
8. ACT I

P I John
John INGEST

O
do
ice cream

spoon
John ate ice cream with a spoon

Rule 8 describes the relationship between an ACT and the


instrument with which it is performed. The instrument must
always be a full conceptualization (i.e. it must contain an ACT)
not just a single physical object.
D
> PP P D > field
9. ACT John PTRANS

< PP < bag


O

fertilizer
John fertilized the field
Rule 9 describes the relationship between an ACT and its physical
source and destination
> PA > Size > x
10. ⇚
PP ⇚
plants

< PA < Size = x


The plants grow
Rule 10 represents the relationship between a PP and a state in
which it started and another in which it ended.
11. (a) (b)


>

<
O R > Bob
PEOPLE bullet
Bill
< gun

> health (-10)


Bob

p
<
Bill shot Bob
Rule 11 describes the relationship between one conceptualization and
another that causes it. Notice that the arrows indicate dependency of
one conceptualization on another and so point in the opposite direction
of the implication arrows. The two forms of the rule describe the cause
of an action and the cause of a state change.
Yesterday

(12) John PTRANS


P

John ran yesterday


Rule 12 describes the relationship between a
conceptualization and the time at which the event it
describes occurred.
Home
O D
(13) I PTRANS I
<I
O R
I MTRANS Frog CP
Eyes
While going home, I saw a frog.

Rule 13 describes the relationship between one conceptualization and


another that is the time of the first. The example for this rule also
shows how CD exploits a model of the human information processing
system; see is represented as the transfer of information between
the eyes and the conscious processor.
14 PP Woods

O R CP
MTRANS Frog

<Ears

I heard a frog in the woods.

Rule 14 describes the relationship between a


conceptualization and the place at which it occurred.
Scripts
Script-name: food market
Track: super market
ROLES: shopper
deli attendant
seafood attendant
checkout clerk
sacking clerk
other shoppers
Entry Conditions: shopper needs groceries food market open
PROPS: shopping cart
display aisles
market items
checkout stands
cashier
money
Scene 1: Enter Market
shopper PTRANS shopper into market
shopper PTRANS shopping – cart to shopper
Scene 2: Shop for Items
shopper MOVE shopper through aisles.
shopper ATTEND eyes to display items.
shopper PTRANS items to shopping cart.
Scene 3: Check out
shopper MOVE shopper to checkout stand.
shopper WAIT shopper turn.
shopper ATTEND eyes to charges.
shopper ATRANS money to cashier.
sacker ATRANS bags to shopper.
Scene 4: Exit Market
shopper PTRANS to exit market.
Results: shopper has less money
shopper has grocery items
market has less grocery items
market has more money

Fig-1 A supermarket script structure


KNOWLEDGE ACQUISITION

Formal

Domain Expert Knowledge Engineer

Knowledge Concepts,
Solutions
Knowledge
Base

Fig. 1 Typical Knowledge Acquisition Process.


Sources
 TEXTBOOKS

 REPORTS

 DATABASES

 CASE STUDIES

 EMPERICAL DATA

 PERSONAL EXPERIENCE

 DOMAINS EXPERTS ASSUME BASIC KNOWLEDGE


- Competent (more) – less desirable.
KE Paradox

 Don’t be your own expert

 Don’t believe everything experts say.


Types of Expert problem Solving
A D

E G

D E

Past Experience

Match Match Match

Situation Situation Situation Situation


A D E G

a) Problem solving by an expert in a familiar situation


Types of Expert problem Solving

GENERAL
PRINCIPLES

What What
What
Next ? Next ?
Next ?

Situation Situation Situation Situation


1 2 3 4

b) Problem solving by an expert in a novel situation


Techniques for Extracting Knowledge
from a domain expert

• On-site observation (Watch)


• Problem discussion (Explore the kind of data, knowledge &
Procedures)
• Problem description (Prototypical systems from expert)
• Problem Analysis (Sample problems solved by expert
given by KE)
• System Refinement (Rules)
• System Examination (Critics)
• System Validation (Outside expert)

You might also like