COMP219: Artificial...

47
1 COMP219: Arficial Intelligence Lecture 17: Semanc Networks

Transcript of COMP219: Artificial...

Page 1: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

1

COMP219:Artificial Intelligence

Lecture 17: Semantic Networks

Page 2: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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– An attempt to incorporate certain desirable

features of human memory organisation (association) into knowledge representations

3

Page 4: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Semantic Networks

• Developed by Quillian in 1968, as a model for human memory– semantic memory

• Models the “associations” between ideas and concepts that people maintain

• Semantic net is a labelled graph– nodes in graph represent objects, concepts, or

situations/events– arcs in graph represent relationships between these

things

4

Page 5: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Semantic Networks

concepts

individuals

5

Relationships Concepts

Individuals

Page 6: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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

• The semantics of a semantic net can be relatively informal or very formal

• Often defined at the implementation level

7

Page 8: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Example

8

Page 9: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Example

Bill has four legs9

Page 10: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Example

Bill has four legs10

Page 11: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Example

Bill has four legs11

Page 12: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Example

Bill has four legs12

Page 13: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Example

Bill has four legs13

Page 14: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Example

Bill has four legs Opus is a Bird14

Page 15: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Example

Bill has four legs Opus is a Bird15

Page 16: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Example

Bill has four legs Opus is a Bird16

Page 17: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Example

Bill has four legs Opus is a Bird17

Page 18: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Example

Bill has four legs Opus is a Bird Opus walks18

Page 19: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Now we can see who brought what

Bringing 1

Party

Bringing 2

tequila

Opus

whiskey

Bill

where

where

who

who

what

what

23

Page 24: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Other Problems are Harder

• Negation– Opus and Dirk are not friends

• Can just assume an absence of a link• Cancellation

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

24

Page 25: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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

25

Page 26: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Disadvantages of Semantic Nets

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

• Facts placed inappropriately cause problems• No standards about node and arc values • Limited expressiveness: may require a number of specially

coded procedures• The above problems make it difficult to

– verify and validate the systems– share knowledge– reuse knowledge– acquire knowledge methodically

26

Page 27: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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

27

wikipedia

Page 28: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Othello was a general who was married to Desdemona

Othello

general

Desdemona

rank

Married to

28

Page 29: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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

Othello

general

Desdemona

rank

Married to

Emilia

captain

IagoMarried to

rank

hated

29

Page 30: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Iago told Othello lies about Desdemona

Othello

general

Desdemona

rank

Married to

Emilia

captain

IagoMarried to

rank

hatedLying-1

liar

deceivedabout

30

Page 31: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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 31

Page 32: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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…

32

Page 33: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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

33

Page 34: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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

34

Page 35: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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

35

Page 36: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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

36

Page 37: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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

37

Page 38: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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

38

Page 39: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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

39

Page 40: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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

40

Page 41: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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,_,_).

41

Page 42: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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

42

Page 43: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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.

43

Page 44: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

Problems with Frames & Semantic Nets

• Both frames and semantic nets are essentially arbitrary.

• Both are useful for representing certain sorts of knowledge.

• But both are essentially ad hoc - they lack precise meaning, or semantics.

• Inference procedures poorly defined and justified, and often special purpose.

• The syntax of KR scheme is irrelevant.• Logic generalises these schemes.

44

Page 45: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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• In Object Oriented Programming we use the procedural

reading: in AI objects are intended to model or simulate the domain.

• OO Programming is a good example of how AI contributes to mainstream computing

45

Page 46: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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.

46

Page 47: COMP219: Artificial Intelligencefransoliehoek.net/teaching/COMP219/lectures/COMP219_17_SemanticNets.pdf · • The semantics of a semantic net can be relatively informal or very formal

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

47