0% found this document useful (0 votes)
13 views94 pages

CMPG313 Lesson4 230502 200000

Uploaded by

EMELY MACHETE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views94 pages

CMPG313 Lesson4 230502 200000

Uploaded by

EMELY MACHETE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 94

Knowledge Representation

1
Knowledge and Intelligence
• Does knowledge have any role in demonstrating intelligence
behavior?

• One of the objectives of AI


– Act intelligently
2
Knowledge Representation (KR)
• There is not yet a clear understanding of how the brain represents
knowledge

• KR is an area in artificial intelligence that is concerned with how to


formally "think", that is, how to use a symbol system to represent "a
domain of discourse" that which can be talked about, along with
functions that may or may not be within the domain of discourse that
allow inference (formalized reasoning) about the objects within the
domain of discourse to occur.

• Knowledge representation is the study of how knowledge about the


world can be represented and what kinds of reasoning can be done
with that knowledge
3
Representation and Reasoning System (RRS)
• In order to use knowledge and reason with it, you need what we call a
RRS
• RRS is composed of
– a language to communicate with a computer, a way to assign meaning to the language,
and
– procedures to compute answers given input in the language (inference mechanism)

• An RRS lets you tell the computer something in a language where you
have some meaning associated with the sentences in the language, you
can ask the computer questions, and the computer will produce
answers that you can interpret according to the meaning associated
with the language 4
Important Issues in Knowledge Representation
• how knowledge is stored
• how knowledge that is applicable to the current problem can be
retrieved
• how reasoning can be performed to derive information that is
implied by existing knowledge but not stored directly

5
Knowledge Representation (KR) Cont’d
• Typical problem solving (and hence many AI) tasks can be
commonly reduced to:
– representation of input and output data as symbols in a physical symbol
– reasoning by processing symbol structures, resulting in other symbol structures
• Some problems highlight search whilst others knowledge
representation

6
Knowledge Representation (KR) Cont’d
• Several kinds of knowledge might need to be represented in AI
systems:
– Objects
Facts about objects in our world domain. e.g. Guitars have strings, trumpets are brass
instruments.
– Events
Actions that occur in our world. e.g. Steve Vai played the guitar in Frank Zappa's Band.
– Performance
A behavior like playing the guitar involves knowledge about how to do things.
– Meta-knowledge
knowledge about what we know. e.g. Bobrow's Robot who plan's a trip. It knows that it
can read street signs along the way to find out where it is
7
Knowledge Representation (KR) Cont’d
• Two entities to deal with when representing knowledge:
– Facts: truths about the real world and what we represent. This can be
regarded as the knowledge level
– Representation of the facts: which we manipulate.
• This can be regarded as the symbol level since we usually define the representation
in terms of symbols that can be manipulated by programs

8
Knowledge Representation (KR) Cont’d
• We can structure these entities at two levels:
– The knowledge level: at which facts are described
– The symbol level: at which representations of objects are defined in terms
of symbols that can be manipulated in programs

9
Knowledge Representation (KR) Cont’d
• English or natural language is an obvious way of representing and
handling facts.
• Logic enables us to consider the following fact
– spot is a dog as dog(spot);
– We could then infer that all dogs have tail with:
• x : dog ( x) → hastail ( x)
– We can then deduce: hasatail(Spot)
• Using an appropriate backward mapping function; the English
sentence:
– Spot has a tail can be generated

10
Using Knowledge
• Let us consider how knowledge may be used
– Learning
• It refers to acquiring knowledge
• This is more than simply adding new facts to a knowledge base. New data may
have to be classified prior to storage for easy retrieval
• Interaction and inference with existing facts to avoid redundancy and replication in
the knowledge and also so that facts can be updated.
– Retrieval
• The representation scheme used can have a critical effect on the efficiency of the
method
• Humans are very good at it.
– Reasoning
• Infer facts from existing data
11
Properties for Knowledge Representation Systems
• The following properties should be possessed by a knowledge
representation system
– Representational Adequacy
• the ability to represent the required knowledge;
– Inferential Adequacy
• the ability to manipulate the knowledge represented to produce new knowledge
corresponding to that inferred from the original;
– Inferential Efficiency
• the ability to direct the inferential mechanisms into the most productive directions by storing
appropriate guides;
– Acquisitional Efficiency
• the ability to acquire new knowledge using automatic methods wherever possible rather than
reliance on human intervention.
• To date no single system optimizes all of the above
12
Techniques/Approaches to Knowledge
Representation
• Simple relational knowledge
• Inheritable knowledge
• Inferential Knowledge
• Procedural Knowledge

