chapter 3 knowledge representation. 2 'a representation is a set of conventions about how to...

48
Chapter 3 Knowledge Representation

Upload: elmer-elvin-hubbard

Post on 19-Jan-2016

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

Chapter 3

Knowledge Representation

Page 2: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

2

Knowledge Representation

• 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16).

• 'Good representations make important objects and relations explicit, expose natural constraints, and bring objects and relations together' (ibid: 45)

• The representation principle:– Once a problem is described using an appropriate

representation, the problem is almost solved.

Page 3: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

3

Starting with an Example

• The Farmer, The Fox, The Goose and The Grain:– The farmer must get a fox, a goose and a sack of grain across a

river, however his boat is small and he can only carry one thing at a time. His problem is that if he leaves the fox with the goose the goose will be eaten, and if he leaves the goose with the grain, the grain will be eaten…

• A good representation makes it easier for us to solve the problem:1. Draw possible safe combinations in a diagram.2. Arrange appropriate combinations in order.3. Link appropriate arrangements to represent boat trips.4. Problem is solved!

Page 4: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

4

Grain

FoxFarmerGoose

FarmerGooseGrain

Fox

FarmerFoxGooseGrain

FoxGrain

FarmerGoose

FarmerFoxGrain

Goose

Goose

FarmerFoxGrain

FarmerGoose

FoxGrain

FarmerGooseFoxGrain

Fox

FarmerGooseGrain

FarmerFoxGoose

Grain

Page 5: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

Categories of Knowledge

5

Page 6: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

6

Procedural Knowledge

Knowing how to do something:

• Fix a watch• Install a window• Brush your teeth• Ride a bicycle

Page 7: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

7

Declarative Knowledge

• Knowledge that something is true or false

• Usually associated with declarative statements– Don’t put your finger in the boiled water

Page 8: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

8

The Pyramid of Knowledge

Page 9: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

9

Knowledge Types Example

• 711279762168321543

• Group numbers by twos. Ignore any two-digit number less than 32. Substitute the rest by ASCII equivalent

• GOLD +

• The price of the gold is rising, SO buy.

Page 10: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

10

Knowledge Representation Techniques

• Object-Attribute-Value Triple• Rules• Semantic nets• Frames• Logic oPropositional logicoFirst-order logic

Page 11: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

11

Object-Attribute-Value Triple

Page 12: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

12

OAV Triple(Object with multiple attribute)

Page 13: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

OAV with Certainty Factor

Page 14: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

14

Fuzzy FactsCrisp fact: Tom’s height is 6 feet.Fuzzy fact: Tome’s height is tall (CF:0.5)

IF The person's height is tall THEN The person's weight is heavy

Page 15: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

15

Knowledge Representation Techniques

• Object-Attribute-Value Triple• Rules• Semantic nets• Frames• Logic oPropositional logicoFirst-order logic

Page 16: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

16

Rules and Facts

• Rules:– IF the car doesn’t run and the fuel gauge reads empty

THEN fill the gas tank.– IF there is flame, THEN there is a fire.– IF there is smoke, THEN there may be a fire.– IF there is a siren, THEN there may be a fire.

• Facts: – The car doesn’t run– There is a flame– There is smoke– There is a siren

• The meaning of firing a rule: – Condition is true => Generating the conclusion

Page 17: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

17

Example: Reasoning with rules

Conclusion

REASONING

Long-term Memory

Production Rule

Short-term Memory

Fact

يادآوري

Page 18: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

18

Types of Rules

• Relationship Rules: – if the battery is dead, then the car will not start

• Recommendation Rules:– If the car will not start, then take a cab

• Directive Rules:– If the car will not start AND the fuel system is OK, then

check out the electrical system

• Strategy Rules:– If the car will not start, then first check out the fuel

system then check out the electrical system

• Heuristic Rules:– If the car will not start AND the car is a 1957 Ford,

then check the float

