semantic nets

39
 All rights reserved © L. Manevitz Lecture 7 1 Artificial Intelligence Representing Commonsense Knowledge L. Manevitz

Upload: anil-reddy

Post on 19-Jul-2015

131 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 1/39

All rights reserved © L. Manevitz Lecture 7 1

Artificial IntelligenceRepresenting Commonsense

Knowledge

L. Manevitz

Page 2: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 2/39

All rights reserved © L. Manevitz Lecture 7 2

Definitions

•  Representation  – a set of syntactic and semantic

conventions that make it possible to describe

things.

• Syntax  – specifies the symbols that may be used

and the ways those symbols may be arranged.

• Semantics  – specifies how meaning is embodied

in the symbol arrangements allowed by thesyntax.

Page 3: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 3/39

All rights reserved © L. Manevitz Lecture 7 3

Semantic Network Approach

• Nodes and Slots:

Nodes are objects,

or classes,or properties.

Slots are of different types.

Page 4: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 4/39

All rights reserved © L. Manevitz Lecture 7 4

A Semantic Network 

Mammal

Person Nose

Pee-Wee-ReeseBlue Brooklyn-Dodgers

Is-a

has-part

instanceteam

uniform-

color

Page 5: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 5/39

All rights reserved © L. Manevitz Lecture 7 5

Representing Nonbinary

Predicates• Unary Predicates can be rewritten as

binary ones.

man( Marcus)

could be rewritten as

instance(Marcus,Man)

Page 6: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 6/39

All rights reserved © L. Manevitz Lecture 7 6

Representing Nonbinary

Predicates cont.• N-Place Predicates

score(Cubs,Dodgers,5-3)

becomes Game

G23 5-3

 Dodgers

Cubs 

Is-a

score

home-team

visiting-

team

Page 7: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 7/39

All rights reserved © L. Manevitz Lecture 7 7

A Semantic Net Representing

a Sentence

“John gave the book to Mary.” 

Give

EV7 BK23

Mary

Johnobject

beneficiary

agent

instance

Book 

instance

Page 8: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 8/39

All rights reserved © L. Manevitz Lecture 7 8

Some Important Distinctions

First try:

Second try:

John 72height

John

H1

height

Bill

H2

height

greater-than

Page 9: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 9/39

All rights reserved © L. Manevitz Lecture 7 9

Some Important Distinctions

cont.

Third try:

72

value

John

H1

height

Bill

H2

height

greater-than

Page 10: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 10/39

All rights reserved © L. Manevitz Lecture 7 10

Partitioned Semantic Nets

Bite

b m

Dogs

d

Is-a

victimassailant

Mail-carrier

Is-aIs-a

a) The dog bit the mail carrier.

Page 11: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 11/39

All rights reserved © L. Manevitz Lecture 7 11

Partitioned Semantic Nets cont.

b) Every dog has bitten a mail carrier.

Bite

b m

Dogs

d

Is-a

victimassailant

Mail-carrier

Is-aIs-a

g

GS

Is-aform

SA

S1

Page 12: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 12/39

All rights reserved © L. Manevitz Lecture 7 12

Partitioned Semantic Nets cont.

c) Every dog in town has bitten the

constable.

Bite

b c

Town-Dogs

d

Is-avictimassailant

Constables

Is-aIs-a

g

GS

Is-aform

DogsSA

S1

Page 13: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 13/39

All rights reserved © L. Manevitz Lecture 7 13

Partitioned Semantic Nets cont.

d) Every dog has bitten every mail carrier.

Bite

b md

Is-a

victimassailant

Mail-carrier

Is-aIs-a

gGSIs-a

form

DogsSA

S1

Page 14: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 14/39

All rights reserved © L. Manevitz Lecture 7 14

Inheritance

• Is-a slot  – appears between objects and

classes.

• ako slot  – appears between subsets.

Page 15: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 15/39

All rights reserved © L. Manevitz Lecture 7 15

Inheritance -Procedure

F the given node; S the given slot;

1. Form a Queue of F and all class nodes connected to Fvia Is-A node. F is at top of Queue.

2. Until Queue is empty or default has been found

determine if the first element of Queue has a value inits S slot:

a. Yes – a value has been found.

b. No – remove the first element from Queue and add the nodesrelated to the first element by AKO slots to the end of Queue.

