Top Banner
Knowledge Representation and Objects
47

Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Dec 22, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Knowledge Representation and Objects

Page 2: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Representing objects

• In the procedural approach objects tend to be entangled in the algorithm in question and difficult to extract for use in other circumstances.

• The advantages of re-use are many and this served as a motivation for the development of an object oriented approach to both to programming and also to knowledge representation.

Page 3: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Objects

• Objects are at the heart of the Object Oriented Paradigm

• What is an object?

Page 4: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Objects

• We are surrounded by objects.

• In this class room there are desks, blackboards, lights , chairs and so on.

• Each object has specific attributes

• The desk is made of wood. The seat has a blue cover and so on.

Page 5: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Objects have associations and relationships with each other .

• Objects have associations and relationships with each other .

• Seats have desktops attached.

• All are attached to the floor

• Seats are adjacent to other seats.

• They are oriented in the same way.

• Lights are controlled by switches

Page 6: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Object Roles and Functions

• Each Object in the room has a specific role or function or behaviour.

• Seats are to be sat on.

• Board is to be written on.

• Lights can be turned on and off

• Boards can be moved up and down and seats can be put up and down.

Page 7: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Objects can be classified

• Within the room objects can be grouped into different classes

• For example we could have the furniture objects e.g. chairs, tables, worktop

• We could also have the electrical objects.

• Lights, projector, laptop and so on.

Page 8: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

The nature of Objects

• Clearly Objects constitute a complex multi faceted concept.

• Their definition is dependent on many elements- their attributes , their behaviour, their classification and as we will see much , much more

• To investigate the nature of objects , it is helpful to consider an important knowledge representation scheme which is the basis for theoretical frameworks of the object oriented paradigm

• This framework is known as semantic networks

Page 9: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Semantic Nets

• Semantic networks are a popular scheme which elegantly reflect these ideas.

• A network consists of nodes repesenting objects, concepts and events and links between the nodes representing their interrelations.

Page 10: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Example

• Using the example Birds have wings

• a typical semantic net would be

Page 11: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Origin

• The development of semantic networks had its origins in psychology. Ross Quillian in 1968 designed two semantic network based systems that were intended primariliy as psychological models of associateive memory.

• Semantic Networks quickly found application in AI. B. Raphaels SIR system, also 1968, was one of the first programs to use this type of representation scheme.

• SIR was a question Answering system and could answer questions requiring a variety of simple reasoning tasks and relationships

Page 12: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Meaning of Semantic Nets

• The semantics of net structures however depends solely on the program that manipulates them and there are no fixed conventions about their meaning.

• A wide variety of network based systems have been implemented that use totally different procedures for making inferences.

Page 13: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Another Example

Dog bone

likes

Page 14: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Evolving Features

• While there are no fixed conventions, a number of important features of Semantic nets have emerged , that are widely used.

• These have largely emerged because of the application of Semantic Nets to Object Oriented Theory.

Page 15: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Object Definitions

• The central aspect of the object paradigm is how it defines objects.

• The basic mechanism of representation is the articulation of class hierarchies.

• Instances of Objects exist. In turn Objects belong to classes and these in turn can belong to other classes

Page 16: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Example

• Consider Fido ( who is a dog)

• Fido is instance of the object “dog”.

• Dogs belong to the class pets, which for example could also include other classes such as cats.

• Pets in turn belong to a class animals and so on

Page 17: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Fido

Dogs

Pets

Animals

Cats

Page 18: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Labels used in Semantic Nets

• Objects and Instances

• Both Represented by Nodes linked by an

• IS_A link

Fido DogIS_A

InstanceObject

Page 19: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Labels used in Semantic Nets

• Objects and Classes

• Both Represented by Nodes linked by an

• Subset or a SuperSet link

Dog PetsSubset

ObjectClass

Page 20: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

SuperSet links

• Objects and Classes

• Both Represented by Nodes linked by an

• SuperSet link

Dog PetsSubset

ObjectClassSuperset

