comp219: artificial intelligencefransoliehoek.net/.../comp219_17_semanticnets.pdf · semantic...

48
1 COMP219: Arficial Intelligence Lecture 17: Semanc Networks

Upload: others

Post on 14-Mar-2020

13 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

1

COMP219:Artificial Intelligence

Lecture 17: Semantic Networks

Page 2: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Overview• Last time– Rules as a KR scheme; forward vs backward chaining

• Today– Another approach to knowledge representation

• Structured objects: semantic nets– Notation– Extended example

• Learning outcomes covered today:

Distinguish the characteristics, and advantages and disadvantages, of the major knowledge representation paradigms that have been used in AI, such as production rules, semantic networks, propositional logic and first-order logic;

Solve simple knowledge-based problems using the AI representations studied;

2

Page 3: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Structured Objects

• Structured objects are– Knowledge representation formalisms whose

components are essentially similar to the nodes and arcs found in graphs

– In contrast to production rules and formal logic

3

Page 4: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Semantic Networks

• Charles S Peirce 1909 – existential graphs• Quillian in 1968 – semantic memory

– as a model for human memory; reasonable view of how semantic information is stored by humans

– associative reasoning (via links)• Semantic net is a labelled graph– nodes in graph represent objects, concepts, or

situations/events– arcs in graph represent relationships between these

things4

Page 5: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Semantic Networks

concepts

individuals

5

Relationships Concepts

Individuals

Page 6: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Important Arc Types

• Subset– X is a kind of Y– Penguin subset Bird: Concept to Concept

• Member– X is a Y: X is an instance of Y– Opus member Penguin: Individual to Concept

• R-relation– X relation-name Y– Opus is a friend of Bill; Lou is a parent of Ian Individual

to Individual

6

Page 7: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Inheritance• Inheritance is one of the main

kinds of reasoning done in semantic nets

• The subset relation is often used to link a class and its superclass

• Some links (e.g. legs) are inherited along subset paths

• Many variants of semantic nets

– semantics can be relatively informal or very formal

– “What's in a Link: Foundations for Semantic Networks” (Woods, 1975)

7

Page 8: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Example

8

Page 9: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Example

Bill has four legs9

Page 10: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Example

Bill has four legs10

Page 11: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Example

Bill has four legs11

Page 12: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Example

Bill has four legs12

Page 13: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Example

Bill has four legs13

Page 14: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Example

Bill has four legs Opus is a Bird14

Page 15: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Example

Bill has four legs Opus is a Bird15

Page 16: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Example

Bill has four legs Opus is a Bird16

Page 17: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Example

Bill has four legs Opus is a Bird17

Page 18: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Example

Bill has four legs Opus is a Bird Opus walks18

Page 19: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Multiple Inheritance

• A node can have any number of superclasses that contain it, enabling a node to inherit properties from multiple parent nodes and their ancestors in the network. It can cause conflicting inheritance

Nixon Diamond:

19

Page 20: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Problems with Semantic Nets

• Binary relations are easy to represent• Others are harder• Example: “Opus brings tequila to the party”

20

Party Brings Opus

Tequila

where who

what

Page 21: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Exercise

21

• Suppose we have the information “Bill brings whiskey to the party”.

• How could we extend the semantic network to include this information?

• Can you see any problems with the reasoning in the example once we introduce this information?

Page 22: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Binary Relations

• Any relation can be rewritten as a set of binary relations

• Bringing-1(Opus,tequilla,party)• Bringing-2(Bill,whiskey,party)• Make the event a thing and make one binary

relation per role– who(bringing-1,Opus); who(bringing-2,Bill)– what(bringing-1,tequila); what(bringing-2,whiskey)– where(bringing-1,party); where(bringing-2,party)

22

Page 23: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Binary Relations

• Any relation can be rewritten as a set of binary relations

• Bringing-1(Opus,tequilla,party)• Bringing-2(Bill,whiskey,party)• Make the event a thing and make one binary

relation per role– who(bringing-1,Opus); who(bringing-2,Bill)– what(bringing-1,tequila); what(bringing-2,whiskey)– where(bringing-1,party); where(bringing-2,party)

