You are on page 1of 59

KNOWLEDGE

REPRESENTATION
1
KNOWLEDGE
What is knowledge?
How?
What?

When?
Why?

2
KNOWLEDGE
What is knowledge?
Knowledge,
like love,
is one of those words that
everyone knows the meaning
of, yet finds hard to define.
Like love, knowledge has
many meanings.

Giarratano and Riley (1998)

3
KNOWLEDGE
What is knowledge?

“Intelligent requires knowledge”


Intelligence refers to the capacity to acquire and apply knowledge.

4
KNOWLEDGE
What is knowledge?

Definition: Understanding gained


through experience; familiarity with
the way to do something to perform a
task; an accumulation of facts,
procedural rules or heuristics

5
KNOWLEDGE
Facts

KNOWLEDGE
Heuristic

Procedural
Rules

6
TYPES OF KNOWLEDGE
Types of knowledge

7
TYPES OF KNOWLEDGE
Procedural knowledge Rules
Strategies
Agendas
Procedures
Declarative knowledge Concepts
Objects
Facts
Meta-knowledge Knowledge about the other types of
knowledge and how to use them
Heuristic knowledge Rules of thumb

Structural knowledge Rule sets


Concepts relationships
Concept to object relationships

8
TYPES OF KNOWLEDGE
Example:
 Procedural knowledge
 to boil an egg we must do… then…

 Declarative knowledge
 my room no. is 2079

 Meta-knowledge
 if you want to know about heart attack, please read this book

 Heuristic knowledge
 the clouds looks dark and heavy, … heavy rain might fall…

 Structural Knowledge 9
KNOWLEDGE
HIERARCHY This is Siti phone
number…

Information

Siti Fatimah
Data Phone Knowledge
No.

10
KNOWLEDGE
REPRESENTATION
Definition

Knowledge representation is a science of


translating actual knowledge into a format
that can be used by the computer.

11
KNOWLEDGE
REPRESENTATION
Knowledge
Representation

Knowledge Usage Knowledge Source


12
KNOWLEDGE
REPRESENTATION

Why needs to represent knowledge?...

“You are given a project to develop a


system that can
diagnose heart attack?”

 How can you get information about heart attack?


 How do you understand the knowledge?
 Which knowledge to get into computer?
13
KNOWLEDGE
REPRESENTATION
Object

Knowledge
Representation
Methods Logic

Rule

14
KNOWLEDGE
REPRESENTATION
Object-Attribute-Value (O-A-V)

Color Gold

Object Attribute Value

Car Color Gold

15
KNOWLEDGE
REPRESENTATION
Semantic Network
 Definition :: ”method of knowledge representation using
a graph made up of nodes and arcs”
 Graphical view of problem’s important objects, properties
and relationships.
 Nodes represent objects & arcs represent the relationship.
 Arcs are commonly labeled with terms “IS-A” or “HAS”
 Exceptional handling  some exceptions for certain cases.
“All birds can fly and ostrich is bird  can ostrich fly?

17
KNOWLEDGE
REPRESENTATION
Semantic Network Wings
has Wings

is-a
is-a
Parrot
Parrot Bird
Bird Animal Air
Air
Animal
breathe
travel
Fly
Fly
Ostrich
Ostrich

travel Walk
Walk

18
KNOWLEDGE
REPRESENTATION
Frame
 Definition :: ”a data structure for
representing stereotypical knowledge
of some concept or object”

19
KNOWLEDGE
REPRESENTATION
Frame

20
KNOWLEDGE
REPRESENTATION
Rule
 Definition :: Rules ”a knowledge structure that relates some
known information to other information and that can be concluded
or inferred to be known”

21
KNOWLEDGE
REPRESENTATION
Rule
 Statement “IF”  antecedent and “THEN” 
consequent

IF <antecedent> THEN <consequent>

IF thirsty THEN drink_a_water

22
KNOWLEDGE
REPRESENTATION
 A rule can have multiple antecedents joined by the keywords AND
(conjunction), OR (disjunction) or
a combination of both.

IF antecedent 1 IF antecedent 1
AND antecedent 2OR antecedent 2
. .
. .
. .
AND antecedent n OR antecedent n
THEN consequent THEN consequent

23
KNOWLEDGE
REPRESENTATION
 The antecedent of a rule incorporates two parts: an object (linguistic
object) and its value. The object and its value are linked by an operator.
 The operator identifies the object and assigns the value. Operators such
as is, are, is not, are not are used to assign a symbolic value to a
linguistic object.
 Expert systems can also use mathematical operators to define an object
as numerical and assign it to the numerical value.

IF ‘age of the customer’ < 18


AND ‘cash withdrawal’ > 1000
THEN ‘signature of the parent’ is required

24
KNOWLEDGE
REPRESENTATION
Rules can represent relations, recommendations, directives, strategies and
heuristics:
 Relation
IF the ‘fuel tank’ is empty
THEN the car is dead
 Recommendation
IF the season is autumn
AND the sky is cloudy
AND the forecast is drizzle
THEN the advice is ‘take an umbrella’
 Directive
