0% found this document useful (0 votes)
9 views23 pages

2 - Knowledge Representation

Knowledge representation in artificial intelligence involves encoding symbolic structures to reflect human knowledge, enabling inference and deduction. It distinguishes between data, information, and various types of knowledge, such as procedural and declarative knowledge. Methods of knowledge representation include rules, semantic networks, and frames, each with its own advantages and challenges in accurately reflecting and manipulating knowledge.

Uploaded by

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

2 - Knowledge Representation

Knowledge representation in artificial intelligence involves encoding symbolic structures to reflect human knowledge, enabling inference and deduction. It distinguishes between data, information, and various types of knowledge, such as procedural and declarative knowledge. Methods of knowledge representation include rules, semantic networks, and frames, each with its own advantages and challenges in accurately reflecting and manipulating knowledge.

Uploaded by

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

Knowledge Representation

1. KNOWLEDGE REPRESENTATION
One of the assumptions underlying most work in artificial intelligence is that intelligent
behaviour can be achieved through the manipulation of symbolic structures representing bits
of knowledge. For example, we could use the symbol red to denote a particular colour, the
symbol johns-car to denote John’s car, and the symbolic structure red(johns-car) to denote
the fact that John’s car is red. An AI program could use this fact and maybe draw
conclusions about the personality of the owner.

In an expert system, the knowledge base stores the information about the subject domain.
The information is not a collection of records and fields as in a database but rather a symbolic
representation of the knowledge of a human expert. The information is in a format that
allows the inference engine to perform deductions based on the knowledge.

One of the problems with deciding on a method of knowledge representation is that there is a
mismatch between the way a human thinks and the way a computer structures information
internally. The problem is thus one of knowing how to encode knowledge so that it is a faithful
reflection of what a person knows and so that the computer can manipulate it.
1.1 What Is Knowledge?

Before we can discuss the representation of knowledge in a knowledge base we need to have
a clear idea of what knowledge is and how it differs from data or information. Consider the
following definitions:

 Data is an unstructured set of numbers, facts or symbols. Data can convey


information only if it is within some structure or is decoded in some way. The data
itself carries no information.

 Information, on the other hand, always has a context. If you say '1000', that is data.
If you say '1000 isobars at noon in Port Elizabeth' you are conveying information.

 Knowledge goes a step further. An example of knowledge might be 'Most people


feel better when the pressure rises above 1000'.

Knowledge is a guide to informed practise. Knowledge and information are very close to each other
in character, with one major difference; information is processed but knowledge is understood.
John Durkin defines knowledge as “understanding of a subject area” (1994, p. 53). Knowledge is
concerned with using information effectively. Effective use of knowledge can lead to the formation
of plans of action and to deeper understanding.

There exist several types of knowledge. In fact there is even a field of study, called epistemology,
which is a study of knowledge and its nature, structure and origins. Most knowledge can be classified
as one of the following:

 Procedural knowledge is knowledge about how to do something.

 Declarative knowledge refers to knowing that something is true or not.

 Tacit knowledge is often also called unconscious knowledge because it cannot be


easy expressed in a language. An example of this would be knowing how to move
you hand. Most of us know this, but do we really know how? It’s easy to say you
simply tighten or relax some muscles and tendons, but how do we do that?

 Meta-knowledge is knowledge about knowledge.

 Heuristic knowledge describes a rule-of-thumb and is often also called shallow


knowledge.
 Structural knowledge describes knowledge structures, the overall mental model of a
problem.

 Causal knowledge describes knowledge about cause and effect.

Below are some examples to demonstrate the differences between data, information and the
different types of knowledge:

 TOMATOES, RED, SEEDS, 10, 5 – data

 10 RED TOMATOES – information

 TOMATOES ARE RED – declarative knowledge

 IF YOU CUT A TOMATOE YOU CAN SEE THE SMALL SEEDS INSIDE –
causal knowledge

 IN ORDER TO ADD TWO FRACTIONS, YOU MUST FIRST MAKE THE


DENOMINATORS EQUAL - procedural knowledge

There are often exceptions or contradictions to the rules. For example, most of us would be able to
identify green tomatoes even though we might say that tomatoes are red.