3. If a value has been found say that this is the defaultvalue of F‟s S slot. 

Otherwise announce Failure.

Page 16: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 16/39

All rights reserved © L. Manevitz Lecture 7 16

Inheritance - Example

Is-a

shape

ako

Block 

Brick 

Brick12

rectangular

Is-a

ako

Wedge

Wedge18

shapeTriangular

Page 17: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 17/39

All rights reserved © L. Manevitz Lecture 7 17

If-needed Inheritance -Procedure

F the given node; S the given slot;

1. Form a Queue of F and all class nodes connected to Fvia Is-A node. F is at top of Queue.

2. Until Queue is empty or successful if-needed procedure

has been found determine if the first element of Queuehas a procedure in the If-Needed facet of its S slot:

a. Yes – if the procedure produces a value than a value has beenfound.

b. No – remove the first element from Queue and add the nodes

related to the first element by AKO slots to the end of Queue.3. If a value has been found say that the value found is the

value of F‟s S slot. 

Otherwise announce Failure.

Page 18: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 18/39

All rights reserved © L. Manevitz Lecture 7 18

If-needed Inheritance - Example

Weight (if-needed)

Block 

Brick 

Brick12

Block-weight-

procedure

400

11

Volume

Density

Page 19: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 19/39

All rights reserved © L. Manevitz Lecture 7 19

Example cont.

Weight

Block 

Brick 

Brick12 400

11

Volume

Density

4400

Weight is activated

by request for the

weight of Brick12 !

Page 20: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 20/39

All rights reserved © L. Manevitz Lecture 7 20

Default Inheritance Procedure

F the given node; S the given slot;

1. Form a Queue of F and all class nodes connected to Fvia Is-A node. F is at top of Queue.

2. Until Queue is empty or default has been found

determine if the first element of Queue has a value inthe Default facet of its S slot:

a. Yes – if the first element has a value than a value has beenfound.

b. No – remove the first element from Queue and add the nodes

related to the first element by AKO slots to the end of Queue.3. If a value has been found say that the value found is the

default value of F‟s S slot. 

Otherwise announce Failure.

Page 21: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 21/39

All rights reserved © L. Manevitz Lecture 7 21

Default Inheritance - Example

Is-a

Color (Default)

ako

Block 

Brick 

Brick12

Red

Is-a

ako

Wedge

Wedge18

Color (Default)Blue

Has no default

color therefore

probably Blue

because of 

Block‟s default

color !

Page 22: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 22/39

All rights reserved © L. Manevitz Lecture 7 22

Perspective -Example

Is-a

Purpose

Support

Brick Structure

Is-a

Play Commemorate

Toy

shape

rectangular

Gift

perspectiveToy perspectiveStructure

perspectiveBrick12

Purpose

Is-a

Gift

Purpose

Is-a

Page 23: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 23/39

All rights reserved © L. Manevitz Lecture 7 23

Special Links - Summary

• IS-A and AKO links make class

membership and subclass-class relations

explicit, facilitating the movement of knowledge from one level to another.

• VALUE facets make values explicit.

Page 24: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 24/39

All rights reserved © L. Manevitz Lecture 7 24

Special Links – Summary cont.

• IF-NEEDED facets make procedures purposes

explicit, and they relate procedures to the classes

those procedures are relevant to.

• DEFAULT facets make likely values explicit

without implying certainty.

• Perspectives make context sensitivity explicit,

preventing confusion and ambiguity.

Page 25: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 25/39

All rights reserved © L. Manevitz Lecture 7 25

Frames

• Frames : A collection of nodes that

describe a stereotyped object, act or event.

• Example : newspaper report.

Page 26: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 26/39

All rights reserved © L. Manevitz Lecture 7 26

Earthquake ExampleDisaster-event

Earthquake

Flood

Hurricane

EventKilled

Injured

Homeless

Damage

Magnitude

Fault

Crest

River

Wind-speed

Name

Place

Day

Time

Social-event

Birthday-party

Number-of-

guests

Host

Age

Birthday-

person

Page 27: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 27/39

All rights reserved © L. Manevitz Lecture 7 27

Earthquake Example cont.

Earthquake Hits Lower Slabovia

• Today an extremely serious earthquake of 

magnitude 8.5 hit Lower Slabovia killing25 people and causing $500,000,000 in

damage. The president of Lower Slabovia