IF the car is dead
AND the ‘fuel tank’ is empty
THEN the action is ‘refuel the car’

25
KNOWLEDGE
REPRESENTATION
 Strategy
IF the car is dead
THEN the action is ‘check the fuel tank’;
step1 is complete
IF step1 is complete
AND the ‘fuel tank’ is full
THEN the action is ‘check the battery’;
step2 is complete
 Heuristic
IF the spill is liquid
AND the ‘spill pH’ < 6
AND the ‘spill smell’ is vinegar
THEN the ‘spill material’ is ‘acetic acid’
26
CONFLICT
RESOLUTION
Given the set of rules below:
 Rule 1:
IF the ‘traffic light’ is green
THEN the action is go
 Rule 2:
IF the ‘traffic light’ is red
THEN the action is stop
 Rule 3:
IF the ‘traffic light’ is red
THEN the action is go
27
CONFLICT
RESOLUTION
We have two rules, Rule 2 and Rule 3, with the same IF
part.
Thus both of them can be set to fire when the condition
part is satisfied.
These rules represent a conflict set.
The inference engine must determine which rule to fire
from such a set.
A method for choosing a rule to fire when more than one
rule can be fired in a given cycle is called conflict
resolution.
28
CONFLICT
RESOLUTION
 In forward chaining, BOTH rules would be fired.
 Rule 2 is fired first as the topmost one, and as a
result, its THEN part is executed and linguistic object
action obtains value stop.
 However, Rule 3 is also fired because the condition
part of this rule matches the fact ‘traffic light’ is red,
which is still in the database.
 As a consequence, object action takes new value go.

29
METHODS USED FOR CONFLICT
RESOLUTION
1. Fire the rule with the highest priority. In simple
applications, the priority can be established by placing
the rules in an appropriate order in the knowledge base.
 Usually this strategy works well for expert systems
with around 100 rules.
2. Fire the most specific rule.
 This method is also known as the longest matching
strategy.
 It is based on the assumption that a specific rule
processes more information than a general one.

30
METHODS USED FOR CONFLICT
RESOLUTION
3. Fire the rule that uses the data most recently
entered in the database.
This method relies on time tags attached to each
fact in the database.
In the conflict set, the expert system first fires the
rule whose antecedent uses the data most recently
added to the database.

31
KNOWLEDGE
REPRESENTATION
Logic
 Often referred to
propositional logic
and predicate calculus.

32
KNOWLEDGE
REPRESENTATION
Logic
 Propositional logic

AnB C

 Predicate calculus.

“She likes chocolate”  likes (she, chocolate).

33
SELECTING KNOWLEDGE
REPRESENTATION
Should choose a knowledge representation technique that best
matches the way the expert mentally models the problem’s
knowledge.

For practical reasons, you will have to consider the


organization’s resources and capabilities.

34
SELECTING KNOWLEDGE
REPRESENTATION
Rule-based
 Suitable if the expert discusses the problem primarily using IF/THEN type
statements.

Frame-based
 Appropriate if the experts describes the problem by referencing important
objects and their relationships.
 When the expert considers several similar objects when solving the problems.

35
RULE-BASED ES
Production system

Is the basis of today’s rule-based system.

Definition: Production

“Term used in cognitive psychology to describe the relationship between situations


and actions, and more commonly referred to today as a rule.”

ANTECEDENT CONSEQUENT

Situation  Action

Or

IF SituationTHEN Action

36
RULE-BASED ES
Production system

When solving some problem humans use a set of productions


from their long-term memory that apply to a given situation
that is stored in their short-term memory. The situation causes
some production to fire resulting in its action being added to
their short-term memory. This process is similar to human
reasoning: inferring new information from known information.
With this additional information added to the short-term
memory, the situation changes which could cause other
productions to fire. This human problem solving model of
evoking productions from long-term memory and changing the
content of the short-term memory became known as the
production system.
37
RULE-BASED ES
Production system model

Long-termMemory
Long-term Memory Short-termMemory
Short-term Memory
(Productions)
(Productions) (Situations)
(Situations)

Reasoning Actions
Reasoning
Situations

Production System Model

38
RULE-BASED ES

Definition - Production System

“A model of human problem solving where problem


situations contained in the short-term memory are
combined with productions in the long-term memory
to infer new information which is added to the short-
term memory.”

39
RULE-BASED ES

Definition - Rule-Based Expert System

“A computer program that processes problem-


specific information contained in the working
memory with set of rules contained in the
knowledge base, using an inference engine to infer
new information.”

40
RULE-BASED ES
Modules in rule-based ES:

Knowledge Base
 Models a human’s long-term memory as a set of rules.

Working Memory
 Models a human’s short-term memory and contains problem facts both
entered and inferred by the firing of the rules.

Inference Engine
 Models human reasoning by combining problem facts contained in the
working memory with rules contained in the knowledge base to infer new
information.

41
RULE-BASED ES
Rule-based model

KnowledgeBase
Knowledge Base WorkingMemory
Working Memory
(Rules)
(Rules) (Facts)
(Facts)