13
Techniques/Approaches to Knowledge
Representation Cont’d
• Simple Relational Knowledge
– The simplest way of storing facts is to use a relational method where each fact about a
set of objects is set out systematically in columns
– This representation gives little opportunity for inference, but it can be used as the
knowledge basis for inference engines
• Simple way to store facts
• Little opportunity for inference.
• Knowledge basis for inference engines
• Each fact about a set of objects is set out systematically in columns

14
Techniques/Approaches to Knowledge
Representation Cont’d
• Simple Relational Knowledge Cont’d

– We can ask questions like:


• Who is dead?
• Who plays Jazz/Trumpet etc.?
– This sort of representation is popular in database systems
15
Techniques/Approaches to Knowledge
Representation Cont’d
• Inheritable Knowledge
– It extends the base of Relational
knowledge more by allowing inference
mechanisms
• Property inheritance
– Elements inherit values from being members
of a class
– data must be organized into a hierarchy of
classes as shown in the figure
– Boxed nodes represent objects and values
of attributes of objects
– Values can be objects with attributes and
so on
– Arrows point from object to its value.
– This structure is known as a slot and filler
structure, semantic network or a
collection of frames
16
Techniques/Approaches to Knowledge
Representation Cont’d
• Inheritable Knowledge Cont’d
– The algorithm to retrieve a value for an attribute of an instance object:
• Find the object in the knowledge base
• If there is a value for the attribute report it
• Otherwise look for a value of instance if none fail
• Otherwise go to that node and find a value for the attribute and then report it
• Otherwise search through using isa until a value is found for the attribute

17
Techniques/Approaches to Knowledge
Representation Cont’d
• Inferential Knowledge
– Represent knowledge as formal logic:
• All dogs have tails: x : dog ( x) → hastail ( x)
– Advantages:
• A set of strict rules
– Can be used to derive more facts.
– Truths of new statements can be verified.
– Guaranteed correctness.
• Many inference procedures are available to implement the standard rules of logic.
• Popular in AI systems. e.g. Automated theorem proving

18
Techniques/Approaches to Knowledge
Representation Cont’d
• Procedural Knowledge
– Basic idea:
• Knowledge encoded in some procedures
– small programs that know how to do specific things, how to proceed.
– e.g. a parser in a natural language understander has the knowledge that a noun phrase
may contain articles, adjectives and nouns. It is represented by calls to routines that know
how to process articles, adjectives and nouns.
• Advantages:
– Heuristic or domain specific knowledge can be represented.
– Extended logical inferences, such as default reasoning facilitated.
– Side effects of actions may be modeled. Some rules may become false in time.
Keeping track of this in large systems may be tricky.
19
Techniques/Approaches to Knowledge
Representation Cont’d
• Procedural Knowledge Cont’d
Disadvantages:
– Completeness - not all cases may be represented
– Consistency - not all deductions may be correct
• e.g. If we know that Fred is a bird we might deduce that Fred can fly. Later we
might discover that Fred is an emu
– Modularity is sacrificed. Changes in knowledge base might have far-
reaching effects
– Cumbersome control information
20
Issue in Knowledge Representation
• Below are listed issues that should be raised when using a
knowledge representation technique:
– Important Attributes
– Relationships
– Granularity

21
Issue in Knowledge Representation Cont’d
• Important Attributes
– Are there any attributes that occur in many different types of
problem?
– There are two:
• instance and isa
• each is important because each supports property inheritance

22
Issue in Knowledge Representation Cont’d
• Relationships
– What about the relationship between the attributes of an object
• inverses, existence
– techniques for reasoning about values and single valued attributes.
We can consider an example of an inverse in
• band(John Zorn, Naked City)
• This can be treated as John Zorn plays in the band Naked City or John Zorn's
band is Naked City.
• Another representation is band = Naked City
• band-members = John Zorn, Bill Frissell, Fred Frith, Joey Barron, …

