KR Using rulesIF . . THENECA (Event Condition Action)RULES . APLLICATIONSEXAMPLES1. 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 liquid was spilled
The pH of the spill is < 6
Spill smells like vinegar
The spill material is an acid
MATCH
EXECUTE
If the pH of the spill is less than 6,the spill material is acid
RULES
Fig.2 Rules execution can modify the facts in the knowledge base
New fact added to the KB
FACTS
A flammable liquid was spilled
The pH of the spill is < 6
Spill smells like vinegar
The spill material is an acid
ACETIC ACID
MATCH
EXECUTE
If the spill material is an acid and the spill smells like vinegar, the spill material is acetic acid
RULES
Fig.3 Facts added by rules can match rules
FACTS
A flammable liquid was spilled
The pH of the spill is < 6
Spill smells like vinegar
MATCHEXECUTE
If a flammable liquid was spilled, call the fire department
RULES
Fig.4 Rule execution can affect the real world
Fire dept is called
The pH of the spill is < 6
The spill material is an acid
Spill smells like vinegar
The spill material is an acetic acid
Fig.5 Inference chain for inferring the spill material
A
B
G
C
E
HD
A E
G C BH
B F
A E
G CH
D
Z
AG
FD
EH
B
C
MATCHMATCH MATCH EXECUTE
EXECUTEEXECUTE
F &B ZC &D F A D
F &B ZC &D F A D
F &B ZC &D F A D
RULES RULESRULES
Fig. 6 An example of forward chaining
FACTS FACTS FACTS FACTS FACTS FACTS FACTS FACTS FACTSStep 1 2 3 4 5 6 7 8
RULES RULES RULESRULESRULESRULESRULESRULESRULES
A E H
G CB
A EHG
B C
A EG HB C C C C C C
C
A A A A A AE E E E E E
G G G G G GH H H H H
H
B B B B B BD FD
FZ
F&B ZC&D FA D
F&B ZC&D FA D
F&B ZC&D FA D
F&B ZC&D FA D
F&B ZC&D FA D
F&B ZC&D FA D
F&B ZC&D FA D
F&B ZC&D FA D
F&B ZC&D FA D
Need to get
FB
Z not here
Want Z
Z
here
Get C D
F not here
Want F
F here
C here
Want C
Need toGet A
D not here
Want D Want A
A hereHave C & D
Have F & B
Have Z
Execute Execute Execute
D
here
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 milkthen ?x is a mammal
Z3 If ?x has feathersthen ?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 spotsthen ?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.
Z1
Z8
Z11
Fired firstHashair is a mammal
Fired second
is an ungulate
Fired third
is a giraffe
Has long legs
Has long neck
Has tawny color
Has dark sports
Chews cud
FIGURE: 2
Z6
Z1
Z9
Z5 First rule used
Second rule used
Third rule used
Fourth rule usedHas forward-pointing eyes
Has claws
Has pointed teethis a carnivore
is a carnivore
is a cheetah
is a mammal
Has hair
Eats meat
Has tawny color
Has dark sports
FIGURE: 3
ANIMAL
Bird Fish
Canary
Has Wings
Can fly
Has feathers
Has Skin
Can Move Around
Eats
Breathes
Can Sing
Is Yellow
Has Long Thin LegsIs all
Can’t fly
Can Bite
Is Dangerous
Shark
Is Pink
Is Edible
Swims Upstream to lay Eggs
Fig. 1 A Typical Semantic Network
.
.
. ... Salmon
Ostrich
Ross Quillian
PENGUIN
VICTOR
CHARLEY
POODLE
DOG
TERRIOR
LIKES
LIKES
INST SUBC SUBC
INST
Fig. 5 Semantic Network with Property Relations
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
BIRD
PENGUIN
VICTOR
MAMMAL
DOG
POODLETERRIER
CHARLEY
SUBC SUBC
SUBC SUBC
INSTANCE SUBCSUBC
INST
Fig. 4 A larger Semantic Network
From fig. 2
ANIMAL
MAMMALBIRD
PENGUIN DOG
VICTOR POODLE
CHARLEY
RUN
CAN BARK
TERRIER
FRIENDLY
BLACK
HOSTILE
CAN FLYSUBC SUBC
SUBC SUBC
SUBCINST
INST
SUBC
PROP
PROP
PROP
PROP
PROP
PROP
LIKESLIKES
FIG.6 COMPLEX Semantic Network with properties
DOG
POODLE LABRADOR RETRIEVER
SUSIECHARLEY
BLACK
SUBC SUBC
INST INST
PROPPROP
Fig. 7 What can we do with this network ?
NAMESLOT – 1 FillerSLOT – 2 FillerSLOT – 3 Filler...
.
.
.SLOT - N Filler
INST
SUBS
INST
Slot / Filler
Pair INST
A Frame
Inheritance Link
Fig. 8 The Structure of a Frame System
HOME
EARTH
DOG
SUBC
ANIMAL
SLOT CHRIS
INST
INST
SLOT
CHARLEY
INST
SLOT
SLOT
COLOR
BLACK
INST
OWNER
LOGIC OF FRAMES
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 Oto
I ATRANS book
man
I<from
R
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 ConceptualizationThere 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 ranRule 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 tallRule 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 PP John PROPEL 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.
7. ACT
John
John ATRANS
book
John took the book from Mary
Rule 7 describes the relationship between an ACT and the source and the
recipient of the ACT
< Mary
P
PP
< PP
O O
O
R
R
8. ACT
P I John John INGEST
O do
O
spoonJohn 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.
ice cream
I
9. ACT John PTRANS
10. ⇚ Rule 10 represents the relationship between a PP and a state in which it started and another in which it ended.
>
<
PP
PP
Dfield
bag
>
<O
fertilizer
John fertilized the field
P D
Rule 9 describes the relationship between an ACT and its physical source and destination
>
<PP
PA
PA
⇚>
<
Size > x
Size = x
plants
The plants grow
⇛
11. (a) (b)
⇛
⇚>
<
Bill PEOPLE bullet>
<
Bob
gun
Bob ⇛
⇚>
<
health (-10)
Bill shot Bob
O R
p
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.
(12) John PTRANS
Yesterday
John ran yesterday
Rule 12 describes the relationship between a conceptualization and the time at which the event it describes occurred.
(13) PTRANS IO D
Home
IMTRANS
OFrog
R CP
Eyes
I
I
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.
P
<
PP Woods
I heard a frog in the woods.
Rule 14 describes the relationship between a conceptualization and the place at which it occurred.
14
MTRANS Frog O R
< Ears
CP
ScriptsScript-name: food marketTrack: super marketROLES: shopper
deli attendant seafood attendant checkout clerk sacking clerk other shoppers
Entry Conditions: shopper needs groceries food market openPROPS: 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
Domain Expert Knowledge EngineerKnowledge Engineer
Knowledge Base
Knowledge Concepts, Solutions
Fig. 1 Typical Knowledge Acquisition Process.
Formal
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
Past Experience
A D
E G
D E
Match Match Match
Situation A
Situation D
Situation E
Situation G
a) Problem solving by an expert in a familiar situation
Types of Expert problem Solving
GENERAL PRINCIPLES
What Next ?
Situation 1
Situation 2
Situation 3
Situation 4
b) Problem solving by an expert in a novel situation
What Next ?
What Next ?
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)