Ch05 - 僑光科技大學

Download Report

Transcript Ch05 - 僑光科技大學

Chapter 5
Knowledge Representation
知識表示法
Expert Systems sstseng
1
5.1 The meaning of Knowledge(知識)
• Knowledge(知識) + Inference (推論)= Expert Systems(專家系統)
• Affect the development, efficiency, speed, and maintenance of
expert systems
• epistemology: concerned with the nature, structure, and origin of knowledge
• a priori comes from the Latin and means “That which precedes”
Epistemology(認知論)
Philosophic Theories
A Priori Knowledge
ARISTOTLE PLATO
LOCKE MILL
e.g. all triangles
have 180 degrees
(considered to be
universally true)
A posteriori Knowledge
e.g. the light is green
• a posteriori knowledge can be verified using
sense experience
Expert Systems sstseng
2
Classifications of knowledge(知識)
• Procedural Knowledge(程序性知識)
How to do something
• Declarative Knowledge(陳述性知識)
The truth of something
“Don’t put your fingers in a pot of boiling water”
• Tacit Knowledge(隱含知識)
(Unconscious Knowledge)
Cannot be expressed explicitly
-An example is how to move your hand
-Walking or riding a bicycle
-ANS is related to tacit knowledge
Expert Systems sstseng
3
Analogy to Wirth’s classic
expression
• Algorithms + data structures = programs
• Knowledge + Inference = expert systems
Expert Systems sstseng
4
Levels
Meta
Knowledge
(rules about rules)
Knowledge
Information
(rules+facts)
(facts)
Data
Noise
Expert Systems sstseng
5
The sequence of 12 numbers:137178007124
Without knowledge. This entire sequence may appear to be
noise.
Rule 1:IF Rain THEN Bring Raincoat
Rule 2:IF Rain THEN Bring Umbrella
Meta Rule 1:Try Rule 2 First
Meta Rule 2:IF Ride a motorcycle THEN
Try Rule 1 First
Meta knowledge is knowledge about knowledge and expertise.
-would specify which knowledge base was applicable.
Expert Systems sstseng
6
Representation(表示法)
• Backus - Naur form
• Ontology(本體論)
• Semantic Network(語意網路)
• Frames-based Knowledge(框架式知識)
• Case-based Knowledge(案例式知識)
• Rule-based Knowledge(規則式知識)
• Knowledge Object(知識物件)
• Logic(邏輯)
Expert Systems sstseng
7
•
5.2 Backus - Naur form ( BNF )
This notation is a meta language for defining the
syntax of a language
•
Define the syntax of a language
e.g.
<sentence>::= <subject><verb><end-mark>
<subject>::= I | You|We
<verb> ::= left |came
<end-mark> ::= . | ?|!
• Parse Tree (derivation tree)
sentence
subject
verb
end-mark
You
came
?
Expert Systems sstseng
8
5.3 Ontology(本體論)
• Ontology一詞在90年代就開始被使用在人工智
慧領域,描述知識的知識構成要素之間的關係。
• Ontology的研究大致上可略為分為兩個方向:
– 針對特定的問題領域建立大量的Ontology
• 例如:建立某些領域詞彙的Ontology
– 研究Ontology的建構方法與表示方法
• 例如:利用XML(可延伸標記語言)或
是RDF(資源描述格式)
Expert Systems sstseng
9
• Ontology的發展主要是用來使知識分享和再用
更為容易。
• 不同的研究對於Ontology的表示與描述有不同
的方法,目前還未看到較一般化、通用的表示
法。
• 範例:使用RDF來描述適性化教材的Ontology
rdfs:Class
rdfs:domain
sw:教學策略
rdf:type
sw:Ontology
rdfs:subClassOf
rdfs:subClassOf
rdfs:subClassOf
sw:後繼者
rdfs:range
rdf:type
rdf:type
rdfs:domain
rdfs:Property
rdfs:Resource
rdf:type
sw:評估策略
sw:學習概念
rdfs:domain
rdf:type
rdfs:range
rdf:Literal
Expert Systems sstseng
10
5.4 Semantic Network(語意網路)
(Quillian 67 & 68)
• A classic AI representation technique used for
propositional information is sometimes called
Propositional Net
• A proposition(命題) is a statement that is either
true or false
• A directed graph(有向圖形)
• Node(點) : 知識的組成元素或是種類
• Arc(有向線段) : 知識組成元素間的關
• 「is a」
• 「a kind of」
Expert Systems sstseng
11
General Net
San Francisco
Chicago
New York
Indianapolis
Los Angeles
Houston
Expert Systems sstseng
12
A Semantic Net(語意網路)
sister-of
Ann
wife-of
husbandof
Mother-of
Carol wife-of
Mark
FatherMotherof
wife-of of
David
husbandfather-of
of
Tom
Susan
Mother-of
husbandof
father-of
John
Expert Systems sstseng
13
「is a」 and 「a kind of」
• 「is a」 :
在Tail(有向線段尾段)所表示的知識物件屬
於Head(有向線段頭段)的知識類別中的一
個例子。
• 「a kind of」(AKO) :
在Tail(有向線段尾段)的知識類別屬Head
(有向線段頭段)所表示的知識類別。
• Superclass(父類別) and Subclass(子類別)
• Attribute, Value, Property
• Inheritance(繼承)
Expert Systems sstseng
14
鴿子
is a
鳥
AKO
動物
has-property
飛
A Semantic Network with 「is a」 and 「a kind of」(AKO) Links
Expert Systems sstseng
15
aircraft
AKO
AKO
round
has-shape
AKO
Propeller
driven
balloon
jet
AKO
AKO
AKO
AKO
AKO
AKO
has-shape
ellipsoidal
blimp
special
DC-3
DC-9
is a
is a
is a
Goodyear
Blimp
Spirit of
St. Louis
Air
Force 1
Concorde
A Semantic Network with 「is a」 and 「a kind of」(AKO) Links
Expert Systems sstseng
16
5.5 PROLOG and Semantic Nets(語意網路)
• Essentials(本質、要素) of PROLOG
Each of the statements above is a PROLOG predicate(述部)
expression, or simply a predicate.
Color(red).
; red is a color
father_of(Tom,John).
; Tom is the father of John
mother_of(Susan,John).
; Susan is the mother of John
parents(Tom,Susan,John).
; Tom and Susan are
parents of John
Expert Systems sstseng
17
Predicates can also be expressed with relations such as the
IS-A and HAS-A.
is_a (red,color).
has_a (John,father).
has_a (John,mother).
has_a (John,parents).
Some additional predicates
is_a (Tom,father).
is_a (Susan,mother).
is_a (Tom,parent).
is_a (Susan,parent).
Expert Systems sstseng
18
Programs in PROLOG consist of facts and rules in the
general form of goals.
p:-p1,p2…pn.
In which p is the rule’s head and the pi are the subgoals.
The symbol,:-, is interpreted as an IF.
parent (x,y) : - father (x,y).
parent (x,y) : - mother(x,y).
grandparent(x,y) :- parent (x,z) ,parent(z,y).
and an ancestor can be defined as:
(1) ancestor(x,y) :- parent(x,y).
(2) ancestor(x,y) :- ancestor(x,z),ancestor(z,y).
Expert Systems sstseng
19
Predicate Database
(Rules and Facts)
Queries
Answers
Interpreter
User
General Organization of a PROLOG System
Expert Systems sstseng
20
(3) parent (Ann,Mary).
(4) parent (Ann,Susan).
(5) parent (Mary,Bob).
(6) parent (Susan,John).
As another example, suppose the query is
:-ancestor(Ann,John).
The first ancestor rule(1) matches and X is set to Ann and
Y is set to John. PROLOG now tries to match the body
of (1), parent (Ann,John) with every parent statement.
Expert Systems sstseng
21
(1) is not true, the head cannot be true.
Because(1) cannot be true, PROLOG then tries the
second ancestor statement
(2) X is set to Ann and Y is set to John.
Control structure of PROLOG is of the Markov algorithm
type, in which searching for pattern matching is normally
determined by the order in which the Horn clauses are
entered.
Expert Systems sstseng
22
5.6 Schema (plural schemas or schematas)
• A semantic net(語意網路) is an example of a
shallow knowledge(淺層知識) structure.
• A general term to describe a complex
knowledge structure
• Focus on only relevant(有意義的) knowledge
• For examples:FRAME,SCRIPT
Expert Systems sstseng
23
5.7 Frames-based Knowledge(框架式知識)
(Minsky 75)
• Suitable for related knowledge about a narrow
subject with much default knowledge
• script-a time-ordered sequence of frames
• Slot(槽):Attribute(屬性)
Slot 值:Value
• Example a car frame
Slots
manufacturer
model
year
transmission
engine
tires
color
Slots 值
General Motors
Chevrolet Cqprice
1979
automatic
gasoline
4
blue
Expert Systems sstseng
24
Slot 值
• Some frame-based tools (KEE) allow a
wide range of items to be stored in slots
• an assigned value
.a default value
• Rules
.graphics
• Comments
.debugging
information
• questions for users
.function
• procedural attachment .to other frame
Expert Systems sstseng
25
Procedural Attachment
• If – needed, if-added, if-removed
• Examples:Human Property
Slots
Slots 值
name
specialization_of
property
a_kind_of object
types
(car, boat, house)
if-added:Procedure ADD_PROPERTY
owner
location
status
under_warranty
default:government
if-needed:Procedure FIND_OWNER
(home, work, mobile)
(missing, poor, good)
(yes, no)
Expert Systems sstseng
26
Hierarchy
Slots 值
Slots
name
specialization_of
types
manufacturer
location
wheels
transmission
engine
car
a-kind-of property
(sedan,sport,convertible)
(GM,Ford,Chrysler)
mobile
4
(manual, automatic)
(gasoline, diesel)
Slots
name
specialization_of
manufacturer
owner
transmission
engine
status
under_warranty
Slots 值
John's car
is_a car
GM
John Doe
automatic
gasoline
good
yes
un
Expert Systems sstseng
27
• FRAMES
School meeting
Time
Place
Topic
Chair
Monthly Meeting
Time
Place
Topic
Chair
Participant
……
Wed. 14:00
Meeting Room#1
School Stuffs
Principal
A KIND OF
Weekly Meeting
Time
Place
Topic
Chair
Participant
C.J.Hall
Prize
……
IS A
NO.
Place
Meeting #912
Meeting Room#2
Topic
Paticipant
…….
Expert Systems sstseng
Occasional Meeting
Time
Place
Topic
Chair
Participant
……
IF-ADDED:inform
the participants
IF-REMOVED: inform
the participants
IF-ADDED:inform
the person
IF-REMOVED:
inform the person
IF-CHANGED:...
28
Difficulties with FRAMES(框架)
• Stereotype is that it have well defined features so that
many of its slots have default values
name
elephant
specialization of
a-kind-of mammal
color
gray
legs
4
trunk
a cylinder
Three-legged, two-legged
• Most frame(框架) systems do not?
• Provide a way of defining unalterable slots
• Nothing is really certain is such a unrestrained system
Expert Systems sstseng
29
Shopping Script:
C(customer),S(salesperson)
M(merchandise),D(dollars) 1.Centers L
L(a store)
2.C begins looking around
3. C looks for a specific M
4. C looks for any interesting M
5. C asks S for help
6.
7.C finds M’
9. C leaves L
8. C fails to find M
10.C buys M’
11.C leaves L
12. goto step 2
13.C leaves L
14.C takes M’
Expert Systems sstseng
30
Did Mary buy anything?
Mary went shopping for a new coat. She
found a new one. She really liked When
she got it home, and discovered that it
went perfectly with her favorite dress .
Question:Did Mary buy anything?
Expert Systems sstseng
31
5.8 Case-based Knowledge (案例式知識)
• 通常是用來描述屬於經驗的知識
• 從過去的經驗中,判定是何種相似的case(案
例),並且依據過去解決此問題的方法,來解
決此次問題
案例名稱
• Case(案例) :
• 案例名稱
• 屬性
• 屬性值
Expert Systems sstseng
屬性1
屬性值
屬性2
屬性值
……
……
屬性N
屬性值
32
利用Case-based Knowledge(案例式知識)
建構Expert System(專家系統)
• Case Retrieve(案例擷取)
• Case Reuse(案例再用)
• Case Revise(案例修正)
• Case Retain(案例更新)
Expert Systems sstseng
33
新案例
案例擷取
案例更新
案例再用
案例庫
案例修正
案例推論循環
Expert Systems sstseng
34
5.9 Rule-based Knowledge (規則式知識)
• 知識領域具備需要推論的特性
– 例如:醫生依據其所學的醫學知識及病人所呈現的
症狀去判別所罹患的疾病
• 最基本的Rules(規則)形式
如果 「狀態」 則 「結論」
IF (condition) THEN (conclusion)
• Inference Chaining(推論鏈)
– Forward Inference(前向推論)
– Backward Inference(後向推論)
Expert Systems sstseng
35
5.10 Knowledge Object (知識物件)
• Object Oriented(物件導向)
– Class(類別) and Object(物件)
– Super-class(父類別) and Sub-class(子類別)
– Inheritance(繼承)、Encapsulation(封裝)、
Polymorphism(多型)
• Knowledge Object(知識物件)
– Object-Attribute-Value Triples ( OAV )
(物件-屬性-屬性值法)
– 物件導向規則庫管理系統
– Knowledge Object Model(知識物件模型)
Expert Systems sstseng
36
Object-Attribute-Value Triples ( OAV )
(物件-屬性-屬性值法)
• OAV can be used to characterizes all the knowledge
(知識) in a semantic net(語意網路) and was used
in MYCIN for diagnosing infections diseases
Object
Attribute
Value
apple
apple
apple
grapes
grapes
grapes
color
type
quantity
color
type
quantity
red
mcintosh
100
red
seedless
500
• Especially useful for representing facts(事實)
• for only a single object:
only attribute-value pairs (AV)
Expert Systems sstseng
37
Object-Attribute-Value Triples(物件-屬性-屬性值法)
Car
Wheel: 4
Function:run
Object
Value
Attribute
Door:3
.
.
.
AKO
AKO
Door:4
.
.
.
AKO
AKO
Carry:people
size:small
Carry:goods
size:big
AKO
AKO
Civic
R9
price:$$$
price:$$$
is a
year:1988
owner:gjh
‧‧‧‧‧‧price:$$$
price:$$$
‧‧‧‧‧‧
is a
year:1992
owner:crt
Expert Systems sstseng
38
Limitations
• Lack of standard names for links and nodes(點)
• Combinatorial explosion of searching nodes(點)
• Logically inadequate
no “for all”, “there exist”...
• Heuristically inadequate
no effective search heuristics
Expert Systems sstseng
39
物件導向規則庫管理系統
• 將規則集合與物件導向概念結合
OO-RM Concepts
Rule-Class
role set
OO Concepts
Class
data set
role2
data_member2
inference1
...
data_member1
...
role1
method1
rule2
statement21
inference2
...
statement11
...
rule1
method2
rule2
statement22
...
statement12
...
rule1
• Rule Class(規則類別) and Rule Object(規
則物件)
Expert Systems sstseng
40
5.11 Logic(邏輯)
•A description team for logic programming and
expert systems is automated reasoning systems
• Syllogism(三段論): The oldest and one of the
simplest types of formal logic
premise:
all men are mortal
premise:
Socrates is a man
Conclusion: Socrates is mortal
• Propositional Logic(命題邏輯) -a symbolic
logic for manipulating propositions
•First-Order Predicate Logic(第一層敘述邏輯)
•Fuzzy Logic(模糊邏輯)
Expert Systems sstseng
41
Propositional Logic(命題邏輯)
• Proposition
A sentence whose truth value can be determined
e.g. it is raining
Feather ( Albatrass)
• Compound Statement
  