Page 19: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

19

Types of Rules

• Pattern matching rules (Rules with variables):– If ?x is employee AND ?x age > 65, then ?x can be

retired

• Uncertain Rules– If the car will not start, then the probability

that the electrical system operate normally is 50%.

• Meta Rules– If the car will not start AND the electrical

system operating normally, then use rule concerning the fuel system

Page 20: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

20

Knowledge Representation Techniques

• Object-Attribute-Value Triple• Rules• Semantic nets• Frames• Logic oPropositional logicoFirst-order logic

Page 21: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

21

Semantic Networks

Two Types of Nets:

Page 22: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

22

Semantic Networks

• A classic representation technique for propositional information

• Rooted from Human Associative Memory

• Semantic nets consist of nodes (objects, concepts, situations) and arcs (relationships between them).

• The OAV triple can be used to characterize all the knowledge in a semantic net.

Page 23: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

23

Common Types of Links

• IS-A – relates generic nodes to generic nodes

• A-KIND-OF – relates an instance or individual to a generic class

Page 24: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

24

Semantic Net Example

Living Organism

Plant Animalisa isaisa

isa isaisa

isa isaisa

isa

isa isa

akoako

Fly

Swim Penguin EagleSparrow

walk

Cat family

Morris

Locomotion

Locomotion

Eats

House Cats Mice

rodents

Fred

Mammal

Bird

Locomotion

Eats

ako: a kind of

Inheritance(OO)

Exception handling(override)

Page 25: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

25

Semantic Net Example

Dog

d b

ako

Bite

assailant (attacker)

Mail-carrier

m

ako ako

victim

“The dog bit the mail carrier”

ako: a kind of

b: يك عمل گاز گرفتن

Page 26: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

26

Semantic Net Example

John g

Give

agent

Book

b

ako akoobject

Mary

beneficiarygive(John, Mary, book)

“John gives Mary a book”

Page 27: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

27

Semantic Net Example

Mammal

Person

Owen

Nose

Red Liverpool

isa

ako

has-part

uniform color tea

m

Page 28: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

28

PROLOG and Semantic Nets

• UniformColor(Owen,Red).• Team(Owen, Liverpool).• AKO(Owen, Person).• HasPart(Person, Nose).• ISA(Person, Mammal).

Mammal

Person

Owen

Nose

Red Liverpool

isa

ako

has-part

uniform color tea

m

Page 29: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

29

Problems with Semantic Nets

• One problem with semantic nets is lack of standard definitions for link names (IS-A, AKO, etc.).

– Solution: OAV

• To represent definitive knowledge, the link and node names must be rigorously defined.

– Solution: Extensible markup language (XML) and ontologies.

• Problems also include combinatorial explosion of searching nodes.

– Ex. What’s the name of Pluto planet’s football team?

• Inability to define knowledge the way logic can

Page 30: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

30

Knowledge Representation Techniques

• Object-Attribute-Value Triple• Rules• Semantic nets• Frames• Logic oPropositional logicoFirst-order logic

Page 31: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

31

Frames

• Semantic nets provide 2-dimensional knowledge; frames provide 3-dimensional.

– Semantic Nets + Procedures = Frames

– Data (Properties) + Procedures = objects (like in OO)

• A frame is a group of slots and fillers that defines a stereotypical object that is used to represent generic / specific knowledge.

Page 32: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

32

A Car Frame

Page 33: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

33

Frame Examples

Page 34: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

34

Frame Examples(in combination with semantic nets)

Animals

AliveFlies

TF

Birds

LegsFlies

2T

Mammals

Legs 4

Penguins

Flies F

Cats Bats

LegsFlies

2T

Opus

NameFriend

Opus

Bill

NameFriend

Bill

Pat

Name Pat

AKO

isa

isa

AKO AKO

isa

isa isa

Page 35: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

35

Knowledge Representation Techniques

