Presentation on theme: "KR Using rules IF.. THEN ECA (Event Condition Action) RULES. APLLICATIONS EXAMPLES 1.If flammable liquid was spilled, call the fire department. 2.If the."— Presentation transcript:
KR Using rules IF.. THEN 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 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 MATCH EXECUTE 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 H D A E G C B H B F A E GC H D Z A G F D E H B C MATCH EXECUTE F &B Z C &D F A D F &B Z C &D F A D F &B Z C &D F A D RULES Fig. 6 An example of forward chaining
AD C F B Z Fig. 7 Inference chain produced by Fig. 6
FACTS Step 1 2345 67 8 RULES A E H GCB AE H G B C AE G H BCCCC CC C AA A AAA EE E E EE GG G G G G HH H H H H B B B BBB D F D F Z F&B Z C&D F A D F&B Z C&D F A D F&B Z C&D F A D F&B Z C&D F A D F&B Z C&D F A D F&B Z C&D F A D F&B Z C&D F A D F&B Z C&D F A D F&B Z C&D F A D Need to get F B Z not here Want Z ZhereZhere Get C D F not here Want F F here C here Want C Need to Get A D not here Want D Want A A here Have C & D Have F & B Have Z Execute DhereDhere Fig. 8 An example of Backward Chaining
Figure 1 ANTECEDENTSCONSEQUENTS …… Rn If if1 if2 : then then1 then2 : Z1If?x has hair then ?xis a mammal Z2If?x gives milk then ?x is a mammal Z3If?x has feathers then ?xis a bird Z4If?x flies ?x lays eggs then ?xis a bird
Z5If?xis a mammal ?xeats meat then?xis carnivore Z6If?xis a mammal ?xhas pointed teeth ?xhas claws ?xhas forward-pointing eyes then?xis carnivore Z7If?xis a mammal ?xhas hoops then?xis an ungulate Z8If?xis a mammal ?xchews cud then?xis an ungulate
Z9If?xis a carnivore ?xhas tawny color ?xhas dark spots then?xis a cheetah Z10If?xis a carnivore ?xhas tawny color ?xhas dark spots then?xis a tiger Z11If?xis an ungulate ?xhas long legs ?xhas long neck ?xhas tawny color ?xhas dark spots then?xis a giraffe
Z12If?xis a ungulate ?xhas white color ?xhas black strips then?xis a zebra Z13If?xis a bird ?xdoes not fly ?xhas long legs ?xhas long neck ?xis black and white then?xis a ostrich Z14If?xis a bird ?xdoes not fly ?xhas swim ?xis black and white then?xis a penguin
Z15If?xis a bird ?xis a good flyer then?xis 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 first Has hair 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 used Has forward-pointing eyes Has claws Has pointed teeth is a carnivore is a cheetah is a mammal Has hair Eats meat Has tawny color Has dark sports FIGURE: 3
ANIMAL BirdFish Canary Has Wings Can fly Has feathers Has Skin Can Move Around Eats Breathes Can Sing Is Yellow Has Long Thin Legs Is 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 INST SUBC INST Fig. 5 Semantic Network with Property Relations
PENGUIN VICTOR INST 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 BIRD PENGUIN VICTOR MAMMAL DOG POODLE TERRIER CHARLEY SUBC INSTANCE SUBC INST Fig. 4 A larger Semantic Network From fig. 2
ANIMAL MAMMALBIRD PENGUINDOG VICTORPOODLE CHARLEY RUN CAN BARK TERRIER FRIENDLY BLACK HOSTILE CAN FLY SUBC INST SUBC PROP LIKES FIG.6 COMPLEX Semantic Network with properties
DOG POODLE LABRADOR RETRIEVER SUSIE CHARLEY BLACK SUBC INST PROP Fig. 7 What can we do with this network ?
NAME SLOT – 1Filler SLOT – 2Filler SLOT – 3Filler............ SLOT - NFiller 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 SLOT CHARLEY INST 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 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 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 OO O R R
8. ACT P I John John INGEST O do O 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. 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 D field 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 ⇚ > < Size > x Size = x plants The plants grow
⇛ 11. (a)(b) ⇛ ⇚ > < Bill PEOPLE bullet > < Bob gun Bob ⇛ ⇚ > < health (-10) Bill shot Bob OR 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 I O D Home I MTRANS O Frog 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 <
PPWoods 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 OR < Ears CP
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
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 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)