Chapter 3: Representing Knowledge in Computer Introduction (Representing knowledge, Metrics for assessing knowledge representation schemes), Logic representation, Inference rules, Semantics networks, Frames and Scripts, Decision trees.
Trang 1Chapter 3
Representing Knowledge
in Computer
K216 C: Studies on Intelligence School of Knowledge Science JAIST
TuBao Ho
Trang 3 declarative knowledge is knowledge about
things
location of JAIST, its transport links
“JAIST is in Tatsunokuchi”, “Hokuriku Railroad Ishikawa
line goes from Nomachi to Tsurugi”
procedural knowledge is knowledge about
how to do things
how to get to JAIST
“Take the Hokuriku Railroad, Ishikawa line to go to
Tsurugi”, “Get on the JAIST shuttle”
Trang 4particular subject
Example: “JAIST shuttle goes from Tsurugi to JAIST”
that applies throughout our experience
Example: “shuttle bus is a means of transport”
that is possessed by every schoolchild It is evident for human but not for machine
Trang 5 In order to make use of knowledge in AI and
intelligent systems we need to get it from the source
(knowledge acquisition) and represent it in a form
usable by the machine
Human knowledge is usually expressed through
machine
The representation of knowledge in computer must
therefore be both appropriate for the computer to use and allow easy and accurate encoding from the source
Trang 6The “15 game”: two people A and B take turns
selecting numbers from 1 to 9 without replacement
The person who first has exactly three numbers in his
collection that add up to 15 wins the game
A 5 9 4 6 win!! (A selects 6 and wins with
Example of representing knowledge
Trang 7Example of representing knowledge
A choosing 5 is equivalent to
putting A’s marker in the
tick-tack-toe board Use tick-tick-tack-toe
representation for the “15 game”
A
A BB
B A A
A BB
A
31
45
9
2
6
Trang 8Aspects of representation languages
1 The syntax describes the possible configurations that
can constitute sentences
External representation : how sentences are represented on
the printed page
Internal representation : the real representation inside the
computer
2 The semantics determines the fact in the world to
which the sentences refer Without semantics, a
sentence is just an arrangement of electrons or a
collection of marks on a page
Trang 9Metrics for assessing knowledge representation schemes
Trang 11Propositional logic
A proposition is a statement that can
have one of two values: true or false
( known as truth values )
Example: “It is raining” and “I am
hungry” are propositions whose values
depend on the situation at the time
Propositions P and Q can be combined
using operators such as and (PQ)
Trang 12 simple syntax : proposition symbols such as P and
the logical connectives , , , , , and ()
sentences are made by symbols using rules:
- Propositional symbol such as P or Q is a sentence by itself
- Wrapping parentheses around a sentence yields a sentence, e.g.,
(PQ)
- A sentence can be formed by combining simpler sentences with
one of the five logical connectives
Propositional logic
Trang 13 (and): A sentence using , such as P (Q R), is called a
conjunction (logic); its parts are the conjuncts
(or): A sentence using , such as A (P Q), is a
disjunction of the disjuncts A and (P Q)
(implies): A sentence such as (P Q) R is called an
implication Its premise or antecedent is P Q, and its
conclusion or consequent is R Implications are also known as
rules or if-then statements
(equivalent): The sentence (P Q) (Q P) is an equivalence
(not): A sentence such as P is called the negation of P;
is the only connective that operates on a single sentence.
Propositional logic
Trang 14Straightforward semantics: we define it by specifying the interpretation of the proposition symbols and
constants, and specifying the meanings of the logical connectives
Trang 15Predicate logic
The propositional logic has limitations in its expressive
power and is expanded to the predicate logic by
introducing terms, functions, predicates, and quantifiers
A “predicate” denotes a relationship between objects
- Red(x) , a unary relation, is a predicate expression that asserts
that x is red
- Father(Ichiro, Taro) asserts that Ichiro is the father of Taro
A predicate can take on a value of true or false when its variables have assumed specific values
Trang 16Predicate logic
Parametrized propositions give us predicate logic
father(Ichiro, Taro), father(Ichiro, Jiro)
father is the predicate, Ichiro, Taro and Jiro are
Trang 17 The universal quantifier ( ), e.g., x, is the
notation that indicates “for all x”
The existential quantifier , “there exists” is
Trang 18 These quantifiers can be combined in the same expression
“Everyone has a mother” can be expressed as (x)(y)[(Human(x) Mother(y, x)]
(x)Q(x) expresses the fact that something has a certain property without saying which thing has that property
(x)[P(x) Q(x)] expresses the fact that everything in a certain class has a certain property without saying what everything in that class is
Predicate logic
Trang 19Semantics in logic representation
are merely symbols that are to be manipulated
The system sees no difference between P(x) and
provided by the user mapping the variables and functions to things in the problem domain
between logical symbols and the problem domain
logical system.
Trang 20Assessing logic representation
relationships between facts and assertions about facts
It is relatively understandable
amenable to computation through PROLOG
representation scheme relatively efficient, although
computational efficiency depends to a degree on the
interpreter being used and the programmer
Trang 21Outline of chapter 3
Inference rules
Trang 22Representing knowledge by rules
Inference rules (production rules)
A B (if A then B)
if (Primary Exam>700) (live in Kansai)(good at
math)
then (take the entrance exam at the School of
Knowledge Science of JAIST)
if (feel tired) (has fever) (sneeze)
Trang 23Representing knowledge by rules
Given a true fact “Wind blows”, and the rule
if wind blows then the hooper makes money,
We have a total match of the form
A = true
if A then B
and we can conclude B = true To check whether a condition part
matches a fact or an expression is called pattern-matching
if height of X > height of Y
then X is taller than Y
height of Ichiro = 1.70m
height of Jiro = 1.75m, X = Jiro, Y = Ichiro
We get the result “Jiro is taller than Ichiro”
Trang 24Using logical expressions
The condition part of a production rule can contain the
usual logical expressions The following is a sample
condition:
Ex if the season is june isobarometric line runs
east to west
then isobarometric line is the line of rainy season
Ex if the line of rainy season is at the south shore of
Japan cloud is growing at the south shore of Japan
then the south shore will have heavy rain
Trang 25 should not write rules that are inconsistent Rules in
which the condition parts are the same should have the same action parts
if A then B and if A then B
should not write a production rule that causes a loop
Trang 26Assessing inference rules
procedural knowledge They are ideal in situations
where knowledge changes over time and where the
final and initial states differ from user to user (or
subject to subject)
procedural problems, and their flexibility makes it
transferable between domains
Trang 28Semantics networks
itself; it is also the relationships that exist among facts
that objects or concepts can be joined by some relationship Semantic networks
Trang 29Relationship among concepts
x1 x2
pred
xn
R
x1 x2
The basic unit of a semantic network, as shown in Figure (a),
corresponds to R(x,y) in predicate logic A relation, R(xl, x2, …, xn),
with n arguments when expressed in logic, is hard to express in a
semantic network But it might look like Figure (b).
Trang 30 A common relation that joins two concepts in a
semantic network is the more General/less General
Taro human being animal
Other relations besides isa links are:
has X has Y (Y is a partial concept of X)
Relationship among concepts
Trang 31black hair has
is isa
23 year old Taro student
is studies with
at tall friend knowledge science school
Taro is a student.
Taro is 23 years old
Taro is tall
Taro has black hair.
Taro studies with a
friend at the school
of knowledge science
ISA(Taro, student)
IS(Taro, 23 years old)
IS(Taro, tall)
HAS(Taro, black hair)
STUDY(Taro, friend, school of Knowledge Science)
Relationship among concepts
Trang 32Property inheritance
animal
isa isa invertebrate animal mollusk
do isa
move arthropod ~fly isa wing do isa
has has penguin insect isa isa isa vertebrate animal bird dove
has has do color
isa fly white and neck bone black
mammal carnivorous tiger isa animal isa
Bird
Some labels are isa
Labels on the other arcs
represent other properties
Trang 33 The principle of property inheritance says that objects belonging
to more specific concepts inherit all the properties of objects
belonging to a more general concept (default value) The isa arc
satisfies the transitive law and we can prove “ A isa C ” from “ A
isa B ” and “ B isa C ”
A penguin is a bird and a bird has a property that it can fly
However, a penguin can not fly, and we must clearly indicate
that fact, that means we need to modify the default value (a
penguin “does not fly”)
Once we organize knowledge, it is easy to answer many
questions
- Does a bird fly?
- What properties does a bird have?
- Does a dove have a neck?
Property inheritance
Trang 34Property inheritance
there are two Taros and one is a teacher and the other is a student?
imagining that “Taro” is a label and using two nodes (token), <taro-1> and <taro- 2>, both of which are joined to the label “Taro”
Trang 35Case frames
Consider knowledge relates to movement and change
(persisting over time and space and relates many objects):
time (when), location (where), agent (who),
object (what), tool (how), purpose (why), method (how)
study
agent time (who) EVENT (when)
object location (what) (where) tool method
purpose (how) (how) (why)
Trang 36A semantic network using a token expression:
“Taro studied English in his room on April
Trang 37Semantics networks
mechanism for representing general and specific
knowledge The representation is a model of human
memory, and it is therefore relatively understandable
inheritance
and help maintain consistency in the knowledge base
through the network, so the relationships and
inference are explicit in the network links
Trang 39 Proposed by M Minsky: when we look at, listen
to, or think about something, we do so within a
there is often a frame (its internal structure)
element of the idea
Frames
Trang 40name: instructor
specialization of: teacher
name: unit(last name, first
specialization of : young person
name: unit(last name, first name)
subject: range(information
science, computer, …)
date entered: unit(year, month)
Trang 41Connection between frames
teach frame young people student frame
frame
instructure frame ADDRESS
SALARY
name: SALARY
monthly salary: unit(dollars)
annual salary: unit(dollars)
average monthly salary: unit(dollars),
compute(AVE-M)
tax amount: unit(dollars), compute(TAX)
the system will do the calculation at the
frames called AVE-M and TAX and return the results
Trang 42 expressiveness : they allow representation of
structured knowledge and procedural knowledge
effectiveness : actions or operations can be
associated with a slot and performed
efficiency : they allow more complex knowledge
to be captured efficiently
explicitness: the additional structure makes the relative importance of particular objects and
concepts explicit
Trang 43location: bed room action: make bed open the window
go to the door open the door and get out
1 get out of the bed
go to the Bathroom France
2 wash one’s face
3 eat breakfast
bath room
location: bath room action: enter the bath room use the tooth brush wash one’s face comb one’s hair get out of the bath room
location: kitchen action:
folk blankets
unlock the window key hold the window handle pull the handle
walk
hold the door knob turn the knob push the door open the door,
turn on the tap,
wipe your face by hand shave
dry your face
washstand mirror light
tap sink tooth cleaning set shaving
Trang 45Decision Trees
Decision Tree is a classifier in the form of a tree structure that is either:
A decision tree can be used to classify an instance by
starting at the root of the tree and moving through it
until a leaf is met
a leaf, indicating a class of instances, or
a decision node that specifies some test to be
carried out on a single attribute value, with one
branch and subtree for each possible outcome of
the test
Trang 46Data of London Stock Market
Major factors affecting the stock market:
- What it did yesterday - Bank interest rate
- What the New York market - Unemployment rate
is doing today - England is losing
Instance No ( previous days ) 1 2 3 4 5 6
? 7
Trang 47The London market
will rise today
Trang 48Mercedes Benz
Goes to
Married
to
Trang 49Example of Frames
Automobile Frame
Class of: Transportation
Name of manufacturer: Audi
Origin of manufacturer: Germany
Model: 5000 Turbo
Type of car: Sedan
Weight (kg): 1500
Wheelbase (inches): 105.8
Number of door: 4 (default)
Transmission: 3-speed automatic
Number of wheels: 4 (default)
Engine: (Reference Engine Frame)
- Type: In-line, overhead cam
Horsepower: 140 hp Torque: 160 ft/LB
Trang 50Name Machine Unit cap.
Measured
… Is-a Total capacity N X
…
Capacity Mach Prod Cap
Demon: Active rule # 36
Name Product Capacity required
for a unit product Danish 10
Mixer cookie
Frame C
In relationships