23
Issue in Knowledge Representation Contd
• Granularity
– At what level should the knowledge be represented and what are the primitives
– English is a very rich language with over half a million words it is clear we will find
difficulty in deciding upon which words to choose as our primitives in a series of
situations e.g.
• If Tom feeds a dog then it could become:
– feeds(tom, dog)
• If Tom gives the dog a bone like:
– gives(tom, dog, bone)
• Are these the same?
• In any sense does giving an object food constitute feeding?
• If give( x, food ) → feed ( x) then we are making progress
• But we need to add certain inferential rules

24
Issue in Knowledge Representation Cont’d
• Granularity Cont’d
– Louise is Bill's cousin.
– How do we represent this?
• louise = daughter (brother or sister (father or mother( bill))) Suppose it is Chris,
then we do not know if it is Chris as a male or female and then son applies as
well.
• Clearly, the separate levels of understanding require different
levels of primitives and these need many rules to link together
apparently similar primitives

25
Logic Knowledge Representation
• English or natural language is an obvious way of representing and
handling facts
• Logic enables us to consider the following fact:
spot is a dog as dog(spot).
• We could then infer that all dogs have tails with: x : dog ( x) → hastail ( x)
• We can then deduce: hasatail(Spot)

26
Logic Knowledge Representation Cont’d
• There are five types of logic, namely:
– propositional logic
– first order logic
– temporal logic
– probability theory and
– fuzzy logic

27
Logic Knowledge Representation Cont’d
Language What exist Belief of Agent

Propositional Logic Facts T|F|Unkwown

First-Order Logic Facts, Objects, Relations T|F|Unkwown

Temporal Logic Facts, Objects, Relations, Times T|F|Unkwown

Probabilistic Theory Facts Degree of belief [0…1]

Fuzzy Logic Degree of truth Degree of belief [0…1]

In particular, prepositional and predicate logic will be met in other


knowledge representation schemes and reasoning methods 28
Prepositional Logic
• It consists of a formal language (syntax) and semantics that give
meaning to the well-formed strings, which are called
propositions

29
Prepositional Logic: Syntax
• The syntax of propositional logic defines the allowable sentences
• The atomic sentences consist of a single proposition symbol
• Each such symbol (normally uppercase letter: P, Q, R) stands for a proposition that can be
true or false (True is the always-true proposition and False is the always-false proposition)
• Complex sentences are constructed from simpler sentences, using parentheses and logical
connectives
There are five connectives in common use:

¬ (NOT)
∧ (AND)
∨ (OR)
⇒ (IF-THEN)
⇔ (IF AND ONLY IF)
30
Prepositional Logic: Syntax Cont’d

31
Prepositional Logic: Syntax Cont’d
• The rules for creating propositions are as follows:
– All letters, all indexed letters, and the logical values True and False are
propositions. They are called atomic propositions.
– If A and B are propositions, then so are ¬A, A ∧ B, A ∨ B, A ⇒ B, A ⇔
B, and (A). They are called compound propositions

32
Prepositional Logic: Syntax Cont’d
• Example: Suppose the propositions P and Q stand for these
statements about the world:
P: It is raining outside.
Q: The pavement is wet.
• Then the following compound propositions stand for these
statements about the world:
¬P: It is not raining outside.
P∧Q: It is raining outside and the pavement is wet.
P∨Q: It is raining outside or the pavement is wet.
P⇒Q: If it is raining outside, then the pavement is wet.
P⇔Q: It is raining outside if and only if the pavement is wet.
33
Prepositional Logic: Syntax Cont’d

• Example: Let P, Q, and R stand for these statements about the world:
P: It is raining outside.
Q. The pavement is wet.
R: The sprinkler is on.
• Then applying Rule 2 once using the ∨ connective, we have that P∨R is a
proposition.
• Applying Rule 2 a second time using the ∧ connective, we obtain that
Q∧P∨R is a proposition.
• This proposition stands for the following statement about the world:
Q∧P∨R: The pavement is wet and it is raining outside or the sprinkler is on

