CSE Dept., JNV University
Semantic Networks and Frames
KR Chowdhary, Associate Professor,
Department of Computer Science & Engineering, MBM Engineering College, JNV University, Jodhpur,
[email protected], Page:http://www.krchowdhary.com
CSE Dept., JNV University
Knowledge Representation as a medium for human expression
� An intelligent system must have knowledge representations that can be interpreted by humans.
� We need to be able to encode information in the knowledge base without significant effort.
� We need to be able to understand what the system knows and how it draws its conclusions.
CSE Dept., JNV University
Knowledge Representation
� Logic (prepositional, predicate)
� Network representation
� Semantic nets
� Structured representation
� Frames
� Issues in KR
� Hierarchies, inheritance, exceptions
� Advantages and disadvantages
CSE Dept., JNV University
KNOWLEDGE REPRESENTATION
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. . . .
CSE Dept., JNV University
The Farmer, The Fox, The Goose and The Grain
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!
KNOWLEDGE REPRESENTATION
CSE Dept., JNV University
Grain
Fox
Farmer
Goose
Farmer
Goose
Grain
Fox
Farmer
Fox
Goose
Grain
Fox
Grain
Farmer
Goose
Farmer
Fox
Grain
Goose
Goose
Farmer
Fox
Grain
Farmer
Goose
Fox
Grain
Farmer
Goose
Fox
Grain
Fox
Farmer
Goose
Grain
Farmer
Fox
Goose
Grain
CSE Dept., JNV University
KNOWLEDGE REPRESENTATION: 1960’S NETWORKS & MEANING
•Ross Quillian (1966 and 1968) was among the early AI
workers to develop a computational model which
represented 'concepts' as hierarchical networks.
•This model was amended with some additional
psychological assumptions to characterise the structure
of [human] semantic memory.
CSE Dept., JNV University
Semantic Networks
� First introduced by Quillian back in the late-60s M. Ross Quillian. "Semantic Memories", In M. M. Minsky, editor, Semantic
Information Processing, pages 216-270. Cambridge, MA: MIT Press, 1968
� Semantic network (also called Associative Network) is simple representation scheme that uses a graph of labeled nodes and labeled directed arcs to encode knowledge
� Nodes are: objects, concepts, events
� Arcs are: relationships between nodes
� Graphical depiction associated with semantic networks is a big reason for their popularity
CSE Dept., JNV University
Nodes and Arcs
� Arcs define binary relations which hold between objects denoted by the nodes.
Sue John 5
Max34
mother age
fatherage
wifehusband
mother (john, sue).
age (john, 5).
wife (sue, max).
age (max, 34).
…age
Corresponding Predicates:
CSE Dept., JNV University
Non-binary relations
� We can represent the generic GIVE event as a relation involving three things: � A giver
� A recipient
� An object
Mary GIVE John
book
recipient giver
object
CSE Dept., JNV University
Inheritance
� Inheritance is one of the main kind of reasoning done in semantic nets
� The ISA (is a) relation is often used to link a class and its super-class.
� Some links (e.g. haspart) are inherited along ISA paths
� The semantics of a semantic net can be relatively informal or very formal (Often defined at the implementation level)
Bird
Robin
Rusty
isa
Red
isaisa
Animal
isa
WingshasPart
CSE Dept., JNV University
NETWORKS & MEANING
•Concepts can be represented as hierarchies of interconnected concept nodes (e.g. animal, bird, canary)
•Any concept has a number of associated attributes at a given level( e.g. animal --> has skin; eats etc.)
• Some concept nodes are super-ordinates of other nodes (e.g. animal >bird) and some are subordinates (canary< bird)
•For reasons of cognitive economy, subordinates inherit all the attributes of their super-ordinate concepts
• Some instances of a concept are excepted from the attributes that help
[humans] to define the super-ordinates (e.g. ostrich is excepted from flying)
•Various [psychological] processes search these hierarchies for information
about the concepts represented
CSE Dept., JNV University
Parts of a semantic representation
� 4 parts
1. Lexical-which symbols are allowed in the representation’s vocabulary
2. Structural-describes constraints on how the symbols can be arranged
3. Procedural-specifies the access procedures (to create, modify, answer questions)
4. Semantic-establishes the way of associating the meaning
CSE Dept., JNV University
Semantic nets convey meaning
� Lexical parts – nodes to denote objects, links denote relation between objects, link-labels denote particular relations
� Structural-nodes are connected to each other by links.
� Procedural- procedures are : constructor procedure, reader procedure, writer procedure, and erasure procedure
� Semantic-nodes and links denote application specific entities
CSE Dept., JNV University
a n im a ls k i n
f i s h
s w im m in g
b i r d
f l y i n g
f e a t h e r s
p e n g u in c a n a r y r o b i no s t r i c h
w a lk i n g
O p u s
T w e e t y
y e l l o w
r e d
w h i t e
c o v e r e d _ b y
t r a v e l s _ b y
i s ai s a
i s a i s a i s a i s a
c o v e r e d _ b y
t r a v e l s _ b y
t r a v e l s _ b y
t r a v e l s _ b y
i n s t a n c e _ o f
i n s t a n c e _ o f
c o l o u r
c o l o u r
c o l o u r
CSE Dept., JNV University
A Hierarchical Network
birdcan fly, has wings,
has feathers
salmonlays eggs; swims upstream,
is pink, is edible
ostrichruns fast, cannot fly,
is tall
canarycan sing, is yellow
fishcan swim, has fins, has gills
animalcan breathe, can eat,
has skin
is-a
is-a
is-a
is-a
is-a
CSE Dept., JNV University
•From the above taxonomic organisation of knowledge about a number of
different animals, one can conclude, by ‘inheriting properties down the
taxonomy’, that canaries, ostriches and salmon all have skin and can breathe.
•But we as humans can also make exceptions to inherited properties in that we
can represent an non-flying bird in a (sub-) hierarchy of birds by simply noting
the exception, 'can't fly'. Like, in the case of Ostrich.
animalcan breathe, can eat,
has skin
birdcan fly, has wings,
has feathers
salmonlays eggs; swims upstream,
is pink, is edible
ostrichruns fast, cannot fly,
is tall
canarycan sing, is yellow
fishcan swim, has fins, has gills
is-a
is-a
is-a
is-a
is-a
CSE Dept., JNV University
Collins and Quillian carried out a number of tests on human subjects and found that
individuals recognise propositions lower down the hierarchy (canary is a yellow bird)
more readily than propositions higher up the hierarchy (canary has skin).
animalcan breathe, can eat,
has skin
birdcan fly, has wings,
has feathers
salmonlays eggs; swims upstream,
is pink, is edible
ostrichruns fast, cannot fly,
is tall
canarycan sing, is yellow
fishcan swim, has fins, has gills
is-a
is-a
is-a
is-a
is-a
CSE Dept., JNV University
A semantic network is a structure for representing knowledge as a pattern of
interconnected nodes and arcs. Nodes in the net represent concepts of entities,
attributes, events, values. Arcs in the network represent relationships that hold between the concepts.
animalcan breathe, can eat,
has skin
birdcan fly, has wings,
has feathers
salmonlays eggs; swims upstream,
is pink, is edible
ostrichruns fast, cannot fly,
is tall
canarycan sing, is yellow
fishcan swim, has fins, has gills
is-a
is-a
is-a
is-a
is-a
CSE Dept., JNV University
Multiple Inheritance
� A node can have any number of super-classes that contain it, enabling a node to inherit properties from multiple parent nodes and their ancestors in the network. Some times it may cause conflicting inheritance.
RQ
N
P ? !P
CSE Dept., JNV University
Advantages of Semantic nets
� Easy to visualize
� Formal definitions of semantic networks have been developed.
� Related knowledge is easily clustered.
� Efficient in space requirements
� Objects represented only once
� Relationships handled by pointers
CSE Dept., JNV University
Disadvantages of Semantic nets
� Inheritance (particularly from multiple sources and when exceptions in inheritance are wanted) can cause problems.
� Facts placed inappropriately cause problems. � No standards about node and arc values
CSE Dept., JNV University
Knowledge Representation
using Frames
CSE Dept., JNV University
Frames� Devised by Marvin Minsky, 1974.
� Incorporates certain valuable human thinking characteristics:
� Representation of stereotypes situations
� The essence of this form of knowledge representation is typicality, with exceptions, rather than definition.
CSE Dept., JNV University
� Frames are semantic net with properties
� A frame represents an entity as a set of slots (attributes) and associated values
� A frame can represent a specific entry, or a general concept
� Frames are implicitly associated with one another because the value of a slot can be another frame
� The idea of frame hierarchies is very similar to the idea of class hierarchies found in object-orientated programming.
Frames and Inheritance
CSE Dept., JNV University
Organization of frames
� A frame system is a hierarchy of frames
� Each frame has:� a name.
� slots: these are the properties of the entity that has the name, and they have values. A particular value may be:
� a default value� an inherited value from a higher frame� a procedure, called a daemon, to find a value� a specific value, which might represent an exception.
CSE Dept., JNV University
Organization..
� In the higher levels of the frame hierarchy, typical knowledge about the class is stored.
� The value in a slot may be a range or a condition.
� In the lower levels, the value in a slot may be a specific value, to override the value which would otherwise be inherited from a higher frame.
� An instance of an object is joined to its class by an 'instance_of' relationship.
� A class is joined to its superclass by a 'subclass_of' relationship.
CSE Dept., JNV University
Organization …
� Frames may contain both procedural and declarative knowledge.
� Slot values normally amount to declarative knowledge, but a daemon is in effect a small program. So a slot with a daemon in it amounts to procedural knowledge.
� A frames system may allow multiple inheritance but, if it does so, it must make provision for cases when inherited values conflict.
CSE Dept., JNV University
Frames: some examples
� We start with a simple piece of information: there is a category of things called cars.
� Given this information, we can start to build a frame:
Name: car Subclass of: thing
CSE Dept., JNV University
Name: car Subclass of: thing
Slots:
Name: Value: Restrictions:
wheels 4
moved by engine
fuel ? petrol or diesel
car subclass_of
thing
with
wheels: 4,
moved_by:
engine,
fuel:
[value:
unknown,
type:
[petrol,diesel]].
� Add More information: a car has 4 wheels, is moved by an engine, and runs on petrol or diesel.
� Now add three slots to the frame.
� Last of these has a restriction rather than a specific value.
CSE Dept., JNV University
Name: VW Subclass of: car
Slots:
Name: Value: Restrictions:
made in Germany
‘VW’ subclass_of
car
with
made_in:
‘Germany’.
� We can add a second frame to our system, with one slot. We do not need to repeat the slots and values in the previous frame: they will be inherited.
� Add More information: there is a particular type of car called a VW, manufactured in Germany.
CSE Dept., JNV University
Name: Golf Subclass of: VW
Slots:
Name: Value: Restrictions:
top sunroof
‘Golf’ subclass_of
VW
with
top: sunroof.
� More information: there is a particular type of VW called a Golf, which has a sun-roof.
� We can add a third frame to our system, with one slot. Once again, we don’t repeat the slots in the previous frames, becausethey will be inherited.
CSE Dept., JNV University
Add 4th frame: “there is a particular type of Golf called a TDi, which runs on diesel, has 4 cylinders,
and has a 1.8 litre engine.”
Name: TDi Subclass of: Golf
Slots:
Name: Value: Restrictions:
fuel diesel
engine
capacity 1.8 litres
cylinders 4
‘TDi’ subclass_of
‘Golf’
with
fuel: diesel,
engine_capacity:
1.8,
cylinders: 4.
CSE Dept., JNV University
�Title � AI. A modern Approach
�Author � Russell & Norvig
�Year � 2003
Slot � Filler
Book Frame
frame name
attributes (slots)
values (fillers: list of values, range, string, or procedures etc.)
components of a frame
CSE Dept., JNV University
Inheritance� Similar to Object-Oriented programming paradigm
�what � room
�where �hotel
�contains�
�hotel chair
�hotel phone
�hotel bed
Hotel Room �what � chair
�height �20-40cm
�legs � 4
Hotel Chair
�what � phone
�billing � guest
Hotel Phone
�what � bed
�size �king
�part �mattress
Hotel Bed
�price �INR.1000
Mattress
CSE Dept., JNV University
Summary:Features of Frame Representation
� More natural support of values then semantic nets (each slots has constraints describing legal values that a slot can take)
� Frame may describe instances or classes
� A special slot, the Is-a slot, short for is-a-member-of-the-class, ties instances to the class that they are member of.
� Another special slot, ako slot, short of a-kind-of, ties classes together.
� Can be easily implemented using object-oriented programming techniques
� Inheritance is easily controlled
CSE Dept., JNV University
Frames have access procedures
� Needed to manipulate instances and classes
� A class constructor: makes a frame that has one direct super-class
� An instance constructor: makes instance frames. Input is name of the class to which the instance belongs. New instance is connected to class by is-a slot.
� A slot writer: installs slot values. Its input is the name of the frame, the name of slot, and value.
� A slot reader: retrieves slot values. Its input is frame name, slot name, and output corresponding value.
CSE Dept., JNV University
Advantages of Frames
� Makes programming easier by grouping related knowledge
� Easily understood by non-developers
� Expressive power
� Easy to set up slots for new properties and relations
� Easy to include default information and detect missing values
CSE Dept., JNV University
Drawbacks of Frames
� No standards (slot-filler values)
� More of a general methodology than a specific representation:
� Frame for a class-room will be different for a professor and for a maintenance worker
� No associated reasoning/inference mechanisms
Top Related