1 knowledge representation - an introduction ay-hwa andy liou department of information management...

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

Upload: garey-sullivan

Post on 12-Jan-2016

227 views

Category:

Documents


0 download

TRANSCRIPT

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

1

Knowledge Representation- An Introduction

Ay-Hwa Andy Liou

Department of Information Management

Tamkang University

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

2

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.

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

3

Knowledge Representation Problems

Expressive adequacy of K.R. scheme

Reasoning efficiency

Primitives

Meta-representation

Incompleteness

Real-world knowledge– beliefs, desires, intentions...

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

4

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 well-behaved (e.g. mathematical knowledge), others may not. (e.g. name definition)

-- bachelor-- elephant

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

5

Natural kind objects

In traditional philosophy, specified by a conjunction of propertiesEx: lemon

Problem: abnormal members.Nouns meant to designate natural

kinds do not have their extensions determined by a finite number of concepts.

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

6

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?

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

7

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

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

8

Properties of K.R. System

Representational Adequacy

Inferential Adequacy

Inferential Efficiency

Acquisitional Efficiency

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

9

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

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

10

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

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

11

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

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

12

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

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

13

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.

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

14

Common Issues

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

Living thing

Animal Plant

BushTree

PoodleShepherd

CatDog

LivestockPet

Oak

Isa Isa

Isa Isa

IsaIsa

Isa Isa

Isa

Isa

Isa

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

15

Dog

AppendagesBodyHead

PawsLegsMouthEyesNoseEars

Tail

• One of the most important properties of ISA and ISPART is transitivity

if POODLE ISA DOG DOG ISA PET

then POODLE ISA PET

Ispart Ispart

Ispart Ispart

Ispart

Ispart IspartIspart

IspartIspart

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

16

Common Issues -- cont.Choosing the Level of RepresentationEx: John spotted Sue

rep1: spotted(agent(John),(object(Sue))

rep2: saw(agent(John),(object(Sue),(time-span(briefly))

Adv.: rules only in primitive formDisadv:

1. need to convert high-level fact to low2. low-level primitives require a lot of storage3. some domain is not clear what the primitives should be

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

17

Choosing the PrimitivesAn obvious primitives: mother, father, daughter, son, brother and sister.

Describe: cousin

Solve by changing the primitives to: parent, child, sibling, male and female

Even in very simple domains, the correct set of primitives is not obvious

• Mary=daughter(brother(mother(Sue)))• Mary=daughter(sister(mother(Sue)))• Mary=daughter(brother(father(Sue)))• Mary=daughter(sister(father(Sue)))

Mary = child(sibling(parent(Sue)))

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

18

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.

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

19

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, supermarketbill ---> restaruant, shopping-------->> restaurant

Refine the major clue when other clues appear.

Empty intersection?Computation required!

Empty intersection?Computation required!

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

20

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 curre

nt 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

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

21

Overview of Basic Approaches

Logic

Semantic Networks

Conceptual Graphs

Frames

Rule Based Systems

Temporal Reasoning

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

22

Logic

Ex: British Nationality Actrule 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)

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

23

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

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

24

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

Furniture

Chair

My-chairMy-chair

leather

Seat

Tan

Brown

Me

Person

Isa

IsaIsa

Isa

Color

Cover

Owner

Ispart

ISA(chair,furniture)Cover(my-chair, leather)

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

25

Atom Property List

CHAIR ((ISA FURNITURE))MY-CHAIR ((ISA CHAIR)

(COLOR TAN) (COVER LEATHER) (OWNER ME))

ME ((ISA PERSON))TAN ((ISA BROWN))SEAT ((ISPART CHAIR))

In Lisp

N place predicate:score(red blue (17 3))

G23

Red

17-3Blue

Game

Score

IsaVisitingteam

Home-team

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

26

Represent declarative sentence:John gave the book to Mary.

Recent systems have chosen their link and node types on the basis of epistemelogical concerns about how the knowledge will be used.

Give

John

Book

BK23EV7

Mary

IsaAgent Object

Beneficiary Isa

A study of the origin, nature, method

and limits of knowledge

A study of the origin, nature, method

and limits of knowledge

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

27

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

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

28

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

Mary's chair is green.

Chair Tan

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

29

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

Furniture

Black

Chair

My Chair

Isa

Color

Instance-of

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

30

Defining link and relating link

John 72Height

AndyJohn

H1 H2

Height Height

Greater-than

72

Value

Define new entity

Describe relationshipsamong existing entities

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

31

Major problem: quantificationThe dog bit the postman

Every dog has bitten a postman

Dogs Bite Postman

d b p

Isa Isa Isa

Assailant Victim

Dogs Bite Postman

d b p

Isa Isa Isa

Assailant Victim

S1

g

GS

FormIsa

g is an instance of thespecial class GS of general statements

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

32

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

Other variables in the GS are existentially quantified

A

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

33

Every dog in town has bitten the constable

Every dog has bitten every postman <Practice>

Town Dogs Bite Constable

d b p

Isa Isa Isa

Assailant Victim

S1

g

GS

FormIsa

Dogs

Isa

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

34

Every dog in town has bitten the constable

Every dog has bitten every postman

Town Dogs Bite Constable

d b p

Isa Isa Isa

Assailant Victim

S1

g

GS

FormIsa

Dogs

Isa

Dogs Bite Postman

d b p

Isa Isa Isa

Assailant Victim

gGS

Form

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

35

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.

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

36

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.

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

37

I gave the man a book

Ip

ATRANSo

bookR

to

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 the theory. It indicates transfer of possession• o indicates the object case relation• R indicates the recipient case relation

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

38

Primitive actionsATRANS 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)

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

39

Primitive conceptual categories

Building the dependency structures

ACT's Actions

PP's Objects (picture producer)

AA's Modifiers of actions (action aiders)

PA's Modifiers of PP's (picture aiders)

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

40

Dependencies of CDRule 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 attributeRule 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)– physical containment (CONT)

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