Conclusions
InferenceEngine
Inference Engine
Facts

42
RULE-BASED ES
Rule contained in the knowledge base represent
the productions contained in the long-term
memory and the facts contained in the working
memory represent the situations in the short-term
memory.
The inference engine acts as the reasoning module
and compares the facts with the antecedents or
premises of the rules to see which ones can fire.
Not necessarily an exact match for human
problem solving, but provide a reasonable model
for replicating the behavior with a computer.
43
RULE-BASED ES
Additional subsystems:

User interface – the medium which the user views and interacts
with the system.

Developer interface – the medium which the knowledge engineer


develops the system.

Explanation facility – the subsystem for providing explanations on


the reasoning of the system.

External programs – that support the system such as database,


spreadsheets, etc.

44
RULE-BASED ES
Rule-based system architecture
InferenceEngine
Inference Engine

Working
Working Explanations
Explanations Knowledge
Knowledge External
External
Memory
Memory Facility
Facility Base
Base Programs
Programs

User
User Developer
Developer
Interface
Interface Interface
Interface

Knowledge
User Engineer 45
ADVANTAGES OF RULE-
BASED ES

Natural Expression – human naturally express their solving


knowledge in IF…THEN type statements.
Separation of Control from Knowledge – separates the
knowledge contained in the knowledge base from its control by
inference engine – a trademark of all ES.
Modularity of knowledge – easily review and verify its
correctness.
Ease of expansion – can expend and add new rules.
Proportional Growth of Intelligence – as the number of rules
increase, the system’s level of intelligence about the problem
likewise increases.
46
ADVANTAGES OF RULE-
BASED ES

Use of Relevant Knowledge – system will use only the rules that
are relevant to the problem.
Derivation of Explanations from Rigid Syntax – explain the
user how it reaches the conclusion.
Consistency Checking – to assure that the same situations do
not lead to different actions.
Exp:
IF hungry THEN eat…
IF hungry THEN drink…

Utilization of Heuristic Knowledge – use heuristic knowledge in


rules.
47
ADVANTAGES OF RULE-
BASED ES

Utilization of Uncertain Knowledge – rules can be


easily be written that capture this uncertain
relationship.
Exp:
IF it is raining
THEN class cancel CF 99

Can Incorporate Variables – variables can be bound


to a number of instances in the working memory and
tested by the rule.
Exp:
IF ?Get high marks
THEN ?Student excellent
48
DISADVANTAGES OF
RULE-BASED ES
Require Exact Matching – antecedents in rules must
match with facts in working memory.
Have Opaque Rule Relationships – difficult to
determine how rules are logically related through an
inference chain.
Exp:
IF C
THEN D

IF B
THEN C

IF A
THEN B 49
DISADVANTAGES OF
RULE-BASED ES
Can be Slow – systems with a large set of rules can
be slow.
Are Inappropriate for Some Problems – shortcoming
of the rule-based system occurs when rules do not
efficiently or naturally capture the representation of
the domain’s knowledge.

50
DISADVANTAGES OF
RULE-BASED ES
Inability to learn - In general, rule-based expert systems
do not have an ability to learn from the experience.
Unlike a human expert, who knows when to “break the
rules”, an expert system cannot automatically modify its
knowledge base, or adjust existing rules or add new ones.
The knowledge engineer is still responsible for revising
and maintaining the system.

51
SUMMARY
https://youtu.be/fXGJcd28SM8

52
EXERCISES
  All cars have 4 wheels and 4 doors. A car is differentiated by its
engine capacity. A Proton Saga has a 1.5L and a 1.3L engine type
while a Proton Wira has a 1.3L, 1.5L, 1.6L, 1.8L and 2.0L engine
type. All Proton cars run on petrol. All car engines are built based
on the same principal of using pistons and cylinders. Draw:
semantic net & frame.
  ABC hotel consists of two types of rooms, that are, standard and
superior rooms. A standard room is equipped with a queen bed
while a superior room is equipped with two queen beds. All rooms
have a telephone, television and hot kettle. Draw: semantic &
frame.

53
EXERCISES
 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.
 Chevette is a courier. Rydell is a policeman. Couriers are a kind of
person. Policeman are a kind of person. People have two legs.
People walk. Chevette is a friend of Rydell. Chevette likes
chocolate. Draw: semantic net & frame.

54
REFER 1
Semantic Network Wings
has Wings

is-a
is-a
Parrot
Parrot Bird
Bird Animal Air
Air
Animal
breathe
travel
Fly
Fly
Ostrich
Ostrich

travel Walk
Walk

55
REFER 2
Frame

56
ANSWER 1
Semantic Network

57
ANSWER 1
Frame

58
ANSWER 1
Semantic Network

59
Pistons
has
4
wheels has
Engine
has Cylinders
has
has
Car
is a
Engine
has Capacity is
4 Proton
Saga
doors is
is is is
has 1.8L 2.0L
has
is a 1.6L
1.5L
has
1.3L has
has
has
has

Proton
Wira

60

You might also like