• Object-Attribute-Value Triple• Rules• Semantic nets• Frames• Logic oPropositional logicoFirst-order logic

Page 36: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

36

Propositional logic

• Logical constants: true, false • Propositional symbols: P, Q,... (atomic sentences)• Sentences are combined by connectives:

and [conjunction] or [disjunction] implies [implication / conditional] is equivalent [biconditional] not [negation]

• Literal: atomic sentence or negated atomic sentenceP, P

Page 37: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

37

Truth Tables

Page 38: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

38

Implies (P Q)

• When is PQ true? Check all that apply P=Q=true P=Q=false P=true, Q=false P=false, Q=true

Page 39: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

39

Implies (P Q)

• When is PQ true? Check all that apply P=Q=true P=Q=false P=true, Q=false P=false, Q=true✔

Page 40: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

40

Examples of PL sentences

• (P Q) R “If it is hot and humid, then it is raining”

• Q P “If it is humid, then it is hot”

• Q “It is humid.”

• We’re free to choose better symbols, btw:Ho = “It is hot”Hu = “It is humid”R = “It is raining”

Page 41: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

41

PL: Advantages and Disadvantages

• Advantages– Simple KR language sufficient for some problems– Lays the foundation for higher logics (e.g., FOL)– Reasoning is decidable, though NP complete, and efficient

techniques exist for many problems• Disadvantages

– Not expressive enough for most problems– Hard to identify “individuals” (e.g., Mary, 3)– Can’t directly talk about properties of individuals or relations

between individuals (e.g., “Bill is tall”)– Generalizations, patterns, regularities can’t easily be

represented (e.g., “all triangles have 3 sides”)

Page 42: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

42

First-order logic

• Whereas propositional logic assumes the world contains facts,

• first-order logic (like natural language) assumes the world contains

• Objects: people, houses, numbers, colors, baseball games, wars, …– Relations: red, round, prime, brother of, bigger

than, part of, comes between, …– Functions: father of, best friend, one more than,

plus, …

Page 43: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

43

Syntax of FOL: Basic elements

• Constants KingJohn, 2, NUS,... • Predicates Brother, >,...• Functions Sqrt, LeftLegOf,...• Variables x, y, a, b,...• Connectives , , , , • Equality = • Quantifiers ,

Page 44: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

44

Atomic sentences

• Atomic sentence:predicate (term1,...,termn)

• Term: function (term1,...,termn) or constant or variable

• E.g., – Brother(KingJohn,Richard) – > (Length(LeftLegOf(Richard)), Length(LeftLegOf(KingJohn)))

Page 45: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

45

Complex sentences

Complex sentences are made from atomic sentences using connectives•

S, S1 S2, S1 S2, S1 S2, S1 S2,

• E.g. Sibling(KingJohn,Richard) Sibling(Richard,KingJohn) >(1,2) ≤ (1,2) >(1,2) >(1,2)

Page 46: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

46

Universal quantification

<variables> <sentence>• Everyone at IAUDA is smart:• x At(x,IAUDA) Smart(x)

• equivalent to the conjunction of instantiations of PAt(KingJohn,IAUDA) Smart(KingJohn)

At(Richard,IAUDA) Smart(Richard) At(Maryam,IAUDA) Smart(Maryam) ...

Page 47: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

47

Existential quantification

• <variables> <sentence>

• Someone at IAUDA is smart:• x At(x,IAUDA) Smart(x)

• equivalent to the disjunction of instantiations of PAt(KingJohn,IAUDA) Smart(KingJohn)

At(Richard,IAUDA) Smart(Richard) At(Maryam,IAUDA) Smart(Maryam) ...

Page 48: Chapter 3 Knowledge Representation. 2 'A representation is a set of conventions about how to describe a class of things.' (Winston 1992:16). 'Good representations

Assignment 1:Knowledge Representation

• Due date: 93/12/21• Email to: [email protected]• Email Subject: ES_Assignment 1