41

Rule 6: PP is the object of the ACTRule 7: Source PP and recipient PP by ACTRule 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 destinationRule 10: PP and a state in which it sttarted and 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

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

42

Conceptual tenses

p Past f Future t Transition

ts Start transition

tf Finished transition

p Past f Future t Transition

ts Start transition

tf Finished transition

k Continuing

? Interrogative

/ Neagtive

nil Present

delta Timeless

c Conditional

k Continuing

? Interrogative

/ Neagtive

nil Present

delta Timeless

c Conditional

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

43

Since smoking can kill you, I stopped.

one INGEST smokeRo one

cigarette

c

I

tfp

INGESTo

smoke I

one

p

dead

alive

R

cigarette

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

44

Reasoning the knowledge

Fewer inference rules are neededRules 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

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

45

Many inferences are already contained in the representation itself

Bill threatened John with a broken nose.John Bill

pBill MTRANS

o

Bill

do1

nose

broken

POSS-BYJohn

I

John believe

do2

John

cfdo1

Bill

onose

broken

POSS-BYJohn

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

46

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

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

47

Disadv. of CD

Knowledge need to be decomposed into low-level primitives

Can't rep. other things besides events, such as social actions.

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

48

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.

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

49

Frames

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.

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

50

Frames

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

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

51

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

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

52

A Car frame

Slots Fillers

Manufacturer General Motor

Model Chevrolet Caprice

Year 1989

Transmission Automatic

Engine Gasoline

Tires 4

Color Blue

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

53

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.

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

54

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.

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

55

Generic knowledgeFrames can represent either generic o9r specific knowledge.

A generic frame for Property:Slots Fillers

Name Property

Specialization_of A_kind_of object

Types (car, boat, house)

If-added: Procedure ADD_PROPRITY

Owner Default: government

If-needed: Procedure FIND_OWNER

Location (home, work, mobile)

Status (missing, poor, good)

Under_warranty (yes, no)

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

56

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.

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

57

DefaultsDefaults 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.

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

58

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.

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

59

Procedural Attachment (cont.)

If-removal type: run whenever a value is to be removed from a slot.

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

60

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

Slots Fillers

Name Car

Specialization_of a_kind_of property

Types (sedan, sports, convertible)

manufacturer (GM, Ford, Toyota)

Location Mobile

Wheels 4

Location (home, work, mobile)

Transmission (manual, automatic)

Engine (gasoline, diesel

Car Frame – A Generic Subframe of Property

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

61

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

Slots Fillers

Name John’s Car

Specialization_of Is_a property

Owner John Don

manufacturer GM

Location Mobile

Wheels 4

Under_warranty yes

Transmission automatic

Engine gasoline

A Instance of a Car Frame – a specific frame (not a generic frame)

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

62

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 real-world objects.

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

63

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-and-effect relationships in the form of causal knowledge frames.

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

64

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.

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

65

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.

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

66

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.

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

67

Difficulties with Frames

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

Mathematical concepts

However, major problems is that allow unrestrained alteration or cancellation of slots.

Have well-defined features so that many of its slots

have default values.

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

68

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.

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

69

Components of a ScriptEntry 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.

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

70

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.

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

71

Activating a script– For fleeting scripts that mentioned briefly, i

t 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.

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

72

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?

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

73

– 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.

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

74

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.

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

75

Knowledge RepresentedKnowledge 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 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.

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

76

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.

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

77

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

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

78

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.

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

79

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.

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

80

Using KnowledgeLearning 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. RetrievalThe 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.

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

81

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.

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

82

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

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

83

Approaches to Knowledge Representation

Simple relational knowledge

Inheritable knowledge

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

84

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.

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

85

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. – This structure is known as a slot and filler structure, semantic network or a

collection of frames.

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

86

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.

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

87

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.

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

88

Procedural Knowledge

Basic idea:

Knowledge encoded in some procedures – small programs that know how to do specific thing

s, 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.

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

89

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.

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

90

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,

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

91

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.

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

92

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.

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

93

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)

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

94

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:

A Semantic Network for n-Place Predicate

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

95

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

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

96

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.

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

97

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:

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

98

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.

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

99

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.

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

100

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.

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

101

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 the rest of the network to represent Andrew's belief.

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

102

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 repr

esent 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.

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

103

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

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

104

FramesFrames 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).

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

105

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: 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_RFCInstance: Rugby_TeamTeam-size: 15Coach: Terry HolemsPlayers: {Robert-Holey, Gwyn-Jones, …}

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

106

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 are attributes that are associated with the class or set such as cardinality and on the other hand there are attributes that are possessed by each member of the class or set.

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

107

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.

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

108

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: MetaClasses

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

109

MetaclassA metaclass is a special class whose elements are themselves classes.

Now consider our rugby teams as: Class

instance: Classisa: ClassCardinality: …

Teaminstance: Classisa: ClassCardinality: {The number of teams}Team-Size: 15

Rugby-Teamisa: TeamCardinality: {The nunber of teams}Team-size: 15Coach:

Cardiff-RFCinstance: Rugby-TeamTeam-size: 15Coach: Terry Holmes

Robert-Howleyinstance: BackHeight: 6-0Position: Scrum HalfTeam: Cardiff-RFCTeam-Colours: Black/Blue

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

110

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.

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

111

Interpreting framesA 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.