e.g.
If it is raining then carry an umbrella
Expert Systems sstseng
42
• Tautology
A compound statement that is always true
e.g. P  ~p
• Contradiction
A compound statement that is always false
e.g. P  ~p
• Contingent Statement
neither tautology nor contradiction
e.g. P
Expert Systems sstseng
43
5.12 First - Order Predicate Logic(第一層敘
述邏輯)
• Propositional logic(命題邏輯) is a subset of
predicate logic(敘述邏輯)
• The basis of logic programming languages
e.g. Prolog
• Addition
:
Variable
• universal quantifier: For all

• existential quantifier: There exist

e.g.
( x) (x is a triangle

Expert Systems sstseng
x is a polygon)
44
Limitations of Predicate Logic(敘述邏輯)
• The following statement can’t be expressed in
predicate logic(敘述邏輯):
• Most of the class received As
• To implement Most, a logic must provide some
predicates for counting, e.g. fuzzy logic(模糊
邏輯).
Expert Systems sstseng
45
知識表示法
• 邏輯(Logic)
– 語言正規而簡單(formal syntax)
– 嚴密的理論
– 完整的推理法則(rules of inference)
– 可證性
– 彈性大
• 模組性高(modularity)
• 不容易表示有處理(processing)和控制(control)的
知識
Expert Systems sstseng
46
•缺乏結構性
•有時不太自然
•解釋不易
採用解析原則(resolution principles)的邏
輯
系統解不易
事實量大時,法則的選取(rule selection)會
有組合膨脹(combinatorial explosion)的現
象
Expert Systems sstseng
47
Exercise
• 1. Draw an action frame system explaining what
to do in case of hardware failure for your
computer system. Consider disk crash , power
supply , CPU, and memory problems.
• 2. Determine whether the following are valid or
invalid arguments.
– A) pq, ~qr, r; ∴ p
– B)~pq, p(r  s),s q; ∴ q  r
– C) p (q r), q; ∴ p r
Expert Systems sstseng
48
專題進度規劃
• 10/18
交分組名單(每組最多四人)
• 11/01
交專題題目與初步構想書
• 11/29
交專題計劃書
• 12/20~1/10
上台presentation(每組十
五分鐘)
• 01/17
系統Demo & 交期末專題報告
Expert Systems sstseng
49
誰殺了仙道?(1)
• 神奈川縣高中籃球決賽前夕,陵南高中籃球隊
中的明星選手——仙道彰被殺死於自家住處。
警方稍後拘捕了五名嫌犯。他們是湘北高中籃
球隊的櫻木花道、三井壽、流川楓、赤木剛憲、
宮城良田。在警方的盤問中,他們各人都要回
答四個問題。但是由安西教練側面瞭解,各嫌
犯所答的四個問題中有三個答案是真話,另一
個答案是假話。而且兇手就是五人其中之一。
以下是五人的供詞:
Expert Systems sstseng
50
誰殺了仙道?(2)
• 櫻木花道:
–
–
–
–
(a)我沒有殺死仙道。
(b)我從未有手槍。
(c)流川楓討厭我。
(d)當天下午我在練球。
Expert Systems sstseng
51
誰殺了仙道?(3)
• 三井壽:
–
–
–
–
(a)我沒有殺死仙道。
(b)流川楓在今年內從未到過仙道家。
(c)我和赤木不熟。
(d)當天下午,我和櫻木在練球。
Expert Systems sstseng
52
誰殺了仙道?(4)
• 流川楓:
–
–
–
–
(a)我沒有殺死仙道。
(b)我今年內從未到過仙道家。
(c)我不討厭櫻木。
(d)如果赤木說我是兇手,這是謊言。
Expert Systems sstseng
53
誰殺了仙道?(5)
• 赤木剛憲:
–
–
–
–
(a)仙道被殺時,我在家中。
(b)我從未殺過人。
(c)流川楓是兇手。
(d)我和三井是好朋友。
Expert Systems sstseng
54
誰殺了仙道?(6)
• 宮城良田:
–
–
–
–
(a)如果櫻木說他從未有手槍,這是謊言。
(b)仙道在決賽前夕被殺的。
(c)命案發生時,赤木在家中。
(d)我們其中一人是兇手。
Expert Systems sstseng
55