34
Prepositional Logic: Semantic
• This defines the rules for determining the truth of a sentence with
respect to a particular model
• In propositional logic, a model simply fixes the truth value—true or
false—for every proposition symbol.
• For complex sentences, we have five rules, which hold for any sub-
sentences P and Q in any model m:
¬P is true if P is false in m.
P ∧ Q is true if both P and Q are true in m.
P ∨ Q is true if either P or Q is true in m.
P ⇒ Q is true unless P is true and Q is false in m.
P ⇔ Q is true if P and Q are both true or both false in m
35
Prepositional Logic: Semantic Cont’d
• The semantics for propositional logic consist of the following
rules:
– The logical value True is always assigned the value T and the logical
value False is always assigned the value F
– Every other atomic proposition is assigned a value T or F. The set of all
these assignments constitutes a model or possible world. All possible
worlds (assignments) are permissible.
– The truth values obtained by applying each connective to arbitrary
propositions are given by the following truth tables:

36
Prepositional Logic: Semantic Cont’d

– The truth value for a compound proposition such as P∧Q∨R is determined


recursively using the above truth tables. This is done according to the following
rules:
• The ( ) grouping has highest precedence in that the truth value of an entire
sub-proposition enclosed by ( ) is evaluated first.
• The precedence order for the connectives is ¬, ∧, ∨, ⇒, ⇔.
• Binary connectives that are the same associate from left to right.
37
Prepositional Logic: Semantic Cont’d
• Example: Suppose you read the following sign in the shoe store: Your
shoes may be returned within 30 days of the purchase date if they have
not been worn
• Let’s express this statement using propositional logic and investigate
when it is true
• Let the following propositions stand for these statements about the
world:
P: Your shoes have been worn.
Q: It has not been more than 30 days since you purchased the shoes.
R: Your shoes may be returned.
• Then the statement of the store’s policy concerning your shoes is
expressed logically as the following proposition:
¬P ∧ Q ⇒ R
38
Prepositional Logic: Semantic Cont’d
• A truth table for this proposition is as follows:

• The intent was to allow the shoes to be returned if and only if they were not worn and it has
been no more than 30 days. If the store owner made this statement, then we would express
the store owner’s policy logically as follows:
¬P ∧ Q ⇔ R

39
Prepositional Logic: Semantic Cont’d
Limitation of Prepositional logic
• It can only deal with finite number of propositions
– it is too weak to represent knowledge of complex environments in a concise way
• For example, representing the following statements using prepositional logic
P: All dogs are faithful
Q: Tommy is a dog
• Can we say P^Q? NO!
Tom is intelligent
Tom is hardworking
• If Tom is hardworking and Tom is intelligent then Tom scores high mark.
• What of John, Gill … so, you have to represent for all students
40
Predicate or First Order Logic
• This is the generalization of propositional logic that permits the
expression and inference of arguments in infinite modes
– for example “All dog are faithful”
• Like propositional logic, first-order logic consists of a formal
language with a syntax and semantics that give meaning to the
well-formed strings

41
Predicate or First Order Logic: Syntax
• The syntax of predicate logic are expressed in terms of:
– Terms
• Constants
• Variables
• Functions

– Predicates
– Quantifiers
• Universal
• Existential

42
Predicate or First Order Logic: Syntax Cont’d

43
Predicate or First Order Logic: Syntax Cont’d
• Terms: a logical expression that refers to an object for example
Men, dog
– Constants: A constant is a symbol like ‘Socrates’, ‘John’, ‘B’, and ‘1’.
– Variables: A variable is a lower-case alphabetic character like x, y, or z.
– Functions: It denotes a mapping from some subset of entities to a
single entity. Symbols like ‘mother’, ‘weight’, and ‘height’. For example,
If the value of mother(Laura) is ‘Mary’
• This means that Mary is the mother of Laura.
If the value of sum(2, 3) is 5,
• This means that the sum of 2 and 3 is 5

44
Predicate or First Order Logic: Syntax Cont’d
• Predicate: It denotes a relationship among a set of entities or a
property of a single entity
• It is like a function but its return type is true of false For
example,
married(Mary, Fred)
– denotes that Mary and Fred are married,
and young(Sam)
– denotes that Sam is young
• The number of arguments in a predicate is called its arity
– The predicate ‘married’ has arity two
– The predicate ‘young’ has arity one.
45
Predicate or First Order Logic: Syntax Cont’d
• Quantifiers: it allows us to express properties of entire collections
of objects, instead of enumerating the objects by name
• The two standard quantifiers in First-order logic are:
– universal
– existential