23

Turn relation into a thing:● 'thingification' (McCarthy)● more common:

● reification● from Latin (res)

Page 24: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Now we can see who brought what

Bringing 1

Party

Bringing 2

tequila

Opus

whiskey

Bill

where

where

who

who

what

what

24

Page 25: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Other Problems are Harder

• Negation– Opus and Dirk are not friends

• Can just assume an absence of a link• Cancellation/Exception– Property inherited from a distant superclass cancelled at a

lower level• Birds fly, penguins don’t

• Disjunction– Opus either drinks tea or coffee

• Quantification– “every dog has bitten a postman”– “every dog has bitten every postman”

25

Page 26: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Advantages of Semantic Nets

• Easy to visualise• Flexible: relationships can be arbitrarily defined

by the knowledge engineer• Formal definitions of semantic networks have

been developed• Related knowledge is easily clustered• Efficient in space requirements• Objects represented only once• Inference reduced to search

26

Page 27: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Disadvantages of Semantic Nets

• Inheritance (particularly from multiple sources and when exceptions in inheritance are required) can cause problems

• No standards about node and arc types, and semantics might not be quite clear (what does “IS-A” mea?n)

• Limited expressiveness: may require a number of specially coded procedures ('procedural attachment')

• The above problems make it difficult to– verify and validate the systems– share knowledge– reuse knowledge– acquire knowledge methodically

27

Page 28: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

The Story of Othello

• Othello was a general who was married to Desdemona

• Iago was a captain who was married to Emilia; he hated Othello

• Iago told Othello lies about Desdemona• Othello killed Desdemona with a pillow. He

felt remorse and killed himself with a dagger

28

wikipedia

Page 29: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Othello was a general who was married to Desdemona

Othello

general

Desdemona

rank

Married to

29

Page 30: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Iago was a captain who was married to Emilia; he hated Othello

Othello

general

Desdemona

rank

Married to

Emilia

captain

IagoMarried to

rank

hated

30

Page 31: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Iago told Othello lies about Desdemona

Othello

general

Desdemona

rank

Married to

Emilia

captain

IagoMarried to

rank

hatedLying-1

liar

deceivedabout

31

Page 32: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Othello

general

Desdemona

rank

Married to

Emilia

captain

IagoMarried to

rank

hatedLying-1

liar

deceivedabout

Killing-1

Pillow

jealousykiller killed

weapon

motiveKilling-2

remorsedagger

killer

killed

weaponmotive

Othello killed Desdemona with a pillow. He felt remorse and killed himself with a dagger 32

Page 33: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Prolog – Organised by Relations

marriedTo(Husband,Wife).marriedTo(X,Y):-marriedTo(Y,X).rank(Soldier,Rank).male(Person).alive(Person).killing(Killer,Killed,Weapon,Motive).motiveForKilling(Person,Motive):- killing(Person,_,_,Motive).

And so on…

33

Page 34: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Manipulating the Knowledge

• So far we have represented the knowledge in a variety of ways

• We also need to manipulate the knowledge• This can be done in a variety of ways

34

Page 35: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Othello

general

Desdemona

rank

Married to

Emilia

captain

IagoMarried to

rank

hatedLying-1

liar

deceivedabout

Killing-1

Pillow

jealousykiller killed

weapon

motiveKilling-2

remorsedagger

killer

killed

weaponmotive

What do the pillow and the dagger have in common?

SpreadingActivation

35

Page 36: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Othello

general

Desdemona

rank

Married to

Emilia

captain

IagoMarried to

rank

hatedLying-1

liar

deceivedabout

Killing-1

Pillow

jealousykiller killed

weapon

motiveKilling-2

remorsedagger

killer

killed

weaponmotive

What do the pillow and the dagger have in common?

1

1SpreadingActivation

36

Page 37: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Othello

general

Desdemona

rank

Married to

Emilia

captain

IagoMarried to

rank

hatedLying-1

liar

deceivedabout

Killing-1

Pillow

jealousykiller killed

weapon

motiveKilling-2