Page 21: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Relationships, attributes and associations

Relationships, attributes and associations

Represented by a labelled link between objects etc

FidoBlack and

white

colour

Page 22: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Component Parts

• Object components

• Both Represented by Nodes linked by an

• HAP (has as part) link

• A dog has a tail

Dog TailHAP

ObjectObject

Page 23: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Inheritance

• Attributes of classes are inherited by subclasses and instances of objects

• Because we know dogs have tails and Fido is a dog we know Fido has a tail since this is inherited from the parent class

Page 24: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Inheritance

• A dog has a tail and Fido is a dog

Dog TailHAP

ObjectObject

Fido

ISA

Page 25: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Bigger Example

• Exercise

• What does the following Semantic net represent

Page 26: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

My House

Bungalow

House

Building

Roof

1

brick

wallsRed

Habitation

No. Of Storeys

Purpose

Colour HAP HAP

subset

subset

ISAMade_of

Page 27: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Advantages of Semantic Nets

• Easy to visualize – Graphical in nature – easy for humans to interpret

• Expressive power equal to or exceeding that of First Order Predicate Logic

• Formal definitions of semantic networks have been developed for use

• Related knowledge is easily clustered – logically and physically close

• Efficient in space requirements– Objects represented only once– Relationships handled by pointers

• Other schemes are limited to True or False answers where as Semantic Nets are more informative and flexible

• Not limited to only binary representation… can also represent action concepts

Page 28: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Disadvantages of Semantic Nets

• Inheritance (particularly from multiple sources and when exceptions in inheritance are wanted) can cause problems such as conflicts

• Facts placed inappropriately cause problems

• No standards about node and arc values – in spite of the generic formal definitions

Page 29: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Frames

The representation of knowledge about objects and events typical to specific situations has been the focus of research into a concept called frames.

Frames were originally proposed in 1975 by Minsky, as a basis for understanding visual perception, natural language dialogues and other complex behaviours.

Page 30: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

How does a frame work?

• Attached to each frame are several different kinds of knowledge.

• Some knowledge is how to use the frame, some is about the different elements of the frame, some is about what to expect in given situations and some is what to do if the specified conditions do not materialise.

• Frames contain a representation mechanism called a slot.

• Knowledge which is relevant to part of a given situation can be entered into a slot. thus the composite pieces of knowledge that go to make up the larger entity can be represented as slots within the larger structure of a frame.

Page 31: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

What are slots again?

• A frame is a composite data structure which consists of a number of slots which correspond to various aspects of the object being represented. For example slots in the frame could contain information such as

Page 32: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Frame elements

• 1: frame identification information.

• 2: relationship of this frame to other frames.

• 3: descriptors of requirements for frame match. for example the chair frame might specify a flat base on four vertical supports with a back support at 90 degrees to the base.

Page 33: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

More Frame elements

• 4: procedural information on the use of the structure called demons.

• 5: frame default information: for example as default a chair has four legs.

• 6: new instance information. Many frame slots are left unspecified until a particular instance of the structure is identified. For example the colour of the chair might not be filled in until a particular instance is identified.

Page 34: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Inheritance

• Frames support inheritance:• Class types are represented by frames which omit the

detail of objects of the class, for example the frame representing a three legged chair object could inherit the slots of a class frame representing an abstract chair and augment these with its own particular detail to describe the new object.

• 8: The big problem with frames is controlling their invocation particularly when a number of them are applicable to a situation. e.g.

• The man broke a leg when he fell onto the chair. Would the man frame or the chair frame take precedence.

Page 35: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

In Summary

• Frames then are data structures for representing composite entities.

• The top levels of a frame are fixed and represent things that are always true about a supposed situation. The top levels therefore give a high level abstract view of the situation. Only the details are missing.

• The lower levels have many slots that must be filled by specific instances or data. That is the details of the specific situation can be added at these levels.

Page 36: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Adding new knowledge

• The slot mechanism is a modular concept. New knowledge pertaining to a frame can be added simply by creating new slots.

