CSC 3301 - Principles Of Artificial Intelligence
KNOWLEDGE REPRESENTATION
Assoc. Prof. Dr. Normaziah Abdul Aziz
Semester 1 2009/2010
What is Knowledge Representation (KR)?
Knowledge – facts, information and rules that are known
in a particular field(s) that can also be used for
contextualisation on a given situation or events related.
[Please note that this definition of knowledge is from the perspective of
information fed and used in the machine / computer, nor that of the human
intellectual capacity.
The definition of Knowledge (‘ilm) in Islam is “the arrival (husul) in the soul of the
meaning of a thing or an object of knowledge. – Refer Syed Muhammad Naquib
Al-Attas, “The Concept of Education in Islam”, pp 17]
Representation –
a collection of objects that can be referred to for other
symbols or physical objects. We need representation of an object or situation
when we can’t access the “real thing or situation” itself.
to capture critical features of a problem
The Need for a Good Representation
Representation that is used to represent a problem is
important.
The way the computer represent a problem, the variables it
uses, the operators it applies to those variables.
All the above will make a difference between an efficient
algorithm and an algorithm that doesn’t work.
Examples of data representation
•Array, Lists, Stacks of data (text, numerical, etc)
•Picture point (pixel) – represent an image intensity or gray level
Example – A scenario where you dropped your contact-
lens at the football field of IIUM stadium. How can you find it?
What does it take for you to locate it?
1st representation
2nd representation
3rd representation
Same representation but different level
of granularity or refinement
Useful, efficient and meaningful representation is
essential.
The representation
relate to the problem
being solved, avoid
pointless computation.
A Quick look of Examples of KR in AI
If-then Rules
IF there are 6 flat surfaces
AND the size and shape of each surfaces is the same
THEN the object has a cubic shape
Semantic nets
human cat
is_a is_a is_a
ali has_friend ahmed owns kitty
Ahmed has a friend named Ali, and a cat called Kitty.
A Quick look of Examples of KR in AI
Logic
is_a (kitty, cat)
owns (ahmed, kitty)
friend_of (ali, ahmed)
is_a (ahmed, human)
is_a (ali, human)
Frames
Ahmed Kitty
is_a Human is_a Cat
owns Kitty
friend Ali owned by Ahmed
Human Ali
has_num_leg 2 is_a Human
has_brain true friend_of Ahmed
The Knowledge Representation
The knowledge-based system
a model of something in the real world
designed by modeling the knowledge and reasoning mechanism
usually encoded by a human expert
The Representation (Knowledge Base)
Syntax (structure of the elements)
Semantics (meaning of the elements)
The Inference Engine
The ability to find implicit knowledge by reasoning over the explicit
Knowledge Base
Inference system
Knowledge Based system
The Representation
A Knowledge Representation language is a system for
encoding knowledge.
It is defined by a syntax and semantics.
The representation limits what kind of knowledge can be
represented and reasoned about.
Syntax
The “notational” aspects.
How to encode knowledge explicitly.
Grammatical rules – the symbols to use and the way to
combine them.
Similar to natural language, where correct sentence structure
(e.g. subject-verb-object)
Example of different syntax expressing same content:
(green my-car)
green(my-car)
my-car.green = true
Semantics
Concerns the meaning of symbols.
What does symbol represent?
Example
If a system knows that green(my-car), it knows that
some property (green) is true about some
symbol(mycar), but what does my-car and green
mean?
The representation limits what kind of knowledge can be
represented and reasoned about.
Example
The system knows that all cars have engines and a
Toyota is a car. Will it be able to infer that Toyota has an
engine?
Knowledge and Inference
Inference - The ability to find implicit knowledge by reasoning
over the explicit knowledge
A Knowledge Representation must not be seen in isolation from
its inference capabilities.
Realised through a set of algorithm – the inference engine.
An inference engine “implements” a set of inference rules.
The inference engine infers implicit knowledge.
The inference rules are abstract rules that can be applied in
various domains (domain independent)
Example of Knowledge & Inference - Inheritance
Inference in Semantic Nets.
Property of superclass is inherited to subclass
Example:
The computer can infer that Tweety moves by flying
bird
is_a moves_by
tweety flying
Example – Modus Ponens
Reasoning mechanism in Logic.
Says that some proposition always follow from another.
Example
The computer can infer that Tweety moves by flying
is_a(tweety, bird).
moves_by(y, flying) :- is_a(y,
bird).
What makes a good representation?
Completeness – we can express what we want to
express.
Conciseness – we can do so without ambiguities.
Transparency – It is easy to understand, common
understanding between human and computer.
Computational efficiency – the inference engine is
efficient
Note: There is tradeoff between these criteria.
Types of Knowledge Representation
often used
if-then Rules or Production Rules
if-then rules is also referred to as Production rules
By far, the most popular formalism for representing
knowledge
Rules are conditional statements but they can have various
interpretations that we can define:
if precondition P then conclusion C
if situation S then action A
if conditions C1 and C2 hold then condition C does not
hold
Rules can represent relations, recommendations, directives,
strategies and heuristics
Some examples of Production Rules
Relation
IF the fuel tank is empty
THEN the car engine can’t be started
Recommendation
IF the season is autumn
AND the sky is cloudy
AND the forecasted weather is drizzle
THEN the advice is “take along an umbrella”
Directive
IF the car is dead
AND the fuel tank is empty
THEN the action is “refuel the car”
Some examples of Production Rules
Strategy
IF the car is dead
THEN the action is “check the fuel tank”;
step 1 is complete
IF step 1 is complete
AND the fuel tank is not empty
THEN the action is “check battery”;
step 2 is complete
Heuristic
IF the spill is liquid
AND the spill pH is < 6
AND the spill smells vinegar
THEN the spill material is “acetic acid”
if-then Rules or Production Rules
The components of a rule-based system have the form:
if < condition > then < conclusion > or
if < antecedent > then < consequent >
A rule can have more than 1 antecendents and more than
1 consequents
Rules can be evaluated by:
backward chaining
forward chaining
if-then Rules or Production Rules
if-then rules turn out to be a natural form of expressing
knowledge, and have the following features:
modularity – each rule defines a small, relatively
independent piece of knowledge
incrementability - new rules can be added to the
knowledge base relatively independent of other rules
modifiability (as a consequence of modularity) – old
rules can be changed relatively independent of other
rules
support system’s transparency
if-then Rules or Production Rules
if-then rules also support knowledge that has probability
of truth value (i.e. for knowledge that is not absolutely true
for all conditions)
In such cases, we modify the rules by adding likelihood
qualifications to their logical interpretation, as example:
if condition A then conclusion B follows with certainty
value F
IF
1 condition is primary bacteremia, and
2 the site of the culture is one of the sterilesites, and
3 the sustected portal of entry of the organism is the gastrointestinal tract
THEN
there is suggestive evidence (0.7) that the identity of the organism is
bacteroides.
Sample rule extracted from Mycin Expert system.
Forward Chaining in Production Rules
Given some facts, work forward through inference net.
Discovers what conclusions can be derived from data.
Inference begins here
Backward Chaining in Production Rules
To determine if a decision should be made, work backwards
looking for justifications for the decision.
Eventually, a decision must be justified by facts.
Inference begins here
Semantic Network (SN)
A semantic network is a directed graph consisting of nodes
(also termed points or vertices) which represent concepts and
edges (also termed lines or arcs) which represent semantic
relations between the concepts.
Semantic network problem can be transformed to logic
As example:
is-a
mammal
camel
colour brown
( x) (camel(x) -> mammal(x))
colour(camel, brown)
A graph with 6 vertices (concepts) and 7
edges (semantic relations).
Some Semantic Relations in SN
Antonymy: Opposite meaning. Example: Cold is the opposite of warm
Synonymy: Equivalent meaning. Example: Cheap is synonym to inexpensive.
Causal relation: A is the cause of B. Example: Scurvy is caused by lack of vitamin C.
Homonym . Two concepts, A and B, are expressed by the same symbol. Example:
Both a financial institution and a edge of a river are expressed by the word bank (the word has two
senses).
Active relation: A semantic relation between two concepts, one of which
expresses the performance of an operation or process affecting the
other. Example: The room temperature is high and the ice cubes melt.
Temporal relation: A semantic relation in which a concept indicates a time or
period of an event designated by another concept. Example: Second World War, 1939-
1945.
Some Semantic Link terms
Is-a Has-parts
A-kind-of Connected-to
Type-kind Made-of Has-attribute
Whole-part Object-property
Part-of Object-action
Instance-of Action-result
Attribute-of Object-example
Example of Semantic Network
State: I own a tan leather chair.
Example of Semantic Network
Event: John gives the book to Mary.
Frames
A network representation, as semantic nets
Frames have links between concepts, but each concept
contains more knowledge
Frames represent a concept – either a class or individual
The concept of a Frame is defined by a collection of Slots
Each frames have a number of slots
Slots are <attribute, value> pairs
A value can be set of values, any primitive data-types, a
pointer to another frame or a function (procedure
attachment) < Fatimah AzZaharah
Reasoning in Frames < isa Female, Sudannese>
can be done by Matching < born 1987>
or Inheritance < age function:(- now born)>
< parents (AbuBakar, Aisha)>
< works-as Computer Scientist>
>
Example – a person description Frame
More on Knowledge Representation (KR) …
A well referred paper on Knowledge Representation:
Randall Davis, Howard Shrobe and Peter Szolovits,
“What is a Knowledge Representation?”, AAAI, Spring
1993.
Roles if KR (as discussed in the paper)
Role 1: A KR is a surrogate
How close is a representation to the real thing? What kind
of simplifying assumptions are made?
Role 2: A KR is a set of Ontological Commitments
What kind if Ontological commitments does this
representation “force” on you?
Role 3: A KR is a Fragmentary Theory of Intelligent Reasoning
What are the sanctioned and recommended inferences?
Role 4: A KR is a medium for efficient computation
Role 5: A KR is a medium of human expression
Given the following information:
A bird is a kind of animal. Flying is the normal moving
method for birds. Birds are active during daylight.
An albatross is a bird. Albatross is black and white in
colour.
Albert is an albatross, and so is Ross.
Kiwi is a bird that moves by walking.
Kiwi is active at night and brown in colour.
Kim is a Kiwi.
Convert the statements above in any of the 2
representation schemas below:
Semantic net
Rule-based
Frame.
Window
Kitchen
Bath-
room
Hall
A toy knowledge base –
Diagnosing the problem of water leaking in an apartment.
A problem can arise either in the bathroom or in the
kitchen. In either case, the leakage also causes a problem
(water on the floor) in the hall.
Try diagnose the possible causes of water leaking in
the apartment, when the:
a) Hall is wet
b) Kitchen is wet