46
Predicate or First Order Logic: Syntax Cont’d
• Universal quantification (∀)
– Recall the difficulty we had with the expression of general rules in
propositional logic. Rules such as
• “All dogs are faithful” and
• “All kings are persons”
– These are the bread and butter of first-order logic
• “All kings are persons,” is written in first-order logic as
∀ x King(x) ⇒ Person(x)
• ∀ is usually pronounced “For all…”
• Thus, the sentence says, “For all x, if x is a king, then x is a
person”
47
Predicate or First Order Logic: Syntax Cont’d
• The sentence ∀ x P, where P is any logical expression,
says that P is true for every object x
• More precisely, ∀ x P is true in a given model if P is true in all
possible extended interpretations constructed from the
interpretation given in the model, where each extended
interpretation specifies a domain element to which x refers
• For example, suppose our domain consists of the five individuals
named Mary, Fred, Sam, Laura, and Dave
• The formula:∀x young(x)
denotes that Mary, Fred, Sam, Laura, and Dave are all young

48
Predicate or First Order Logic: Syntax Cont’d
• Existential quantification (∃)
– Universal quantification makes statements about every object
– Similarly, we can make a statement about some object in the universe
without naming it, by using an existential quantifier.
– For example: King John has a crown on his head, can be written as
∃ x Crown(x) ∧ OnHead(x, John)
∃x is pronounced “There exists an x such that” or “For some x”

49
Predicate or First Order Logic: Syntax Cont’d
• The sentence ∃ x P says that P is true for at least one object x.
• More precisely, ∃ x P is true in a given model if P is true in at least
one extended interpretation that assigns x to a domain element
• For example, Suppose our domain consists of the five individuals
named Mary, Fred, Sam, Laura, and Dave.
• The formula: ∃x young(x)
denotes that at least one of Mary, Fred, Sam, Laura, and Dave is young.

50
Predicate or First Order Logic: Syntax Cont’d
• Operators (¬, ∨, ∧, ⇒, ⇔, = )
– have the same meaning they have in propositional logic. For example,
¬married(Mary, Fred)
• denotes that Mary and Fred are not married. The formula
¬married(Mary, Fred) ∧ young(Sam)
• denotes that Mary and Fred are not married and that Sam is young
• The equality operator
– is used to denote that two terms refer to the same entity. For example,
Mary = mother(Laura)
• denotes that Mary and mother(Laura) refer to the same entity. That is, Mary is the
mother of Laura

51
Predicate or First Order Logic: Syntax Cont’d
• An atomic sentence (or atom for short)
– is formed from a predicate symbol optionally followed by a parenthesized
list of terms, such as
Brother(Richard, John)
This states that: Richard is the brother of John
• (P(x, y) is read as “x is a P of y).
• Atomic sentences can have complex terms as arguments
Married(Father(Richard), Mother(John))
states that: Richard’s father is married to John’s mother
• An atomic sentence is true in a given model if the relation referred to
by the predicate symbol holds among the objects referred to by the
arguments
52
Predicate or First Order Logic: Syntax Contd
• Complex sentences
• logical connectives are used to construct more complex sentences,
with the same syntax and semantics as in propositional logic
• Here are four sentences that are true in the model under some
intended interpretation:
¬Brother(LeftLeg(Richard), John)
Brother(Richard, John) ∧ Brother(John, Richard)
King(Richard) ∨ King(John)
¬King(Richard) ⇒ King(John)

53
Predicate Examples
• Brothers are siblings
• If x is a man then x is mortal
• If n is a natural number then n is either odd or even
• If it doesn’t rain on Monday, Tom will go to the mountains
• Emma is a Doberman pinscher and a good dog
• All dogs are faithful
• At least one planet has life on it
• All birds cannot fly OR there exist a bird that cannot fly
• Some dogs bark

54
Predicate Examples Cont’d
• All dogs have four legs
• No dog purr
• Fathers are male parents with children
• Everyone love its mother
• Not all students take COSC203 and MATH201
• Only one student fail MATH301
• All basketball players are tall.
• Some people like anchovies.
• If wishes were horses, beggars would ride.
• Nobody likes taxes
55
Predicate Examples Cont’d
• Let us now look at an example of how predicate logic is used to
represent knowledge
• Consider the following:
– Prince is a mega star.
– Mega stars are rich.
– Rich people have fast cars.
– Fast cars consume a lot of petrol.
• Then, try to draw the conclusion: Prince's car consumes a lot of
petrol