said the hard-hit area near the Sadie

Hawkins fault has been a danger zone for

years.

Page 28: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 28/39

All rights reserved © L. Manevitz Lecture 7 28

Earthquake Example cont.

Earthquake13

place  Lower Slabovia

Today

25

500,000,000

8.5

day 

fatalities 

damage

magnitude

fault Sadie Hawkins

Page 29: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 29/39

All rights reserved © L. Manevitz Lecture 7 29

Earthquake Summary Pattern

• An earthquake occurred in value in

location slot value in day slot . There were

value in fatalities slot fatalities and value

in damage slot in property damage. The

magnitude was value in magnitude slot on

the Richter scale, and the fault involved

was the value in fault slot .

Page 30: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 30/39

All rights reserved © L. Manevitz Lecture 7 30

Instantiated Earthquake

Summary Pattern

• An earthquake occurred in Lower Slabovia

today . There were 25 fatalities and $500

million in property damage. The magnitude

was 8.5 on the Richter scale, and the fault

involved was the Sadie Hawkins.

Page 31: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 31/39

All rights reserved © L. Manevitz Lecture 7 31

Earthquake Example cont.

Earthquake Study Stopped 

Today, the President of Lower Slabovia killed 25

proposals totaling $500 million for research in

earthquake prediction. Our Lower Slaboviancorrespondent calculates that 8.5 research

proposals are rejected for every one approved.

There are rumors that the President‟s science

advisor, Sadie Hawkins, is at fault.

Page 32: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 32/39

All rights reserved © L. Manevitz Lecture 7 32

Earthquake Example cont.

• The Earthquake Study Stopped story

could be summarized, naively, as though it

were the story about an actual earthquake,

producing the same frame as the

Earthquake Hits Lower Slabovia story

does.

Page 33: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 33/39

All rights reserved © L. Manevitz Lecture 7 33

Scripts

Page 34: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 34/39

All rights reserved © L. Manevitz Lecture 7 34

Scripts

•  Example - Restaurant script.

Script: Restaurant Roles: S=Customer

Track: Coffee Shop W=Waiter

Props: Tables C=Cook 

Menu M=Cashier

F=Food O=Owner

Check 

Money 

Page 35: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 35/39

All rights reserved © L. Manevitz Lecture 7 35

Restaurant Example cont.

Entry conditions : S is hungry

S has money

Results : S has less money

O has more money

S is not hungry

S is pleased (optional)

Page 36: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 36/39

All rights reserved © L. Manevitz Lecture 7 36

Restaurant Example cont.

Scene 1: Entering

S PTRANS S into restaurantS ATTEND eyes to tables

S MBUILD where to sit

S PTRANS S to table

S MOVE S to sitting position

Page 37: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 37/39

All rights reserved © L. Manevitz Lecture 7 37

Restaurant Example cont.

Scene 2: Ordering(menu on table) (W brings menu) (S asks for menu)

S PTRANS menu to S S MTRANS signal to W

S MTRANS „need menu‟ to W W PTRANS W to table

W PTRANS W to menu

W PTRANS W to tableW ATRANS menu to S

S MTRANS W to table*S MBUILD choice of FS MTRANS signal to WW PTRANS W to tableS MTRANS „I want F‟ to W 

W PTRANS W to C

W MTRANS (ATRANS) to C

C DO (prepare F script) to

Scene 3

C MTRANS „no F‟ to W W PTRANS W to SW MTRANS „no F‟ to S

(go back to *) or

(go to Scene 4 at no pay

path)

Page 38: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 38/39

All rights reserved © L. Manevitz Lecture 7 38

Restaurant Example cont.

Scene 3 : Eating

C ATRANS F to W

W ATRANS F to SS INGEST F

(Option : Return to Scene 2 to order more;

otherwise go to Scene 4)

Page 39: Semantic Nets

5/17/2018 Semantic Nets - slidepdf.com

http://slidepdf.com/reader/full/semantic-nets 39/39

All rights reserved © L. Manevitz Lecture 7 39

Restaurant Example cont.

Scene 4 : Exiting

S MTRANS to W

W PTRANS W to S

W MOVE (write check) (W ATRANS check to S)

W ATRANS check to S

S ATRANS tip to W

S PTRANS S to M

S ATRANS money to MS PTRANS S to out of restaurant

(No pay path)