Knowledge can be absolute or it can be relative or uncertain. If the doctor says that a child has
measles because he is running a high temperature and has spots, he is probably right. We can assign
certainty factors to some knowledge to indicate to what degree we believe the statement. We can
say, for example, that if a child is running a high temperature and he has spots then the chance that
he has measles is 80%. If he has been in contact with someone recently who had measles then that
probability can be increased. If he has had a measles injection as a baby then the chance that he has
measles is decreased.

Humans are able to identify the boundaries or scope of their knowledge fairly quickly although they
might sometimes feel that some aspect is "on the tip of their tongue". If you are asked to look up
the telephone number of the author William Shakespeare you will probably say that this is
impossible and why. The computer, however, unless it knows that telephones were not invented
then could spend some time looking for the telephone number. Computers cannot cater for general
knowledge, and we, as knowledge engineers, should always remember that.

We can measure the quality of knowledge on the following dimensions (Forsyth, 1990):
 Scope - what does it cover?
 Granularity - how detailed is it?
 Uncertainty - how certain or plausible is it?
 Completeness - are our conclusions correct even if we get more knowledge?
 Consistency - are there contradictions and can we live with them?

1.2 What Is Knowledge Representation?

Knowledge representation is one of the most central and, in some ways, most familiar concepts in
AI. Knowledge representation for expert systems can be defined as “the method used to encode
knowledge in an expert system’s knowledge base” (Durkin, 1994). This representation must be
capable of being manipulated in order to make deductions and generate new knowledge.

1.2.1 The Roles of Knowledge Representation

To understand what knowledge representation is, and to better understand some of its
advantages and disadvantages, we will examine the five different roles that a representation
follows and what that means for us as knowledge engineers.

1.2.1.1 Knowledge Representation is a Surrogate

Reasoning is a process that goes on internally, but most things an intelligent being would want to
reason about exist only externally. This fact is a fundamental rational and role for a representation.
Instead of using the “thing” itself in our reasoning processes, we use a representation or a surrogate
(a surrogate is a substitute for the real thing). Thus, in our reasoning process we think about
consequences certain actions on an object would have instead of performing those actions directly
on the object. Unfortunately this representation of an object we use is always less complete than
the object itself. The only completely accurate representation of an object is the object itself. All
other representations are inaccurate; they inevitably contain simplifying assumptions and, possibly,
artefacts (Davis, Shrobe & Szolovits, 1993). This means that regardless of how we choose to
represent knowledge it will always be flawed. A good representation is one that minimizes the
errors for the specific task at hand.

1.2.1.2 Knowledge Representation is a Set of Ontological Commitments


We said that all representations are imperfect approximations to reality and that we have to
choose a representation that minimizes the error for the specific task at hand. This also means
we are also at the same time making a set of decisions about how and what to see in the
world. Thus, we are determining what parts are important in our representation and what
parts not. This means we are enforcing our own ontologies onto the system.

1.2.1.3 Knowledge Representation is a Fragmentary Theory of Intelligent Reasoning

Knowledge representation is also a fragmentary theory of intelligent reasoning because the


initial conceptualisation of a representation is typically motivated by some insight into how
people reason intelligently. The theory is fragmentary (or broken) because:

1. the representation typically incorporates only a small part of the beliefs that motivated
it, and

2. this insight or belief is only a small part of the phenomenon of intelligent reasoning in
general.

This “theory” is often implicit but can be made more evident by examining its three components,
namely:

 The representation’s fundamental conception of intelligent inference


 The set of inferences that the representation sanctions
 The set of inferences that it recommends

1.2.1.4 Knowledge Representation is a Medium for Pragmatically Efficient


Computation

From a purely mechanistic view, reasoning in machines is a computational process. To use a


representation we must compute with it. As a result, questions about computational efficiency are
inevitably central to the notion of representation.

1.2.1.5 Knowledge Representation is a Medium of Human Expression

Lastly, knowledge representation is also the means by which we express things about the world and
is thus a medium of human expression.
1.3 Methods of Knowledge Representation

Now that you know what knowledge representation is we can examine how we make use of
it. A number of different representation techniques exist. These include, amongst others:

 Rules
 Semantic nets
 Frames
 Object-attribute-value triplets
 Scripts
 Logic systems
 Knowledge representation languages
 Conceptual graphs