56
Predicate Examples Cont’d
• Prince is a mega star into: and
• Mega stars are rich into: mega_star(prince)
• Rich people have fast cars, the third axiom is more
difficult:
m : mega _ star (m) → rich(m)
– Is cars a relation and therefore car(c,m) says that case c is
m's car. OR
– Is cars a function? So we may have car_of(m)
• Assume cars is a relation then axiom 3 may be written:
• c, m : car (c, m)  rich(m) → fast (c)
• The fourth axiom is a general statement about fast
cars.
• Let consume(c) mean that car c consumes a lot of petrol.
Then we may write: c :[ fast (c)  m : car (c, m) → consume(c)]
57
Predicate Examples Contd
• Is this enough? NO! -- Does prince have a car? We need the
function after all (and addition to car)
car _ of
• The result of applying car_of to m is m's car
• The final set of predicates is: c:car(car_of(m),m)
mega_star(prince)
m:mega_star(m) → rich(m)
c:car(car_of(m),m)
c,m:car(c,m)  rich(m) → fast(c)
c :[ fast (c)  m : car (c, m) → consume(c)]
58
Isa and instance relationships
• Two attributes isa and instance play an important role in many
aspects of knowledge representation
• The reason for this is that they support property inheritance.
– isa
• used to show class inclusion, e.g. isa(mega_star,rich).
– instance
• used to show class membership, e.g. instance(prince,mega_star).

59
Knowledge Representations:
Declarative or Procedural?
• Declarative knowledge representation:
– Static representation:
• knowledge about objects, events etc. and their relationships and states are given.
– Requires a program to know what to do with knowledge and how to do it.
• Procedural representation:
– control information necessary to use the knowledge is embedded in the
knowledge itself. e.g. how to find relevant facts, make inferences etc.
– Requires an interpreter to follow instructions specified in knowledge

60
Knowledge Representations:
Declarative or Procedural? Contd
• An Example
– Let us consider what knowledge an alphabetical sorter would need:
– Implicit knowledge that A comes before B etc.
– This is easy -- really integer comparison of (ASCII) codes for A1, B1,….
• All programs contain procedural knowledge of this sort.
– The procedural information here is that knowledge of how to
alphabetize is represented explicitly in the alphabetization procedure.
– A declarative system might have to have explicit facts like A comes
before B, B comes before C etc..
61
Representing: How to Use Knowledge
• Need to represent how to control the
processing:
– direction
• Indicate the direction an implication could be used.
– For example; To prove something can fly show it is a bird.
fly(x) bird(x).
– Knowledge to achieve goal
• Specify what knowledge might be needed to achieve a
specific goal
– For example; to prove something is a bird try using two facts
has_wings and has_feathers
62
Slot and Filler Structures
• Recall: inheritance KR

• This structure is also called as slot and filler structure , semantic network
or a collection of frames
• These structures are the devices to support property inheritance along isa
and instance links
63
Slot and Filler Structures Contd
• A slot is an attribute value pair in its simplest form.
• A filler is a value that a slot can take –
– could be a numeric, string (or any data type) value or a pointer to
another slot.

• Advantage of slot and filler structures:


– Makes it easy to describe properties of relations.
e.g. “Is Miles Davies a musician?”
– Form of object oriented programming and has advantages such as
ease of viewing by people
• Types of Slot and filler structures
– weak slot and filler structures
• Semantic Nets
• Frames
– strong slot and filler structures
• Conceptual Dependency
• scripts
64
Weak Slot and Filler Structures
• are “Knowledge-Poor” or “weak” as very little importance is given
to the specific knowledge the structure should contain
• Why use this data structure?
– It enables attribute values to be retrieved quickly
• assertions are indexed by the entities
• binary predicates are indexed by first argument.
– E.g. band(Miles Davies, Miles Davies Group).
– Properties of relations are easy to describe.
– It allows ease of consideration as it embraces aspects of object oriented
programming

