Upload
elmer-elvin-hubbard
View
217
Download
1
Embed Size (px)
Citation preview
Chapter 3
Knowledge Representation
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.
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!
4
Grain
FoxFarmerGoose
FarmerGooseGrain
Fox
FarmerFoxGooseGrain
FoxGrain
FarmerGoose
FarmerFoxGrain
Goose
Goose
FarmerFoxGrain
FarmerGoose
FoxGrain
FarmerGooseFoxGrain
Fox
FarmerGooseGrain
FarmerFoxGoose
Grain
Categories of Knowledge
5
6
Procedural Knowledge
Knowing how to do something:
• Fix a watch• Install a window• Brush your teeth• Ride a bicycle
7
Declarative Knowledge
• Knowledge that something is true or false
• Usually associated with declarative statements– Don’t put your finger in the boiled water
8
The Pyramid of Knowledge
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.
10
Knowledge Representation Techniques
• Object-Attribute-Value Triple• Rules• Semantic nets• Frames• Logic oPropositional logicoFirst-order logic
11
Object-Attribute-Value Triple
12
OAV Triple(Object with multiple attribute)
OAV with Certainty Factor
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
15
Knowledge Representation Techniques
• Object-Attribute-Value Triple• Rules• Semantic nets• Frames• Logic oPropositional logicoFirst-order logic
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
17
Example: Reasoning with rules
Conclusion
REASONING
Long-term Memory
Production Rule
Short-term Memory
Fact
يادآوري
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
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
20
Knowledge Representation Techniques
• Object-Attribute-Value Triple• Rules• Semantic nets• Frames• Logic oPropositional logicoFirst-order logic
21
Semantic Networks
Two Types of Nets:
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.
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
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)
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: يك عمل گاز گرفتن
26
Semantic Net Example
John g
Give
agent
Book
b
ako akoobject
Mary
beneficiarygive(John, Mary, book)
“John gives Mary a book”
27
Semantic Net Example
Mammal
Person
Owen
Nose
Red Liverpool
isa
ako
has-part
uniform color tea
m
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
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
30
Knowledge Representation Techniques
• Object-Attribute-Value Triple• Rules• Semantic nets• Frames• Logic oPropositional logicoFirst-order logic
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.
32
A Car Frame
33
Frame Examples
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
35
Knowledge Representation Techniques
• Object-Attribute-Value Triple• Rules• Semantic nets• Frames• Logic oPropositional logicoFirst-order logic
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
37
Truth Tables
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
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✔
✔
✔
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”
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”)
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, …
43
Syntax of FOL: Basic elements
• Constants KingJohn, 2, NUS,... • Predicates Brother, >,...• Functions Sqrt, LeftLegOf,...• Variables x, y, a, b,...• Connectives , , , , • Equality = • Quantifiers ,
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)))
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)
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) ...
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) ...
Assignment 1:Knowledge Representation
• Due date: 93/12/21• Email to: [email protected]• Email Subject: ES_Assignment 1