Professional Documents
Culture Documents
CHAPTER 2
KNOWLEDGE REPRESENTATION
INTRODUCTION__________________________________________ 1
SEMANTIC NETWORK_____________________________________ 3
DECISION TREE _________________________________________ 6
FRAME_________________________________________________ 7
PRODUCTION RULE ______________________________________ 9
FORWARD CHAINING __________________________________ 10
BACKWARD CHAINING _________________________________ 11
PRACTICE MAKES PERFECT ______________________________ 12
2:0
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
2 KNOWLEDGE REPRESENTATION
INTRODUCTION
Definition
Wisdom Using knowledge in a beneficial way
om
sd
Wi Meta- Knowledge about knowledge.
ta- e knowledge
Me ledg
ow
A collection of information that has been
kn organized and analyzed to make it
understandable and applicable to problem
ge Knowledge
ed
owl solving.
K n
Consists of symbols, relationship between
on them and rules or procedures for
ati
rm manipulating them.
I nfo
Rules about using information.
Data organized so that it is meaningful to
Information
ta the person receiving it.
Da
ise
No Potentially useful information.
Data Numeric/alphanumeric string that by
themselves do not have any meaning.
Knowledge can be classified into procedural knowledge, declarative knowledge and tacit
knowledge.
Procedural knowledge is often referred as knowing how to do something. An example of
procedural knowledge is knowing how to boil a pot of water.
Declarative knowledge refers to knowing that something is true or false. Is it concerned
with knowledge expressed in the form of declarative statements such as “Do not put your
fingers in a pot of boiling water”.
Tacit knowledge is sometimes called Unconscious knowledge because it cannot be
expressed by language. An example is knowing how to move your hand. On a gross scale, you
might say that you move your hand by tightening or relaxing certain muscles and tendons. But
at the next lever, how do you know how to tighten or relax the muscles and tendons? Other
examples are walking or riding a bicycle.
Other types of knowledge are meta-knowledge that describes knowledge about knowledge,
heuristic knowledge that describes rules of thumb that guides the reasoning process while
structural knowledge that describes an expert overall mental model of the problem.
Knowledge representation (KR) is the way that knowledge is stored in a program. It implies
a systematic way to store the information and coded into the program. Three common
characteristics of KR schemes are:
2:1
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
i. Existing computer languages can be used and the knowledge is stored in memory.
ii. The stored knowledge and facts can be used in reasoning.
iii. The predominate knowledge representation schemes are frames and production
rules.
What to represent?
Explanation Example
Object Facts about objects in our world Guitars have single strings, trumpets
domain. are brass instruments.
Events Actions that occur in our world. Steve Vai played the guitar in Frank
Zappa’s Band.
Performance A behavior like playing the guitar Steve Vai played the guitar using his
involves knowledge about how to do left hand, Sally can type 50 words
things. per minute, etc.
Meta-knowledge Knowledge about what we know Steve Vai is a professional guitarist
because he was born in a guitarist
family, etc.
Properties of KR:
i. Adequate to express all of the necessary information.
ii. Support efficient execution of the resulting code.
iii. Provide a natural scheme for expressing the required knowledge.
2:2
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
SEMANTIC NETWORK
Semantic network or net were first developed for AI as a way to representing human
memory. It is a graphical representation that shows the hierarchical relationship between
objects that is composed of nodes and arcs used to represent propositional information; a
statement that is either true or false, such as “a triangle has three slides.” Nodes are sometimes
referred to as objects or descriptive knowledge (attribute) about the objects while arcs as links
or edges that express a relationship between nodes that provide the basic structure for
organizing knowledge. The link can show any relationship. Without relationships, knowledge is
simply a collection of unrelated facts. With relationships, knowledge is a cohesive structure
about which other knowledge can be inferred.
Two types of commonly used links are IS_A and A_KIND_OF (AKO). IS_A means “is an
instance of” and refers to a specific member of a class. The link AKO is used to relate one class
to another. It is not used to relate a specific individual because that is the function of IS_A. The
more general class that an AKO arrow points to is called a superclass. If a superclass has an
AKO pointing to another node, then it is also a class the AKO points to. Another way of
expressing this is that an AKO points from a subclass to a class.
Another common link is HAS_A, which relates a class to a subclass. The HAS_A points
opposite to the AKO and is often used to relate an object to a part of the object. More
specifically, the IS_A relates a value to an attribute while a HAS_A relates an object to an
attribute.
Ex1 Bird is an animal. It can fly and has two wings. Penguin and canary are a kind of
bird. However, a penguin can only walk. Tweety is a canary.
Solution Animal
Fly IS_A
CAN
AKO CAN
Canary Walk
IS_A
Tweety
2:3
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
Ex2 Ann is a wife of Bill. Ann is the mother of Susan. Ann is the sister of Carol. Bill is
the father of Susan. Tom is the husband of Susan. Susan is the mother of John.
Tom is the father of John. David is the husband of Carol. Carol is the mother of
Tom. David is the father of Tom.
Solution
Another example, if we have a fact – “The chair’s color is red and priced at RM35”.
Red
color
Chair
price
RM35
2:4
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
Mammal legs 4
The objects in a class have one or more attributes in common.
Each attribute has a value. The combination of attribute and
subset
value is a property. Inheritance is important feature of a semantic
network that eliminates the need to repeat common
characteristics. Hence, it eases the task of encoding the Cat
Bill
Ali Raju
2:5
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
DECISION TREE
Decision tree is a tree in which each branch node represents a choice between number
of alternatives and each leaf node represents a decision. It is commonly used for gaining
information for the purpose of decision making. The nodes should be split recursively and the
final result is a decision tree in which each branch represents a possible scenario of decisions
and its outcome. Decision tree can simplify knowledge acquisition and are fairly easy to
translate into rules.
So what is
your yes Starter motor turns?
problem?
no
Is there fuel? no
yes
So what is
your
problem?
2:6
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
FRAME
One type of schema that has been used in many AI applications is the frame. Frames
provide a convenient structure for representing objects that are typical to a given situation such
as stereotypes knowledge (common concepts and situations). Like semantic net, frames can be
organized in a hierarchy with general concepts near the top and specific concepts placed at the
lower levels. Unlike semantic nets, each frame or node in this hierarchy can be very rich in
supplementary information, thus eliminating many of the nodes that are required in a semantic
net. A frame would be a good choice for describing a mechanical device, for example a car.
Values that describe one object are group together into single unit.
Basic frame design:
i. Name.
ii. Slots (attributes) which have values:
a. A specific value.
b. A default value.
c. An inherited value.
d. A pointer to another frame.
e. A procedure that gives the value.
iii. Each slot describes:
a. Declarative knowledge – ex. Color of the car (fixed).
b. Procedural knowledge – activate a certain rule if the value exceeds certain value.
iv. Each slot contains one or more facets.
v. Facet describes some knowledge or procedures about the attribute in the slot.
Class frame:
i. Represent the general characteristics of some of common objects.
ii. Define those properties that are common to the entire object within the class, and
possibly default property values.
iii. 2 types of properties: -
a. Static
b. Dynamic
Instance Frame:
i. Use to describe a specific instance (sub-class) of a class frame.
ii. The frame inherits both property values from the class and can be changed to tailor
the object represented in instance frame.
iii. Can create as many instances of the class and immediately inherits the class
information
2:7
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
Example of Class frame for Bird Example of Instance frame for Tweety
Like a semantic net, frame also has inheritance issue. From example, Tweety is an instance of
bird class. Like most bird, Tweety eat worms but cannot fly. Therefore, frame allows an instance
to accept the class default values or provide value unique to the instance. It can also provide
unique properties, e.g. if Tweety live in a cage.
Frame advantages:
i. Fairly intuitive for many applications.
a. Similar to human knowledge organization.
b. Suitable for causal knowledge.
c. Easy to include default information and detect missing values.
d. Easier to understand than logic or rules.
ii. Very flexible.
Frame disadvantages:
i. No standards.
ii. Frame for sub-class will be different for a superclass.
2:8
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
PRODUCTION RULE
Production rule represent knowledge in the form of condition-action pairs. Each rule implements
as autonomous chunk of expertise that can be developed and modified independently of other
rules. It can be viewed as a simulation of the expert’s cognitive behavior. Basic format for
production rule: -
IF <condition occur>
THEN <action will occur>
2:9
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
Production rule involve control strategies known as pattern matching. Pattern matching is the
matching of facts in working memory and knowledge base. It can be done in two ways; forward
chaining and backward chaining.
FORWARD CHAINING
Forward chaining is an inference strategy that begins with a set of known facts using rules
whose premises match the known facts, continues until goal reached or no more rules matches.
E.g. assume the following rules:
Rule 1 :
IF patience has sore throat
AND suspect bacterial infection
THEN believe patient has strep throat
Rule 2 :
IF patience temperature > 100
THEN patient has fever
Rule 3 :
IF patience sick for over a month
AND patient has fever
THEN suspect a bacterial infection
2:10
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
BACKWARD CHAINING
Backward chaining is an inference strategy that attempts to prove a hypothesis by gathering
supporting information. E.g. A patient visit a doctor. After listening and examining the patient,
the doctor believes patient has strep throat. Thus, the doctor has to prove his assumption.
Rule 1 :
IF there are sign of throat infection
AND there is evidence that organism
is Streptococcus
THEN patient has strep throat
Rule 2 :
IF patience throat is red
THEN there are sign of throat infections
Rule 3 :
IF stains of organisms is Grampos
AND morphology of the organism is Cossus
AND growth of the organism is chains
THEN there is evidence that the organism is Streptococcus
2:11
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
1. Rita likes ice-cream. She likes strawberry and chocolate flavors. Ice-creams are not good
for teeth. Rita has a lot of cavities. Draw: semantic net.
2. ABC hotel consists of two types of rooms, that are, standard and superior rooms. A
standard room is equipped with a king bed while a superior room is equipped with two
queen beds. All rooms have a telephone, television and hot kettle. Draw: semantic &
frame.
2:12
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
3. There are three types of birds, that are, flightless, songbird and scavenger. Penguin is a
flightless bird that lives in the south pole. Canary is a songbird that lives in the tropical.
Eagle is a scavenger that lives in North America. Tweety is a canary cartoon character
while Opus is a penguin cartoon character. Draw: semantic net.
4. The aorta is a particular kind of artery which has a diameter of 2.5 cm. An artery is a kind
of blood vessel. An artery always has a muscular wall, and generally has a diameter of
0.4cm. A vein is a kind of blood vessel but has a fibrous wall. Blood vessels all have
tubular form and contain blood. Draw: semantic net.
2:13
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
5. Mini is a robin; it lives in a nest, which is on a pine tree in Mr. Ali’s backyard. Robins are
birds; they can fly and have wings. They are endangered species, and they are protected
by government regulations. Draw: semantic & frame.
2:14
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
6. You are given a set of rules for this question: Should we buy a house or not?
b. Run backward chaining with a high inflation rate as given and the hypothesis of do
not buy a house.
2:15
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
A client has just observed that the dollar exchange rate is falling. He wants to know whether
to buy bonds. Run a forward and a backward chaining and submit a report to him.
Hypothesis: buy bonds.
2:16
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
R1: IF a person has $10,000 to invest and she has a college degree
THEN she should invest in securities.
R2: IF a person’s annual income at least $40000 AND she has a college degree
THEN she should invest in growth stocks.
The facts: We assume that an investor has $10,000 and that she is 25 years old. She
would like advice on investing in IBM stock. Run forward and backward chaining.
Hypothesis: he should invest in IBM stock.
2:17
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
2:18
MODULE – LECTURE NOTES ISP542/ITS462 KNOWLEDGE REPRESENTATION
c. Use backward chaining to find out what sets of fact would suffice to establish that an
animal was a penguin?
2:19