• Conversely redundant knowledge may be deleted by removing slots from a frame.

Page 37: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Static versus variable slots

• The idea of having fixed higher and variable lower levels is entirely suitable for representing different versions of the one context.

• This is so because different instances of the same context differ only in detail.

• For example any room has walls, a ceiling and a floor but one instance of a room differs from another in what it contains and how these contents are arranged i.e. in the specific details of that room.

Page 38: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Demons

• Procedures called demons can be attached to slots of a frame.

• Thus algorithmic knowledge (or Behaviour) can be incorporated into a frame based system.

• One interesting function of these demons is to activate other appropriate frames.

Page 39: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Frames and stereotyped situations

• Many everyday situations are stereotyped or conform to a familiar pattern. waking or opening a door are examples of stereotyped situations.

• Most of the events associated with these situations are expected. The slots of a frame are therefore filled with default values to mirror these expected events.

• However if we are trying to represent new or uncertain situations then default values tend not to work very well. More sophisticated inference is generally needed.

• The notion of using stereotypes would reflect thinking among psychologists that we use previous experiences to deal with situations that we have never met before.

Page 40: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Problems

• There are three major problems involved in the use of frames.

• 1: When should a frame be activated i.e. when does it become relevant.

• 2: When should a frame be de-activated i.e. when does it become irrelevant.

• 3: What happens if a situation arises in which no frames are relevant.

Page 41: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Applications of Frames

• When Minsky first published his ideas on frames, it started a flurry of research into its use.

• A side development but one that is very similar is the development of Object Oriented Orogramming Paradigms a huge area in its own right.

• Modern AI research is considering the notion of flavors i.e. a frame based structure which introduces concepts by presenting a stereotypical flavor of it.

• One major applications Minsky proposed for frame based structures is the idea of scripts.

Page 42: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Scripts

• A script is a structured representation describing a stereotyped sequence of events in a particular context. The script was originally deigned by Schank and Ableson 1977.

• A typical script is the restaraunt script. • The customer recognizes the restaraunt by a sign on the

door. They are met at the door and directed to an appropriate table by the waiter.

• They are brought menus. They order the meal which is brought by the waiter. They eat the meal, pay and leave.

• This is fairly typical scenario and comfortably describes

the average trip to restaurant.

Page 43: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Script Representation

• To represent scenarios like this a script has a number of components.

• 1: Entry Conditions or descriptors of the world thaty must be true for the script to be called. In a restaraunt script these might be for example a restaurant that is open and a customer who is hungry.

• 2: Results or facts that are true when the script has terminated, for example the customer is full and the money has been paid.

• 3: Props or the things that make up the content of the script including cast for example menu, money, tables, waiters, customers and so on.

Page 44: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

More

• 4: Roles are the actions that the individual participants perform, for example the waiter shows the customer to their seat, brings the menu and food and accepts the money at the end.

• 5: Scenes: These provide a temporal partitioning of the script for example in the restaurant the scenes and their order might be: entering, ordering, eating, paying , leaving.

Page 45: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Applications of scripts

• Scripts can be used to answer questions about particular situations. For example it would be easy to answer questions like Who brought the food, With what did the customer pay etc.

• They can be used to resolve referential ambiguities because each prop has a specific role.

Page 46: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

• Of the disadvantages of scripts the biggest problem is when two or more scripts are applicable to a given situation.

• Consider for example the text• "John visited his favourite restaurant on

the way to the concert. He was pleased by the bill because he liked Mozart"

• In this case which should take precedence a concert script or a restaurant script.

Page 47: Knowledge Representation and Objects. Representing objects In the procedural approach objects tend to be entangled in the algorithm in question and difficult.

Ambiguity in Natural Language

• Exact meaning can still present problems because of the idiosyncratic ambiguities in English.

• For example the following text will present problems.

• "John was eating dinner at his favourite restaraunt when a large piece of plaster fell from the ceiling and landed on his date"

• Was the date on his plate or was he gazing into her eyes.