1.3.1 Rules

One of the most popular ways to represent knowledge in expert systems is by using rules. Rule-
based systems use production rules to encode the knowledge. A rule is defined as “a knowledge
structure that relates some known information to other information that can be concluded or
inferred to be known.” (Durkin, 1994) These rules normally have the following form:

IF <condition> THEN <action>


We can have multiple conditions or actions, i.e.:

IF P1 & P2 & ... Pn THEN Q1 & Q2

It is important to note that conjunctive (AND) and disjunctive (OR) clauses hold in rules. Examples of
such rules for an expert system that recommends the correct wine to have with your meal are:

Rule 1: IF has-sauce = yes

AND sauce = spicy

THEN best-body = full

Rule 2: IF tastiness = delicate

THEN best-body = light cf 80

Rule 3: IF tastiness = average

THEN best-body = light cf 30

AND best-body = medium cf 60

AND best-body = full cf 30

Rule 4: IF tastiness = strong

THEN best-body = medium cf 40

AND best-body = full cf 80

Rule 5: IF has-sauce = yes

AND sauce = cream

THEN best-body = medium cf 40

AND best-body = full cf 60

Rules can be used to represent many different types of knowledge, for example:

 Relationship
IF the battery is dead

THEN the car will not start


 Recommendation
IF the car will not start

THEN take a taxi

 Directive
IF the car will not start

AND the fuel system is ok

THEN check out the electrical system

 Strategy
IF the car will not start

THEN first check out the fuel system then check out the electrical system

 Heuristic
IF the car will not start

AND the car is a 1957 Ford

THEN check the float

Rules can also be categorized according to the nature of the problem-solving paradigm:

 Interpretation Problem
IF voltage of resistor R1 > 2.0 volts

AND the collector voltage of Q1 < 1.0 volts

THEN the pre-amp section is in the normal range

 Diagnosis Problem
IF the main organism is grampus

AND the morphology of the organism is coccus

AND the growth of the organism is chains

THEN there is evidence that the organism is streptococcus

 Design Problem
IF current task is to assign a power supply

AND the position of the power supply in cabinet is known


AND there is space available is the cabinet for the power supply

THEN put the power supply in the cabinet


Rules can also be variable. This approach is one used extensively in M.4 VB, an expert
system development shell. For example, consider the following rule:

IF John Smith is an employee

AND John Smith’s age > 65

THEN John Smith can retire

Instead of the rule above, it would make more sense to have a rule like this one:

IF X is an employee

AND X’s age > 65

THEN X can retire

(where the X represents a variable that can be instantiated to any employee as needed.)

1.3.2 Semantic Networks

Semantic networks (also called associative networks) represent objects and the relations between
objects in a domain. They are a method of knowledge representation using a directed graph made
up of nodes and arcs, where the nodes represent objects and the arcs represent the relationships
between the objects (Durkin, 1994).
Figure 3-1: An Example of a Semantic Network
Thus, semantic networks use nodes and arcs to provide a graphical view of a problem’s objects,
properties and relationships. Both nodes and arcs have labels that clearly describe the objects and
relationships represented.

The ISA (Is A) relationship is a term to show when one item is a type of another one. Another type
of relationship is the AKO (A Kind Of ) relationship. We can retrieve information from the above
semantic network such as the fact that birds fly. We can deduce other facts like, Ross is a seagull.
We say Ross ISA seagull, however a seagull is AKO bird. AKO indicates a category instead of a specific
thing. An important characteristic of semantic nets is the fact that they support inheritance. This is
best illustrated by looking at the following diagram.

Figure 3-2: An Example of Inheritance in Semantic Networks

Semantic networks offer a simple way of representing knowledge but they have a few
problems:

 It is difficult to pick the right set of items in the beginning and it is then difficult to
add new items later as one must link them to the existing nodes.

 Networks cannot make a distinction between, for example, a particular book, all
books or no books, etc. It is difficult to express knowledge of the sort:

Some computers have DVD drives.

All the directors approved most of the figures.

 The meaning of nodes and links is often bound up with the retrieval and inference