65
Weak Slot and Filler Structures Contd
• A weak slot and filler structure does not consider the content
of the representation.
– We will study two types:
• Semantic Nets.
• Frames

66
Semantic Nets
• Is a formal graphical language representing facts about entities
in some world about which we wish to reason
• The major idea is that:
– The meaning of a concept comes from its relationship to other
concepts, and that
– The information is stored by interconnecting nodes with labeled arcs
• Nodes represent: various objects/values of the attributes of
object .
• Arcs represent: relationships among nodes.
67
Representation Logic in a Semantic Net
• The physical attributes of a person can be represented as in the figure
below

• These values can also be represented in logic as:


– isa(person, mammal)
– instance(Mike-Hall, person)
– team(Mike-Hall, Cardiff)

68
Representation in a Semantic Net Contd
• In this network, we could use inheritance to derive the
additional info:
has_part(Mark Hall, Head)
• We have already seen how conventional predicates such as
lecturer(dave) can be written as instance (dave, lecturer)
• But we have a problem: How we can have more than 2 place
predicates in semantic nets? E.g. score(Cardiff, Llanelli, 23-6)

69
Representation in a Semantic Net Contd
• Solution:
– Create new nodes to represent new objects either contained or
alluded to in the knowledge
• game and fixture in the current example.
– Relate information to nodes and fill up slots

70
Representation in a Semantic Net Contd
• As a more complex example consider the sentence: John gave
Mary the book
• Here we have several aspects of an event

71
Inference in a Semantic Net
• Basic inference mechanism:
– follow links between nodes.
• Two methods to do this:
– Intersection search
– Inheritance

72
Inference in a Semantic Net Contd
• Intersection search
– the notion that spreading activation out of two nodes and finding
their intersection finds relationships among objects.
– This is achieved by assigning a special tag to each visited node
Advantages
• entity-based organization and
• fast parallel implementation
– Disadvantage
• structured questions need highly structured networks

73
Inference in a Semantic Net Contd
• Inheritance
– the isa and instance representation
provide a mechanism to implement
this.
– Inheritance also provides a means
of dealing with default reasoning.
E.g. we could represent:
• Emus are birds.
• Typically birds fly and have wings.
• Emus run

74
Inference in a Semantic Net Contd
• In making certain inferences we will also need to distinguish
between the link that defines a new entity and holds its value
and the other kind of link that relates two existing entities
• Consider the example shown where the height of two people
is depicted and we also wish to compare them

75
Inference in a Semantic Net Contd
• We need extra nodes for the • Special procedures are needed to
concept as well as its value process these nodes, but without
this distinction the analysis
would be very limited

76
Extending Semantic Nets
• Here we will consider some extensions to
Semantic nets that overcome a few problems
(extend their expression of knowledge)
• Partitioned Networks: Partitioned Semantic
Networks allow for:
– propositions to be made without commitment to
truth.
– expressions to be quantified
• Basic idea:
– Break network into spaces which consist of groups of
nodes and arcs and regard each space as a node
77
Extending Semantic Nets Contd
• Consider the following:
– Andrew believes that the earth is
flat
• the proposition: the earth is flat
can be encoded into a space
represented by nodes and arcs .
• The above space can be link to
the rest of the network i.e.
Andrew's belief with aid of nodes
and arcs
78
Extending Semantic Nets Contd
• Now consider the quantified expression:
• Every parent loves their child, To represent this we:
– Create a general statement, GS; a special class about the world.
– Make node g an instance of GS.
– Every element will have at least 2 attributes:
• a form that states which relation is being asserted.
• one or more or forall () connections
exists()
– these represent universally quantifiable variables in such statements e.g. x, y in
parent(x)→ : child(y) loves(x,y)

79
Extending Semantic Nets Contd
• We have to construct two spaces:
– for each x,y.
• We can express variables as existentially qualified variables and
– express the event of love having an agent p and receiver b for every
parent p which could simplify the network

80
Extending Semantic Nets Contd
• Every parent loves their child
Parent ( x) → y : child ( y)  loves( x, y)

81
Extending Semantic Nets Contd
• Also, If we change the sentence to Every parent loves the child
then the node of the object being acted on (the child) lies
outside the form of the general statement.
– Thus it is not viewed as an existentially qualified variable whose value
may depend on the agent.