remorsedagger

killer

killed

weaponmotive

What do the pillow and the dagger have in common?

1

1

2

SpreadingActivation

37

Page 38: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Othello

general

Desdemona

rank

Married to

Emilia

captain

IagoMarried to

rank

hatedLying-1

liar

deceivedabout

Killing-1

Pillow

jealousykiller killed

weapon

motiveKilling-2

remorsedagger

killer

killed

weaponmotive

What do the pillow and the dagger have in common?

1

1

22

SpreadingActivation

38

Page 39: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Othello

general

Desdemona

rank

Married to

Emilia

captain

IagoMarried to

rank

hatedLying-1

liar

deceivedabout

Killing-1

Pillow

jealousykiller killed

weapon

motiveKilling-2

remorsedagger

killer

killed

weaponmotive

What do the pillow and the dagger have in common?

1

1

22

3

3SpreadingActivation

39

Page 40: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Othello

general

Desdemona

rank

Married to

Emilia

captain

IagoMarried to

rank

hatedLying-1

liar

deceivedabout

Killing-1

Pillow

jealousykiller killed

weapon

motiveKilling-2

remorsedagger

killer

killed

weaponmotive

What do the pillow and the dagger have in common?

1

1

22

3

33

3SpreadingActivation

3

40

Page 41: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Othello

general

Desdemona

rank

Married to

Emilia

captain

IagoMarried to

rank

hatedLying-1

liar

deceivedabout

Killing-1

Pillow

jealousykiller killed

weapon

motiveKilling-2

remorsedagger

killer

killed

weaponmotive

What do the pillow and the dagger have in common?

1

1

22

3

33

3

Weapons used by Othello in killings

SpreadingActivation

3

41

Page 42: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Using RulesIF (?X is-a killing) AND (?X killed ?Y) THEN

REMOVE (?Y alive T) AND ADD (?Y alive F).

IF create(killing, ?X, ?Y) THEN execute(?X.weapon) AND execute(?X.motive) AND put(?Y.alive,F).

• Or we can use clauses for Prologalive(X,false):-killing(_,X,_,_).

42

Page 43: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Frames

• Development of semantic nets• Desire to exploit the powerful mechanism of

inheritance• Observation: things of a given type participate

in the same set of relationships• A lot of information is available by default – it

is the exceptions that are interesting

43

Page 44: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Frames• Frames - semantic net with

properties and methods– Devised by Marvin Minsky, 1974.

• Incorporates certain valuable human thinking characteristics:– Expectations, assumptions,

stereotypes, exceptions.

• The essence of this form of knowledge is that we represent the typical case and exceptions, rather than give definitions.

• Hierarchical structure, similar to class hierarchies.

44

Page 45: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Problems with Frames & Semantic Nets

• Useful for representing certain sorts of knowledge – e.g., inheritance

• But node and edge types can be ad hoc. – no clear meaning, or semantics.

• Inheritance reasoning is very easy, but more general reasoning is difficult to define

– often special purpose.

45

Page 46: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Developments

• Many of the ideas of frames are now expressed in ontologies (see next lecture)

• Frame system + procedures for retrieving and manipulating knowledge = Object System

• AI research influenced the development of Object Oriented Programming, which has become a standard paradigm– good example of how AI contributes to

mainstream computing

46

Page 47: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Agents

• Agents can be seen as a development from OO programming:– Agents don’t wait for messages: they proactively

poll the environment to find new information.– Agents decide whether to respond to messages.– The elements of proactivity and autonomy make

them part of AI.

47

Page 48: COMP219: Artificial Intelligencefransoliehoek.net/.../COMP219_17_SemanticNets.pdf · Semantic Networks • Charles S Peirce 1909 – existential graphs • Quillian in 1968 – semantic

Summary

• Semantic networks were a popular method of structuring information

• In recent years people have attempted to be more principled and formal– Simply working on special cases and limited domains is no longer

enough– Next we will consider these developments in the context of ontologies

and logic-based approaches• Structured objects developed into OO programming, now a

conventional technique

• Next time– Expert systems and ontologies

48