capabilities of the system. People are not always particular about how they assigned
meanings to nodes.
 Searches for knowledge are not knowledge-based. There is nothing to tell you how to
go about searching for the knowledge needed.

 It is difficult or impossible to represent negation or exclusivity that leads to gaps in


knowledge that could have shown that your search should fail.

 Semantic nets are logically inadequate because they cannot define knowledge in a
way that logic can.

1.3.3 Frames

Frames are an extension to semantic networks. Nodes are replaced by more structured groupings of
information. Many frame systems organise the frames in a hierarchical manner so that they can
represent classes and subclasses. Each node in a frame network is a detailed description of what an
object is, for example, a frame about a bird might include knowledge that is has legs and wings, and
how it hunts for food. Frames can be defined as “a data structure for representing stereotypical
knowledge of some concept or object.” (Durkin, 1994) The diagram below gives a simple
hierarchical representation for classifying animals:

Figure 3-3: An Example of Frames


Each node in this hierarchy could consist of a frame containing the following information:

NAME:
Breathes:
Colour:
Number of legs:
Number of wings:
Fly:
Size:

The Mammal node might only have the following information:

NAME: Mammal
AKO: Animal
Breathes:
Number of wings: 0
Fly: No

The AKO slot is used to show that a mammal is a kind of (AKO) animal. The Breathes slot is not
filled in because all animals breathe and the mammal is AKO (a kind of) animal. Therefore, it inherits
all of the attributes of an animal.

The Elephant node might have the following information:

NAME: Elephant
AKO: Mammal
Breathes:
Colour: Grey
Number of legs: 4
Number of wings:
Fly:
Size: Large
The fact that it breathes, has no wings and cannot fly is inherited from its relationship to Mammal.
Big Foot, an African Elephant who lived in the Addo Elephant Park would, in turn, inherit all the
attributes of Elephant. We could add slots for him to show where he lived, etc. Dumbo, however, is
a problem. He was an elephant who could fly and elephants cannot fly. Frames allow one to cater
for such contradictions, as shown below:

NAME: Dumbo
ISA: Elephant
Colour:
Number of legs:
Number of wings:
Fly: Yes
Size: Large

All one needs to do is fill in the Fly slot with Yes for Dumbo. Note that the frame system will only try
to get a value by inheritance if the value is not filled in.

We can allow an item to inherit information from more than one parent. Assume that we are
storing information about Quakers religion and Republican political party. This is illustrated below:

NAME: Quaker NAME: Republican

: :
Pacifist: Yes Pacifist: No

Now, consider former US President Richard Nixon. He was both a Quaker and a Republican. Should
he inherit the Yes from Quaker or the No from Republican?

NAME: Richard Nixon


ISA: Quaker
ISA: Republican

:
Pacifist: ???
Some inheritance schemes draw no conclusion if there is conflicting evidence while others allow
multiple conclusions. Thus, be careful that you cater for these in your systems.

Demons are procedures that are attached to the data structures. A demon would perform a function
similar to that of methods in an object-oriented design. As an example, we could have the following
hierarchical representation of polygons:

Figure 5-4: A Hierarchical Representation of Geometric Figures

Each node has the following slots:

NAME:
Number of sides:
Length of sides:
Size of angles:
Area:

An algorithm that allows one to calculate the area given the appropriate information could fill
the slot for area. The area slot would then be filled with a demon. The procedure can be
inherited as needed although new demons can be given for rectangles or squares as the
procedure simplifies.
1.3.4 Object-Attribute-Value Triplets

In expert systems, facts are used to help describe parts of frames, semantic networks or rules. They
are also used to describe relationships between more complex knowledge structures and to control
the use of these structures during problem solving. A fact, in both expert systems and general AI, is
often called a proposition. A proposition is a statement that is either true or false, for example, “it is
raining.” In an expert system we assert in the working memory the Boolean truth value of this
statement and then use it in processing other knowledge.

An Object-Attribute-Value (O-A-V) is a more complex type of proposition. It divides a given


statement into three distinct parts: object, attribute and value. These are modelled using a diagram
like that shown in the following example:

Figure 3-5: An Example of an O-A-V Diagram

One object can also have multiple attributes and values, as shown below:

Figure 3-6: An Example of an O-A-V Diagram with Multiple Attributes and Values
1.3.5 Scripts

Scripts are another object-oriented approach (Black, 1986). It is thought that understanding
requires not only a conceptual memory but also higher-level memory structures. They contain
sequences of typical events organised around particular human activities. Going to a restaurant
might, for example, include the following actions:

Being shown to the table,

reading the menu,

ordering the food,

waiting for the meal,

having the food brought by the waiter,

eating the food,

receiving the bill,

paying, and

leaving.

These actions can be coded in some way. Consider the following:

“John went to a restaurant. The waiter came to him. He ordered lobster. When the cheque
came, John paid it and left a large tip. He then left the restaurant.”

Given the above story, we can infer that "John ate lobster". This is called script instantiation where
the system tries to instantiate all the variables used in the script and make plausible inferences from
this. Note that syntactic rules are also necessary to determine, for example, who "He" is in the story.

1.3.6 Logic Systems

Logic is a powerful tool in an AI researcher's hands. Logic languages are used to represent
information and to reason with that information. At the lowest levels logic systems form the basis of
all computer science.

1.3.6.1 Propositional Calculus


Propositional calculus is the simplest form of logic language. The syntax is fairly easy to understand
(Forsyth, 1990). Each statement is labelled and manipulated as an individual element, called an
atomic proposition. The statement "The book is on the table" might be given the value P while the
statement that "The cup is on the table" would be given the value Q. Thus:

P = The book is on the table.

Q = The cup is on the table.

In order to evaluate whether or not the book is on the table we now have to determine whether the
symbolic variable P is true or false. The atomic propositions can be combined using logical
connectives to form complex statements called sentences or well-formed formulas (wffs). The
connectives used include:

Operator Symbol

AND 

OR 

NOT 

IMPLIES , 

EQUIVALENCE 

Table 3-1: Logic Operators and Symbols

Consider the following example:

John is a human

if John is a human then John is mortal

therefore

John is mortal.
In logic, this would be expressed in one of the following forms:

P P

PQ PQ P PQ

therefore Q Q

Truth tables define the semantics of sentences. For example, consider the following:

(P  Q) The book is on the table AND the cup is on the table.

(P  Q) == ~(~P  ~Q) The book is on the table OR the cup is on the table is equivalent to...

The second is difficult to describe in words. We can draw a truth table to determine the
validity of the statement, however.

P Q PQ ~P ~Q ~P  ~Q ~ (~P  ~Q)

T T T F F F T

T F T F T F T

F T T T F F T

F F F T T T F

Table 3-2: Truth Table

In the above table note that P  Q == ~(~P  ~Q).

Propositional calculus allows one to represent knowledge in a complete and sound method. It
has a sound mathematical background for reasoning. It has some limitations, however. We
cannot capture generalisations and relationships between propositions, for example “most of
the class received A’s.”
1.3.6.2 Predicate Calculus

Predicate calculus addresses some of the limitations of propositional calculus (Forsyth, 1990). Facts
are represented as a combination of predicate and argument. Consider the following examples:

Example Meaning

on(book,table) The book is on the table

on(cup,table) The cup is on the table

on(X,table) X is on the table

Table 3-3: Predicate Calculus Examples

In the first example, on is a predicate name, and book and table are arguments, giving the atomic
statement on(book, table). The last example in the table is a general statement. X may be
“instantiated” or given the value of any object that is on the table. Note that, as with propositional
logic, we can use logical connectives to combine atomic sentences into sentences.

Statements like “Nellie likes apples” are easily expressed in predicate calculus. You simply use the
verb as the predicate name and the nouns as the arguments, to get likes(nellie, apples). A statement
describing a property of an individual, such as “Nellie is large”, can also be easily expressed. The
convention is to make this into a one-argument predicate, such as large(nellie). If Nellie is both large
and hairy, the logical connectivemust be used: large(nellie)hairy(nellie). Similarly, if Nellie
likes both apples and bananas: likes(nellie, apples)likes(nellie, bananas). Note that logical
connectives cannot be used within an argument of a predicate, so likes(nellie, applesbananas) is
invalid.