82
Frames
• Frames can also be regarded as an extension to Semantic
nets
• Indeed it is not clear where the distinction between a
semantic net and a frame ends
• Semantic nets initially we used to represent labeled
connections between objects
• As tasks became more complex, the representation needs
to be more structured.
• The more structured the system, it becomes more
beneficial to use frames.

• A frame is a collection of attributes or slots and associated


values that describe some real world entity.
• Frames on their own are not particularly helpful but frame
systems are a powerful way of encoding information to
support reasoning. 83
Frames Contd
• Set theory provides a good basis for understanding frame
systems.
• Each frame represents:
– a class (set), or
– an instance (an element of a class).

84
Frame Knowledge Representation
• Consider the example first discussed in
Semantics Nets:

85
Frame Knowledge Representation Contd
• Here the frames Person, Adult-Male, Rugby-Player,
Back and Rugby-Team are all classes and the frames
Mark-Hall and Cardiff-RFC are instances.
• Note
– The isa relation is in fact the subset relation.
– The instance relation is in fact element of.
– The isa attribute possesses a transitivity property. This
implies: Mark-Hall is a Back and a Back is a Rugby-Player
who in turn is an Adult-Male and also a Person.
– Both isa and instance have inverses which are called
subclasses or all instances.
– There are attributes that are associated with the class or
set such as cardinality and on the other hand there are
attributes that are possessed by each member of the class
or set 86
DISTINCTION BETWEN SETS AND INSTANCES
• It is important that this distinction is clearly understood
• Cardiff-RFC can be thought of as a set of players or as
an instance of a Rugby-Team.
• If Cardiff-RFC were a class then
– its instances would be players
– it could not be a subclass of Rugby-Team otherwise its
elements would be members of Rugby-Team which we do
not want.
• Instead we make it a subclass of Rugby-Player and this
allows the players to inherit the correct properties
enabling us to let the Cardiff-RFC to inherit information
about teams.
– This means that Cardiff-RFC is an instance of Rugby-Team 87
DISTINCTION BETWEN SETS AND INSTANCES Contd
• BUT There is a problem here:
– A class is a set and its elements have properties
– We wish to use inheritance to bestow values on its members
– But there are properties that the set or class itself has such as the
manager of a team
• This is why we need to view Cardiff-RFC as a subset of one
class players and an instance of teams

• Solution: MetaClasses

88
MetaClass
• special class whose elements themselves are classes.
– If X is meta class and Y is another class which is an element of X, then
Y inherits all the attributes of X
• Now consider our rugby teams as:

89
MetaClass Contd
• The basic metaclass is Class, and this allows us to:
– define classes which are instances of other classes, and (thus)
– inherit properties from this class.
• Inheritance of default values occurs when one element or class
is an instance of a class

90
Slots as Objects
• How can we represent the following properties in frames?
– Attributes such as weight, age be attached and make sense.
– Constraints on values such as age being less than a hundred
– Default values
– Rules for inheritance of values such as children inheriting parent's
names
– Rules for computing values
– Many values for a slot.

• A slot is a relation that maps from its domain of classes to its range
of values.
• A relation is a set of ordered pairs so one relation is a subset of
another.
• Since slot is a set, the set of all slots can be represent by a
metaclass called SLOT

91
Slots as Objects Contd
• Consider the following:

92
Slots as Objects Contd
• NOTE:
– Instances of SLOT are slots
– Associated with SLOT are attributes that each instance will
inherit.
– Each slot has a domain and range.
– Range is split into two parts one the class of the elements and
the other is a constraint which is a logical expression if absent it
is taken to be true.
– If there is a value for default then it must be passed on unless an
instance has its own value.
– The to-compute attribute involves a procedure to compute its
value. E.g. in Position where we use the dot notation to assign
values to the slot of a frame.
– Transfers through lists other slots from which values can be
derived from inheritance
93
Interpreting Frames
• A frame system interpreter must be capable of
the following in order to exploit the frame slot
representation:
– Consistency checking - when a slot value is added to
the frame relying on the domain attribute and that
the value is legal using range and range constraints.
– Propagation of definition values along isa and instance
links.
– Inheritance of default. values along isa and instance
links.
– Computation of value of slot as needed.
– Checking that only correct number of values
computed
94

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy