Knowledge Representation An Introduction AyHwa Andy Liou Department

  • Slides: 111
Download presentation
Knowledge Representation - An Introduction Ay-Hwa Andy Liou Department of Information Management Tamkang University

Knowledge Representation - An Introduction Ay-Hwa Andy Liou Department of Information Management Tamkang University 1

Knowledge Every computer contains knowledge about the problem it is solving Most of the

Knowledge Every computer contains knowledge about the problem it is solving Most of the knowledge is not represented explicitly and cannot be readily expanded or manipulated. General knowledge about how knowledge is acquired, represented and used, has to be embodied in flexible systems. 2

Knowledge Representation Problems Expressive adequacy of K. R. scheme Reasoning efficiency Primitives Meta-representation Incompleteness

Knowledge Representation Problems Expressive adequacy of K. R. scheme Reasoning efficiency Primitives Meta-representation Incompleteness Real-world knowledge – beliefs, desires, intentions. . . 3

Knowledge Representation is not simple Ex: Birds can fly If Joe is a bird

Knowledge Representation is not simple Ex: Birds can fly If Joe is a bird and birds can fly, Joe can fly. Some domain of knowledge can be wellbehaved (e. g. mathematical knowledge), others may not. (e. g. name definition) -- bachelor -- elephant 4

Natural kind objects In traditional philosophy, specified by a conjunction of properties Ex: lemon

Natural kind objects In traditional philosophy, specified by a conjunction of properties Ex: lemon Problem: abnormal members. Nouns meant to designate natural kinds do not have their extensions determined by a finite number of concepts. 5

Natural Language John decided to go visit Bill. He drove to his house, but

Natural Language John decided to go visit Bill. He drove to his house, but he saw that all the lights were out so instead he went to the movies. Questions: Did John see Bill? Whose house was dark? Who went to the movies? 6

Understanding Nature Language is hard A large amount of real world knowledge must be

Understanding Nature Language is hard A large amount of real world knowledge must be represented and manipulated A great deal of knowledge about the syntax and vocabulary of the language itself must be understood 7

Properties of K. R. System Representational Adequacy Inferential Efficiency Acquisitional Efficiency 8

Properties of K. R. System Representational Adequacy Inferential Efficiency Acquisitional Efficiency 8

Declarative vs. Procedural Declarative methods: knowledge is represented as a static collection of facts

Declarative vs. Procedural Declarative methods: knowledge is represented as a static collection of facts accompanied by a small set of general procedures for manipulating them – Each fact need only be stored once – Easy to add new facts to the system 9

Procedural methods: in which the bulk of the knowledge is represented as procedures for

Procedural methods: in which the bulk of the knowledge is represented as procedures for using it. – It is easy to represent knowledge of how to do things – It is easy to represent knowledge that does not fit well into many simple declarative schemes (e. g. default and probabilistic reasoning) – It is easy to represent heuristic knowledge of how to do things efficiently In most domains there is a need for both kinds of information 10

Knowledge Structure Data structure in which knowledge about particular problem domains can be stored.

Knowledge Structure Data structure in which knowledge about particular problem domains can be stored. Provide a way to represent information about commonly occurring patterns of things. . such descriptions are called schemas 11

Schema Def. : An active organization of past reactions, or of past experiences, which

Schema Def. : An active organization of past reactions, or of past experiences, which must always be supposed to be operating in any well-adapted organic response. Types of schemas useful in A. I. programs – – Frames Scripts Stereotypes Rule models 12

Frames, often used to describe a collection of attributes that a given object normally

Frames, often used to describe a collection of attributes that a given object normally possesses. Scripts, used to describe common sequences of events. Stereotypes, describe clusters of characteristics often found together in people. Rule models, describe common features shared among a set of rules in a production system. 13

Common Issues Any basic properties of objects occur in every problem domain? ISA, ISPART

Common Issues Any basic properties of objects occur in every problem domain? ISA, ISPART Isa Animal Isa Pet Isa Livestock Isa Dog Isa Shepherd Isa Living thing Plant Isa Tree Bush Isa Cat Oak Isa Poodle 14

Ispart Head Ispart Ears Nose Body Ispart Eyes Ispart Dog Ispart Mouth Ispart Appendages

Ispart Head Ispart Ears Nose Body Ispart Eyes Ispart Dog Ispart Mouth Ispart Appendages Ispart Legs Tail Ispart Paws • One of the most important properties of ISA and ISPART is transitivity if POODLE ISA DOG ISA PET then POODLE ISA PET 15

Common Issues -- cont. Choosing the Level of Representation Ex: John spotted Sue rep

Common Issues -- cont. Choosing the Level of Representation Ex: John spotted Sue rep 1: spotted(agent(John), (object(Sue)) rep 2: saw(agent(John), (object(Sue), (time-span(briefly)) Adv. : rules only in primitive form Disadv: 1. need to convert high-level fact to low 2. low-level primitives require a lot of storage 3. some domain is not clear what the primitives should be 16

Choosing the Primitives An obvious primitives: mother, father, daughter, son, brother and sister. •

Choosing the Primitives An obvious primitives: mother, father, daughter, son, brother and sister. • Mary=daughter(brother(mother(Sue))) Describe: cousin • Mary=daughter(sister(mother(Sue))) • Mary=daughter(brother(father(Sue))) • Mary=daughter(sister(father(Sue))) Solve by changing the primitives to: parent, child, sibling, male and female Mary = child(sibling(parent(Sue))) Even in very simple domains, the correct set of primitives is not obvious 17

Common Issues -- cont. Locating the right structures as needed. Ex: Restaurant script John

Common Issues -- cont. Locating the right structures as needed. Ex: Restaurant script John went to Steak and Ale last night. He ordered a large rare steak, paid his bill, and left. Ask: Did John eat dinner last night? Answer: Yes. (by using restaurant script) How will a system select appropriate script among many others. 18

Script Selection Index the structures directly by the content words. . . inadequate when

Script Selection Index the structures directly by the content words. . . inadequate when a word has many meanings. Each content word as a pointer to all of the structures (scripts) may be involved steak --> restaurant, supermarket bill ---> restaruant, shopping ---->> restaurant Empty intersection? Computation required! Refine the major clue when other clues appear. 19

Problems to solve for accessing the right structure [Minsky, 1975] – How to perform

Problems to solve for accessing the right structure [Minsky, 1975] – How to perform an initial selection of the most appropriate structure – How to fill in appropriate details from the current situation – How to find a better structure if the one chosen initially turns out not to be appropriate – What to do if none of the available structures is appropriate – When to create and remember a new structure 20

Overview of Basic Approaches Logic Semantic Networks Conceptual Graphs Frames Rule Based Systems Temporal

Overview of Basic Approaches Logic Semantic Networks Conceptual Graphs Frames Rule Based Systems Temporal Reasoning 21

Logic Ex: British Nationality Act rule 1. -(1). A person born in the U.

Logic Ex: British Nationality Act rule 1. -(1). A person born in the U. K. after commencement shall be a British citizen if a the time of birth his father or mother is (a) a British citizen; or (b) settled in the United Kingdom Represented: (x is a British citizen) if (x was born in the U. K. ) and (x was born on date y) and (y is after or on commencement) and (z is a parent of x) and (z is a British citizen on date y) 22

Semantic Networks Attempt to describe the concepts behind word meanings and the ways in

Semantic Networks Attempt to describe the concepts behind word meanings and the ways in which such meanings interact. Nodes rep. concepts or meanings and the links rep. relations Most often used link: ISA 23

May relate to predicate calculus by replacing terms by nodes and relations by labelled

May relate to predicate calculus by replacing terms by nodes and relations by labelled directed arcs. ISA(chair, furniture) Cover(my-chair, leather) Furniture Isa Person Isa Me Chair Owner Isa My-chair Cover leather Ispart Color Seat Tan Isa Brown 24

l In Lisp Atom CHAIR MY-CHAIR ME TAN SEAT l Property List ((ISA FURNITURE))

l In Lisp Atom CHAIR MY-CHAIR ME TAN SEAT l Property List ((ISA FURNITURE)) ((ISA CHAIR) (COLOR TAN) (COVER LEATHER) (OWNER ME)) ((ISA PERSON)) ((ISA BROWN)) ((ISPART CHAIR)) Game N place predicate: score(red blue (17 3)) Blue Visiting team Isa G 23 Score 17 -3 Home-team Red 25

Represent declarative sentence: John gave the book to Mary. Give John Agent Isa EV

Represent declarative sentence: John gave the book to Mary. Give John Agent Isa EV 7 Object BK 23 Beneficiary Mary Isa Book A an stud dl y im of its the of or kn igi ow n, led nat ge ure , me Recent systems have chosen their link and node types on the basis of epistemelogical concerns about how the knowledge will be used. tho d 26

Reasoning the Net Intersection search: find relationships among objects by spreading activation out from

Reasoning the Net Intersection search: find relationships among objects by spreading activation out from each of two nodes and seeing where the activation met. "What is the connection between John and Mary" Direct search procedures to answer specific question. Effective only when the meaning of the nodes are consistent 27

Concept and Instance Links from the concept node should usually be used to describe

Concept and Instance Links from the concept node should usually be used to describe properties of all (or most) instances of the concept, while links from an instance node describe properties of the individual instance. Ex: My chair is tan Chair Tan Mary's chair is green. 28

link INSTANCE-OF connect instance nodes to the concepts that describe them Furniture Isa Chair

link INSTANCE-OF connect instance nodes to the concepts that describe them Furniture Isa Chair Instance-of My Chair Color Black 29

Defining link and relating link Define new entity John Height 72 John Andy Height

Defining link and relating link Define new entity John Height 72 John Andy Height H 1 Greater-than Value 72 Height H 2 Describe relationships among existing entities 30

Major problem: quantification The dog bit the postman Dogs Bite Isa d Postman Isa

Major problem: quantification The dog bit the postman Dogs Bite Isa d Postman Isa b Assailant Victim p Every dog has bitten a postman g is an instance of the special class GS of general statements GS Isa Dogs Isa Form g Bite d Postman Isa b Assailant Victim S 1 p 31

General Statements Every element of GS has at least two attributes: – FORM: states

General Statements Every element of GS has at least two attributes: – FORM: states the relation that is being asserted – : one for each of the universally quantified variables A Other variables in the GS are existentially quantified 32

Every dog in town has bitten the constable Dogs Isa Town Dogs GS Isa

Every dog in town has bitten the constable Dogs Isa Town Dogs GS Isa Form g Isa d Bite Isa Constable S 1 b Assailant Victim Isa p Every dog has bitten every postman <Practice> 33

Every dog in town has bitten the constable Dogs Isa Town Dogs GS Isa

Every dog in town has bitten the constable Dogs Isa Town Dogs GS Isa Form Bite Isa g d Constable Isa S 1 b Assailant Victim Isa p Every dog has bitten every postman Dogs Bite Isa d Postman Isa b Assailant Victim p Form GS g 34

Conceptual Dependency --- Schank, 1973 -5 Represent the meaning of natural language sentences in

Conceptual Dependency --- Schank, 1973 -5 Represent the meaning of natural language sentences in a way that – Facilitates drawing inferences form the sentences – Is independent of the language in which the sentences were originally stated Use conceptual primitives to form the meanings of words. 35

Semantic net vs. CD Semantic net provide only a structure into which nodes rep.

Semantic net vs. CD Semantic net provide only a structure into which nodes rep. information at any level can be placed. Conceptual dependency provides both a structure and a specific set of primitives out of which representations of particular pieces of information can be constructed. 36

I gave the man a book p I ATRANS o book to R from

I gave the man a book p I ATRANS o book to R from man I • Arrows indicate direction of dependency • Double arrow indicates two way link between actor and action • p indicates past tense • ATRANS is one of the primitive acts used by theor It indicates transfer of possession • o indicates the object case relation • R indicates the recipient case relation 37

Primitive actions ATRANS Transfer of an abstract relations (e. g. give) PTRANS Transfer of

Primitive actions ATRANS Transfer of an abstract relations (e. g. give) PTRANS Transfer of the physical location of an object (e. g. go) PROPEL Application of physical force to an object (e. g. push) MOVE Movement of a body part by its owner (e. g. kick) GRASP Grasping of an object by an actor (e. g. throw) INGEST Ingesting of an object by an animal (e. g. eat) EXPEL Expulsion of something from the body of an animal (cry) MTRANS Transfer of mental information (tell) MBUILD Building new information out of old (decide) SPEAK Producing of sounds (say) ATTEND Focusing of a sense organ toward a stimulus (listen) 38

Primitive conceptual categories Building the dependency structures ACT's PP's AA's PA's Actions Objects (picture

Primitive conceptual categories Building the dependency structures ACT's PP's AA's PA's Actions Objects (picture producer) Modifiers of actions (action aiders) Modifiers of PP's (picture aiders) 39

Dependencies of CD Rule 1: relationship between an actor and the event he or

Dependencies of CD Rule 1: relationship between an actor and the event he or she causes. This is a two-way dependency, since neither actor nor event can be considered primary. The letter p above the dependency link indicates past tense. Rule 2: Many state descriptions are represented as numeric scales. Rule 3: one of which belongs to the set defined by the other. Rule 4: between a PP and its predicted attribute Rule 5: two PP, one provides a particular kind of information about the other. Three common types of info. provided this way: – possession (POSS-BY) – location (LOC) 40 – physical containment (CONT)

Rule 6: PP is the object of the ACT Rule 7: Source PP and

Rule 6: PP is the object of the ACT Rule 7: Source PP and recipient PP by ACT Rule 8: ACT and the instrument with which it is performed. The instrument must always be a full conceptualization contain an ACT, not just a single physical object. Rule 9: ACT and its physical source and destination Rule 10: PP and a state in which it sttarted another in which it ended. Rule 11: one conceptualization and another that causes it. Rule 12: a conceptualization and the time at which the event it describes occurred. Rule 13: one conceptualization and another that is the time of the first. Rule 14: a conceptualization and the place at which it occurred 41

Conceptual tenses p f t ts tf Past Future Transition Start transition Finished transition

Conceptual tenses p f t ts tf Past Future Transition Start transition Finished transition k ? / nil delta c Continuing Interrogative Neagtive Present Timeless Conditional 42

o one INGEST smoke R one cigarette I c tfp INGEST o smoke R

o one INGEST smoke R one cigarette I c tfp INGEST o smoke R I cigarette dead one p alive Since smoking can kill you, I stopped. 43

Reasoning the knowledge Fewer inference rules are needed Rules need only be represented once

Reasoning the knowledge Fewer inference rules are needed Rules need only be represented once for each primitive ACT rather than once for every word that describes that ACT. For example: transfer of ownership – Give, Take, Steal, Donate Toward all of them, the info. about who now has the object and who once had the object can be stated once and associated with the primitive ACT ATRANS 44

Many inferences are already contained in the representation itself Bill threatened John with a

Many inferences are already contained in the representation itself Bill threatened John with a broken nose. John Bill POSS-BY p Bill MTRANS I John nose do 1 broken John o do 2 believe Bill o John cf POSS-BY do 1 nose Bill broken John 45

unspecified elements of the representation of one piece of information can be used as

unspecified elements of the representation of one piece of information can be used as a focus for the understanding of later events as they are encountered 46

Disadv. of CD Knowledge need to be decomposed into low-level primitives Can't rep. other

Disadv. of CD Knowledge need to be decomposed into low-level primitives Can't rep. other things besides events, such as social actions. 47

Frames Ways of grouping information in terms of a record of "slots" and "fillers".

Frames Ways of grouping information in terms of a record of "slots" and "fillers". Useful when used to represent knowledge of certain stereotypical concepts or events. Human is more concerned with the salient properties associated with objects that are typical of their class, such as CHAIR or ROOM. 48

Frames are usefule for simulating commonsense knowledge, which is a very difficult area for

Frames are usefule for simulating commonsense knowledge, which is a very difficult area for computers to master. Semantic nets are basically two-dimensional representations of knowledge; frames add a third dimension by allowing nodes to have structure. 49

Frames The basic characteristic of a frame is that it represents related knowledge about

Frames The basic characteristic of a frame is that it represents related knowledge about a narrow subject that has much default knowledge. 50

Consists of slots that describe aspects of the objects. They are filled by other

Consists of slots that describe aspects of the objects. They are filled by other frames describing other objects. Each slot may also be filled with a default value. Procedural information may also be associated with particular slots (procedural attachment) Related frames can be grouped together to form a frame system 51

A Car frame Slots Fillers Manufacturer General Motor Model Chevrolet Caprice Year 1989 Transmission

A Car frame Slots Fillers Manufacturer General Motor Model Chevrolet Caprice Year 1989 Transmission Automatic Engine Gasoline Tires 4 Color Blue 52

Using Frames The utility of frames lies in hierarchical frame systems and inheritance. By

Using Frames The utility of frames lies in hierarchical frame systems and inheritance. By using frames in the filler slots and inheritance, very powerful knowledge representation systems can be built. 53

If the faces contained complex patterns, those patterns would be represented by more involved

If the faces contained complex patterns, those patterns would be represented by more involved structures, possibly another set of frames. Frame slots may hold rules, graphics, comments, debugging information, questions for users, hypotheses concerning a situation, or other frames. 54

Generic knowledge Frames can represent either generic o 9 r specific knowledge. A generic

Generic knowledge Frames can represent either generic o 9 r specific knowledge. A generic frame for Property: Slots Name Specialization_of Types Owner Location Status Under_warranty Fillers Property A_kind_of object (car, boat, house) If-added: Procedure ADD_PROPRITY Default: government If-needed: Procedure FIND_OWNER (home, work, mobile) (missing, poor, good) (yes, no) 55

Procedural Attachment If-needed types: procedures to be executed when a filler value is needed

Procedural Attachment If-needed types: procedures to be executed when a filler value is needed but none is initially present or the default value is not suitable. 56

Defaults are of primary importance in frames because they model some aspects of the

Defaults are of primary importance in frames because they model some aspects of the brain. Defaults correspond to the expectations of a situation that we build up based on experience. When we encounter a new situation, the closest frame is modified to help us adjust to the situation. Defaults are often used to represent commonsense knowledge. We use commonsense when no more situation specific knowledge is available. 57

Procedural Attachment (cont. ) If-added type: run for procedures to be executed when a

Procedural Attachment (cont. ) If-added type: run for procedures to be executed when a value is to be added to a slot. Example: the types slot. The ADD_PRORERTY procedure would be run for jewelry, TV, stereo, and so forth since the types slot does not contain these values. 58

Procedural Attachment (cont. ) If-removal type: run whenever a value is to be removed

Procedural Attachment (cont. ) If-removal type: run whenever a value is to be removed from a slot. 59

Relations a-kind-of and is-a relations can be used to show frames are hierarchically related.

Relations a-kind-of and is-a relations can be used to show frames are hierarchically related. Slots Name Specialization_of Types manufacturer Location Wheels Location Transmission Engine Fillers Car a_kind_of property (sedan, sports, convertible) (GM, Ford, Toyota) Mobile 4 (home, work, mobile) (manual, automatic) (gasoline, diesel Car Frame – A Generic Subframe of Property 60

Relations a-kind-of and is-a relations can be used to show frames are hierarchically related.

Relations a-kind-of and is-a relations can be used to show frames are hierarchically related. Slots Name Specialization_of Owner manufacturer Location Wheels Under_warranty Transmission Engine Fillers John’s Car Is_a property John Don GM Mobile 4 yes automatic gasoline A Instance of a Car Frame – a specific frame (not a generic frame) 61

Generic vs. Specific Frame systems are designed so more generic frames are at the

Generic vs. Specific Frame systems are designed so more generic frames are at the top of the hierarchy. It is assumed that frames can be customized for specific cases by modifying the default cases and creating more specific frames. The top of the frame hierarchy specifies things that are more true of all and the lower levels reflect the fuzzy boundaries between realworld objects. 62

Classified by Application Situational frame contain knowledge about what to expect in a given

Classified by Application Situational frame contain knowledge about what to expect in a given situation. Ex: birthday party. Action frame contains slots that specify the actions to be performed in a given situation. The combination of situational and action frames can be used to describe cause-andeffect relationships in the form of causal knowledge frames. 63

Reasoning with the Knowledge Frames make it easy to infer to as yet unobserved

Reasoning with the Knowledge Frames make it easy to infer to as yet unobserved facts about new situations. – Frames contain info. about many aspects of the objects or situations that they describe. (access to ROOM frame could infer the existence of at least one door in a room) – Frames contain attributes that must be true of objects that will be used to fill individual slots – Frames describe typical instances of the concepts they represent. 64

Partial evidence used to make an initial selection of a candidate frame. The frame

Partial evidence used to make an initial selection of a candidate frame. The frame will be instantiated. Values from the current situation satisfy the required restrictions are put into the appropriate slots of the instantiated frame. If no appropriate values can be found, then a new frame must be selected. The way the first attempt failed may provide useful cues as to what frame to try next. 65

Things can be done when failed: Select the fragments of the current frame that

Things can be done when failed: Select the fragments of the current frame that do correspond to the situation and match them against candidate frames. Make an excuse for the current frames's failure and continue to use it. Refer to specific stored links between frames to suggest new directions in which to explore. Travers upward the hierarchical structure in which frames can be arranged. 66

Difficulties with Frames were originally conceived as a paradigm for representing stereotyped knowledge. Have

Difficulties with Frames were originally conceived as a paradigm for representing stereotyped knowledge. Have well-defined features Mathematical concepts so that many of its slots have default values. However, major problems is that allow unrestrained alteration or cancellation of slots. 67

Scripts A structure that describes a stereotyped sequence of events in a particular context.

Scripts A structure that describes a stereotyped sequence of events in a particular context. A script consists of a set of slots containing info. about what kinds of values it may contain. . . similar to frame in this level. Scripts are useful because, in the real world, there are patterns to the occurrence of events. 68

Components of a Script Entry conditions. Must be satisfied before the events described in

Components of a Script Entry conditions. Must be satisfied before the events described in the script can occur. Result. Conditions that will be true after the event. Props. Represent objects that are involved in the events. Roles. Represent people who are involved. Track. The specific variation on a more general pattern that is represented by this particular script. Scenes. The actual sequences of events that occur. The events are represented in conceptual dependency formalism. 69

Events in a script form a giant causal chain. The beginning of the chain

Events in a script form a giant causal chain. The beginning of the chain is the set of entry conditions, the end is the set of results, which may enable later events. Within the chain, events are connected both to earlier events that make them possible and to later events that they enable. 70

Activating a script – For fleeting scripts that mentioned briefly, it is sufficient merely

Activating a script – For fleeting scripts that mentioned briefly, it is sufficient merely to store a pointer to the script so that it can be accessed later if necessary Susan passed her favorite restaurant on her way to the museum. She really enjoyed the new Picasso exhibit. – For nonfleeting scripts, activate fully by fill in the slots with particular objects and people involved. 71

Useful in: – predicting the occurrence of events that were not explicitly mentioned. John

Useful in: – predicting the occurrence of events that were not explicitly mentioned. John went out to a restaurant last night. He ordered steak. When he paid for it, he noticed that he was running out of money. He hurried home since it had started to rain. – indicating how events that were mentioned relate to each other and build a single coherent interpretation. John went out to lunch. He sat down at a table and called the waitress. The waitress brought him a menu and he ordered a hamburger. Ask: Why did the waitress bring John a menu? 72

– Focuses attention on unusual events. John went to a restaurant. He was shown

– Focuses attention on unusual events. John went to a restaurant. He was shown to his table. He ordered a large steak. He sat there and waited for a long time. He got mad and left. Although scripts are less general structures than are frames, and so are not suitable for representing all kinds of knowledge, they can be very effective for representing the specific kinds of knowledge for which they were designed. 73

Rule Based Systems The satisfaction of the rule antecedents gives rise to the execution

Rule Based Systems The satisfaction of the rule antecedents gives rise to the execution of the consequents - some action is performed. Successfully used to model human problem-solving activity and adaptive behavior. 74

Knowledge Represented Knowledge represented in AI systems: Objects Facts about objects in our world

Knowledge Represented Knowledge represented in AI systems: Objects Facts about objects in our world domain. e. g. Radios has buttons, books contain information. Events Actions that occur in the world. e. g. Michael Jordan helped his team to win last night. Performance A behavior like Driving a car involves knowledge about how to do things. Meta-knowledge about what we know. e. g. Maze mouse who find the way out. It knows that it can make turns and remember the turns it has made. 75

Dealing with two entities when representing knowledge: Facts truths about the real world and

Dealing with two entities when representing knowledge: Facts truths about the real world and what needs to be represented. This can be regarded as the knowledge level. Representation of the facts which we manipulate. This can be regarded as the symbol level since we usually define the representation in terms of symbols that can be manipulated by programs. 76

We can structure these entities at two levels Knowledge level at which facts are

We can structure these entities at two levels Knowledge level at which facts are described Symbol level at which representations of objects are defined in terms of symbols that can be manipulated in programs 77

English or natural language is an obvious way of representing and handling facts. Logic

English or natural language is an obvious way of representing and handling facts. Logic enables us to consider the following fact: spot is a dog as dog(spot) We could then infer that all dogs have tails with: x dog(x) hasatail(x) We can then deduce: hasatail(spot) Using an appropriate backward mapping function the English sentence Spot has a tail can be generated. 78

The available functions are not always one to one but rather are many to

The available functions are not always one to one but rather are many to many which is a characteristic of English representations. The sentences All dogs have tails and Every dog has a tail both say that each dog has a tail but the first could say that each dog has more than one tail. 79

Using Knowledge Learning acquiring knowledge. This is more than simply adding new facts to

Using Knowledge Learning acquiring knowledge. This is more than simply adding new facts to a knowledge base. New data may have to be classified prior to storage for easy retrieval, etc. . Interaction and inference with existing facts to avoid redundancy and replication in the knowledge so that facts can be updated. Retrieval The representation scheme used can have a critical effect on the efficiency of the method. Humans are very good at it. Many AI methods have tried to model human. Reasoning Infer facts from existing data. 80

If a system knows: – Miles Davis is a Jazz Musician. – All Jazz

If a system knows: – Miles Davis is a Jazz Musician. – All Jazz Musicians can play their instruments well. If things like Is Miles Davis a Jazz Musician? or Can Jazz Musicians play their instruments well? are asked then the answer is readily obtained from the data structures and procedures. However a question like Can Miles Davis play his instrument well? requires reasoning. 81

Properties for Knowledge Representation Systems Following properties should be possessed by a knowledge representation

Properties for Knowledge Representation Systems Following properties should be possessed by a knowledge representation system. Representational Adequacy the ability to represent the required knowledge; Inferential Adequacy the ability to manipulate the knowledge represented to produce new knowledge corresponding to that inferred from the original; Inferential Efficiency the ability to direct the inferential mechanisms into the most productive directions by storing appropriate guides; Acquisitional Efficiency the ability to acquire new knowledge using automatic methods wherever possible rather than reliance on human intervention. To date no single system optimizes all of the above 82

Approaches to Knowledge Representation Simple relational knowledge Inheritable knowledge 83

Approaches to Knowledge Representation Simple relational knowledge Inheritable knowledge 83

Simple relational knowledge The simplest way of storing facts is to use a relational

Simple relational knowledge The simplest way of storing facts is to use a relational method where each fact about a set of objects is set out systematically in columns. This representation gives little opportunity for inference, but it can be used as the knowledge basis for inference engines. We can ask things like: Who is dead? Who plays Jazz/Trumpet? This sort of representation is popular in database systems. 84

Inheritable knowledge Relational knowledge is made up of objects consisting of – attributes –

Inheritable knowledge Relational knowledge is made up of objects consisting of – attributes – corresponding associated values. We extend the base more by allowing inference mechanisms: – Property inheritance elements inherit values from being members of a class. data must be organized into a hierarchy of classes – – Boxed nodes -- objects and values of attributes of objects. Values can be objects with attributes and so on. Arrows -- point from object to its value. 85 This structure is known as a slot and filler structure, semantic

The algorithm to retrieve a value for an attribute of an instance object: 1.

The algorithm to retrieve a value for an attribute of an instance object: 1. Find the object in the knowledge base 2. If there is a value for the attribute report it 3. Otherwise look for a value of instance if none fail 4. Otherwise go to that node and find a value for the attribute and then report it 5. Otherwise search through using isa until a value is found for the attribute. 86

Inferential Knowledge Represent knowledge as formal logic: All dogs have tails : dog(x) hasatail(x)

Inferential Knowledge Represent knowledge as formal logic: All dogs have tails : dog(x) hasatail(x) Advantages: – A set of strict rules Can be used to derive more facts. Truths of new statements can be verified. Guaranteed correctness. – Many inference procedures available to in implement standard rules of logic. – Popular in AI systems. e. g Automated theorem proving. 87

Procedural Knowledge Basic idea: Knowledge encoded in some procedures – small programs that know

Procedural Knowledge Basic idea: Knowledge encoded in some procedures – small programs that know how to do specific things, how to proceed. – e. g a parser in a natural language understander has the knowledge that a noun phrase may contain articles, adjectives and nouns. It is represented by calls to routines that know how to process articles, adjectives and nouns. 88

Procedural Knowledge (Cont. ) Advantages: – Heuristic or domain specific knowledge can be represented.

Procedural Knowledge (Cont. ) Advantages: – Heuristic or domain specific knowledge can be represented. – Extended logical inferences, such as default reasoning facilitated. – Side effects of actions may be modeled. Some rules may become false in time. Keeping track of this in large systems may be tricky. Disadvantages: – Completeness -- not all cases may be represented. – Consistency -- not all deductions may be correct. e. g If we know that Fred is a bird we might deduce that Fred can fly. Later we might discover that Fred is an emu. – Modularity is sacrificed. Changes in knowledge base might have far-reaching effects. – Cumbersome control information. 89

Issues in Knowledge Representation Issues raised when using a knowledge representation technique: Important Attributes

Issues in Knowledge Representation Issues raised when using a knowledge representation technique: Important Attributes -- Are there any attributes that occur in many different types of problem? There are two attributes instance and isa and each is important because each supports property inheritance. Relationships -- What about the relationship between the attributes of an object, such as, inverses, existence, techniques for reasoning about values and single valued attributes. We can consider an example of an inverse in band(John Zorn, Naked City) This can be treated as John Zorn plays in the band Naked City or John Zorn's band is Naked City. Another representation is band = Naked City band-members = John Zorn, Bill Frissell, Fred Frith, Joey Barron, 90

Granularity -- At what level should the knowledge be represented and what are the

Granularity -- At what level should the knowledge be represented and what are the primitives. Choosing the Granularity of Representation Primitives are fundamental concepts such as holding, seeing, playing and as English is a very rich language with over half a million words it is clear we will find difficulty in deciding upon which words to choose as our primitives in a series of situations. If Tom feeds a dog then it could become: feeds(tom, dog) If Tom gives the dog a bone like: gives(tom, dog, bone) Are these the same? In any sense does giving an object food constitute feeding? If give(x, food) feed(x) then we are making progress. 91

Semantic Nets The major idea is that: The meaning of a concept comes from

Semantic Nets The major idea is that: The meaning of a concept comes from its relationship to other concepts, and that, The information is stored by interconnecting nodes with labeled arcs. 92

Representation in a Semantic Net The physical attributes of a person can be represented

Representation in a Semantic Net The physical attributes of a person can be represented as These values can also be represented in logic as: isa(person, mammal), instance(Mike-Hall, person), team(Mike-Hall, Cardiff) 93

Representation in a Semantic Net We have already seen how conventional predicates such as

Representation in a Semantic Net We have already seen how conventional predicates such as lecturer(dave) can be written as instance (dave, lecturer) Recall that isa and instance represent inheritance and are popular in many knowledge representation schemes. But we have a problem: How we can have more than 2 place predicates in semantic nets? E. g. score(Cardiff, Llanelli, 23 -6) Solution: – Create new nodes to represent new objects either contained or alluded to in the knowledge, game and fixture in the current example. – Relate information to nodes and fill up slots: 94 A Semantic Network for n-Place Predicate

As a more complex example consider the sentence: John gave Mary the book. Here

As a more complex example consider the sentence: John gave Mary the book. Here we have several aspects of an event. 95

Inference in a Semantic Net Basic inference mechanism: follow links between nodes. Two methods

Inference in a Semantic Net Basic inference mechanism: follow links between nodes. Two methods to do this: – Intersection search the notion that spreading activation out of two nodes and finding their intersection finds relationships among objects. This is achieved by assigning a special tag to each visited node. – Inheritance the isa and instance representation provide a mechanism to implement this. 96

Inheritance also provides a means of dealing with default reasoning. E. g. we could

Inheritance also provides a means of dealing with default reasoning. E. g. we could represent: – Emus are birds. – Typically birds fly and have wings. – Emus run. in the following Semantic net: 97

In making certain inferences we will also need to distinguish between the link that

In making certain inferences we will also need to distinguish between the link that defines a new entity and holds its value and the other kind of link that relates two existing entities. Consider the example shown where the height of two people is depicted and we also wish to compare them. 98

We need extra nodes for the concept as well as its value. Special procedures

We need extra nodes for the concept as well as its value. Special procedures are needed to process these nodes, but without this distinction the analysis would be very limited. 99

Extending Semantic Nets Here we will consider some extensions to Semantic nets that overcome

Extending Semantic Nets Here we will consider some extensions to Semantic nets that overcome a few problems or extend their expression of knowledge. Partitioned Networks Partitioned Semantic Networks allow for: – propositions to be made without commitment to truth. – expressions to be quantified. Basic idea: Break network into spaces which consist of groups of nodes and arcs and regard each space as a node. 100

Consider the following: Andrew believes that the earth is flat. We can encode the

Consider the following: Andrew believes that the earth is flat. We can encode the proposition the earth is flat in a space and within it have nodes and arcs the represent the fact. We can the have nodes and arcs to link this space the rest of the network to represent Andrew's belief. 101

Now consider the quantified expression: Every parent loves their child To represent this we:

Now consider the quantified expression: Every parent loves their child To represent this we: Create a general statement, GS, special class. Make node g an instance of GS. Every element will have at least 2 attributes: – a form that states which relation is being asserted. – one or more forall ( ) or exists ( ) connections -these represent universally quantifiable variables in such statements e. g. x, y in x parent(x) y child(y) loves(x, y) Here we have to construct two spaces one for each x, y. 102

Also If we change the sentence to Every parent loves child then the node

Also If we change the sentence to Every parent loves child then the node of the object being acted on (the child) lies outside the form of the general statement. Thus it is not viewed as an existentially qualified variable whose value may depend on the agent. So we could construct a partitioned network as in 103

Frames can also be regarded as an extension to Semantic nets. Indeed it is

Frames can also be regarded as an extension to Semantic nets. Indeed it is not clear where the distinction between a semantic net and a frame ends. Semantic nets initially we used to represent labeled connections between objects. As tasks became more complex the representation needs to be more structured. The more structured the system it becomes more beneficial to use frames. A frame is a collection of attributes or slots and associated values that describe some real world entity. Frames on their own are not particularly helpful but frame systems are a powerful way of encoding information to support reasoning. Set theory provides a good basis for understanding frame systems. Each frame represents: – a class (set), or – an instance (an element of a class). 104

Consider the example first discussed in Semantics Nets: Person isa: Mammal Cardinality: … Adult-Male

Consider the example first discussed in Semantics Nets: Person isa: Mammal Cardinality: … Adult-Male isa: Person Cardinality: … Rugby-Player isa: Adult-Male Cardinality: Height: Weight: Position: Team-Colours: Back isa: Rugby-Player Cardinality: Tries: Mike-Hall instance: Back Height: 6 -0 Position: Centre Team: Cardiff-RFC Team-Colours: Black/Blue Rugby-Team isa: Team Cardinality: Team-size: 15 Coach: Cardiff_RFC Instance: Rugby_Team-size: 15 Coach: Terry Holems Players: {Robert-Holey, Gwyn-Jones, …} 105

Here the frames Person, Adult-Male, Rugby-Player and Rugby-Team are all classes and the frames

Here the frames Person, Adult-Male, Rugby-Player and Rugby-Team are all classes and the frames Robert-Howley and Cardiff-RFC are instances. Note – The isa relation is in fact the subset relation. – The instance relation is in fact element of. – The isa attribute possesses a transitivity property. This implies: Robert-Howley is a Back and a Back is a Rugby. Player who in turn is an Adult-Male and also a Person. – Both isa and instance have inverses which are called subclasses or all instances. – There attributes that are associated with the class or set such as cardinality and on the other hand there attributes that are possessed by each member of the class or set. 106

Distinction between Sets and Instances Cardiff-RFC can be thought of as a set of

Distinction between Sets and Instances Cardiff-RFC can be thought of as a set of players or as an instance of a Rugby-Team. If Cardiff-RFC were a class then – its instances would be players – it could not be a subclass of Rugby-Team otherwise its elements would be members of Rugby-Team which we do not want. Instead we make it a subclass of Rugby-Player and this allows the players to inherit the correct properties enabling us to let the Cardiff-RFC to inherit information about teams. This means that Cardiff-RFC is an instance of Rugby. Team. 107

Problem A class is a set and its elements have properties. We wish to

Problem A class is a set and its elements have properties. We wish to use inheritance to bestow values on its members. But there are properties that the set or class itself has such as the manager of a team. This is why we need to view Cardiff-RFC as a subset of one class players and an instance of teams. Solution: Meta. Classes 108

Metaclass A metaclass is a special class whose elements are themselves classes. Now consider

Metaclass A metaclass is a special class whose elements are themselves classes. Now consider our rugby teams as: Class Team instance: isa: Cardinality: Team-Size: Rugby-Team isa: Cardinality: Team-size: Coach: Cardiff-RFC instance: Rugby-Team-size: 15 Coach: Terry Holmes Robert-Howley Class instance: Back Class Height: 6 -0 {The number of teams} Position: Scrum Half 15 Team: Cardiff-RFC Team-Colours: Black/Blue Team Class … {The nunber of teams} 15 109

The basic metaclass is Class, and this allows us to – define classes which

The basic metaclass is Class, and this allows us to – define classes which are instances of other classes, and (thus) – inherit properties from this class. Inheritance of default values occurs when one element or class is an instance of a class. 110

Interpreting frames A frame system interpreter must be capable of the following in order

Interpreting frames A frame system interpreter must be capable of the following in order to exploit the frame slot representation: Consistency checking -- when a slot value is added to the frame relying on the domain attribute and that the value is legal using range and range constraints. Propagation of definition values along isa and instance links. Inheritance of default. values along isa and instance links. Computation of value of slot as needed. Checking that only correct number of values computed. 111