Statements of the form “if X then Y” can be translated into X Y. So, “If Nellie is hungry then he
eats apples and bananas” could be: hungry(nellie) eats(nellie, apples)eats(nellie, bananas).
And to assert that something is not true, ~ is used: ~likes(nellie, oranges).
Predicate calculus also has two standard quantifiers, called universal and existential:

Quantifier Symbol Read As

ALL  “For all”

EXISTS  “There exists”

Table 3-4: Predicate Calculus Quantifiers

For example, if P represents “elephants are mammals” we can state the following:

Example Meaning

(x) (elephant(x)  mammal(x)) All elephants are mammals

( x) (elephant(x)mammal(x)) Some elephants are not mammals

( x) (elephant(x)mammal(x)) Some elephants are mammals

(x) (elephant(x)  ~mammal(x)) No elephants are mammals

Table 3-5: Predicate Calculus Examples

Quantifiers allow us to make statements about all values of X or to say that at least one X occurs
with a particular property. This is illustrated in the first two of the final examples shown below:

Example Meaning

(x) (on(x,table))  ~heavy(x) For every value of x, if x is on the table then x is not
heavy

( y) (logician(y)) There is some value of y for which the statement “y


is a logician” holds

(x) (y) (x + y = y + x) For every x and for every y, the sum of x and y
equals the sum of y and x

( x) (elephant(x)name(Clyde)) There is some elephant with the name Clyde

(x) (elephant(x) four-legged(x)) All elephants are four-legged

( x) (elephant(x)three-legged(x)) Some elephants are three-legged

(x) (person(x)  y) loves(x,y)) Every person has something that they love
Table 3-6: Predicate Calculus Examples

Note that a sentence should have all its variables quantified. So, the expression (x) (loves(x,y)) is
not a valid sentence on its own as variable y is not quantified.

Logic has clear semantics. One can determine exactly the meanings of the expressions. One can
also make some very expressive logic statements. However, there are some types of statements
that cannot even be expressed in predicate logic using the universal and existential quantifiers. For
example, the statement ”Most of the class received A’s” cannot be expressed in predicate logic
(where “Most” means more than half). To implement Most, the logic system must provide some
predicates for counting, as in fuzzy logic (discussed later). Another limitation of predicate logic is in
expressing things that are sometimes true but not always true (e.g. “Apples are red”), facts that
involve uncertainty (e.g. “It will probably rain tomorrow”), defaults (e.g. “It normally rains in
Glasgow”), beliefs (e.g. “John believes it will rain”), and time/change (e.g. “It will get wetter and
wetter as you near Glasgow”). Some of these problems can also be solved by fuzzy logic. However,
introducing more complex logic also introduces more complications into the logic system and makes
it more like mathematics.

1.4 Structured Objects vs Production Rules

The following describes the essential differences between structured objects and production rules:

 Structured objects represent the world in a more analogical way. Instead of the
knowledge about a domain being scattered among the rules that use it, the knowledge
is packaged in one place.

 Objects are viewed in relation to other objects, whereas rules can be created in
isolation and can be added to the knowledge base without regard for the other rules in
the knowledge base.

 When building a rule-based system you focus on the rules to solve the problems and
how to group them. When building an object-oriented system you focus on
describing the objects in the expert’s world, their components and their relationships,
not rules and procedures.

 Objects are organised with their associated descriptions and procedures. They control
their actions locally. Inferencing in production systems and logic systems are usually
controlled from a global level.
 Inferencing in object-oriented systems is by inheritance. Objects belong to classes
and inherit the general characteristics of the classes to which they belong. Default
characteristics can be specified and also overridden to handle exceptions. This type of
inferencing is difficult with production systems and probably impossible with logic
systems.

1.5 Frames vs Logic

The following are some of the factors that should be considered when choosing between frames and
logic to represent knowledge:

 Everything in a frame system can be translated into predicate logic, but not vice versa.

 Frames have a weaker representational adequacy (i.e. the ability to represent all the
knowledge you need to reason with) than logic. However, you gain inferential
efficiency (i.e. the ability to make inferences efficiently) by reasoning with a
restricted subset, so this often make frames worthwhile.

 Predicate logic is more powerful than structured objects, but some facts may be less
clear and more difficult to work with.

You might also like