Title: Chap II: Knowledge Representation
1Chap II Knowledge Representation
- ????? ??????? ???? ???? ??????? ???? ???? ??????.
- ????? ????? ??????? ???????????? ????? ???
???????? ???? ???? ??? ????? ?????? ?????????.
2Knowledge Representation
- ??????? ?????? ??????? ?? ??? ?????? ???? ??
????? ????? ?????? ???? ???? ??? ???? ??????? ?
????? ????????? ? ?????? ??? ???????.. - ?????? ?????? ??????? ???? ????? ????? ?? ???????
??? ???? ?????. ? ?? ??? ???? ?????? ??? ???????
.. ? ??? ??? ???? ??? ????????! - ?? ?????? ??? ???????? ??????? ???? ????? ????
??? ??? ?? ? ????? ??? ?????? ?? ????????? ?? ???
????? ??? ??????????????????????.. ? ??? ????
??????? ??????? ?? ????. - ? ??? ?? ???? ?????? ????? ????? ????? ?? ????
???? ?????? ? ????? ? ??? ??? ??? ?? ??????
???????? ??????..
3Data, Information, Knowledge ?
Non-programmable
Non-algorithmic(heuristic)
WISDOM
????
KNOWLEDGE
INFORMATION
Algorithmic
programmable
DATA
4Physical Symbol System Hypothesis (P2SH)
- ???? ?????? ?? ?? ?? ??????? ?????? ??? ??????
???- - ????? ????? ?????? ????? ??????? ????????.
- ?????? ?????? ???? ?????.
- ??? ??????? ???? ?? ?? ????.
5The Example of Representation (?)
The example to present pi value.
High (human)
?
exponent
Abstraction
mantissa
11100010
Low (machine)
6Knowledge Representation Techniques
Rules ???????
Semantic Networks ??????? ????????
Object-Attribute Value
TECHNIQUES
Frames ????????
Logic ??????
7Object-Attribute-Value (OAV)
- Using fact ? ????? ??????? ?????????
- ??????? ????? ????? ????? ???? ??
- Eg The balls color is red (assign red to the
balls color) ???? ??? ????? ???? ( ????? ??????
???? ?????) - The object can be physical (eg car, books) or
abstract (eg love, hobby) ?????? ???? ?? ????
???? ????? ?? ??????. - The value can be numerical, string or Boolean!
?????? ???? ?? ???? ????? ? ??????? ?? ??????. - It could be either single or multi valued from
different attributes and objects.???? ?? ????
????? ?? ?????? ????? ?? ???? ?? ????? ????
Used in MYCIN
8OAV Triplets Diagram (i)
Fact The chairs color is red and priced at
35.00
RED
Color
CHAIR
Priced
35.00
Object
Attribute
Value
9OAV Triplets Diagram (ii)
Fact TIN 313 is a compulsory subject for MSc
Int Sys., code for Artificial Intelligence, and
taught by Mr Yousef Salahat
Compulsory subject
MSc Int. Sys
TIN 313
Mr Yousef Salahat
Taught
Code
Artificial Intelligence
10Rules Based
- ??????? ???? ??????? ???? ???? ??? ?????????
???????? ???? ????? ???? ????????? ?? ?????????
??? ????????. - IF condition THEN action statements.
(premise (goal
antecedent) consequent) - Example ? IF Temperature is hot THEN turn on
the air-conditioning system - ????. ?? ( ??????? ?????) ???? ????? ( ????? ????
???????). -
11Rules Based System (I)
Rule 1IF the balls color is red THEN I like the
ball. Rule 2IF I like the ball THEN I will buy
the ball.
Knowledge Base
IF balls color red THEN like ball IF like
ball THEN will buy the ball
3
Question Balls color? Answer Red
Working Memory
1
2
5
4
12Rules Based System (II)
- Rule 1 IF x has a sore throat AND
suspect bacterial infection THEN x has strep
throat - Rule 2 IF x temperature is gt 37 c THEN
x has a fever - Rule 3 IF x has been sick gt a month AND
x has a fever THEN suspect bacterial infection
- Patients temperature 38 c
????? ?????? 38
- Patient has been sick gt 2 months
?????? ????? ?? ?????
- Patient has a sore throat
?????? ???? ?????? ???
?????? ???? ??????? ?? ?????
13Semantic Networks
- ?? ???? ????? ????????? ?? ????? ??????? ?? ?????
??????? .. ??? ????? ?? ????? ??????? ??? ???
????? ???? .. - ?? ???? ??????
- ?????? ?? Objects ???? ??? nodes..
- ?????? ?? ??????? Link ???? ??? nodes..
- ???????? ??????????? Exceptional handling
- ??? ??????????? ?????? ????? ?? ?????? ?????
??? ??????? ???????? ??? ?? ???? ??????? ?? ?????
14The Example of Semantic Networks (Bird)
FACT Parrot is a bird. Typically bird has wings
and travel by flying. Bird category falls under
animal kingdom. All animal requires air to
breathe. Ostrich is a bird but travels by walk.
Wings ?????
has
is-a
Bird ????
Parrot ???????
Air ??????
Animal ?????
is-a
Breathe ?????
Fly ????
travel
Ostrich ???????
Walk ???
exceptional handling
travel
15Frames
- ? ?? ???? ????? ????????? ?????? ??????? ?? ?????
??????? ? ?? ????? ???? ?????? ?????? ??????? ???
??? ???? ??? ????? ??????. - Extension schemas and basic to OOP
- Class frame ? ????? ???? ???? ??????? ??????
????. ???? ??????? ???? ???? ??? ????? ????
??????. - Instance frame ? ???? ????? ????? ?? ???? ???????
????. ????? ????? ?? ???? ????? ????
16Frames Structure
Frame Name BIRD
Frame Name OSTRICH
Properties
Class Name BIRD
Color unknown Wings 2 Flies True
Properties
Color brown/dark Wings 2 Flies False
17Logic ?????? ???????
- The oldest representation existed ???? ?????
?????. - Implemented using PROLOG, LISP programming
language. - ????? ??????? ????? ??????? ????? ????? ???
????? ??? ??? ???? ??????? ???? ????? ??????. - ?????? ??? ?????? ????????? Propositional Logic
??? ?? ???? ??? ????? ?? ??? ?????.
18Logical Operators
- ??? ????? ??????? ???? ???????? ?? ??? ?????
????? ??? ?? ???? ?????? ( ?????) ?? ?????? ????
??????? ?? ??????? ??? ?? ???? ????? ?? ?????
(True or False).
General Name Formal Name Symbols
Not Negation
And Conjunction
Or Disjunction
If Then/Implies Conditional
If and only if Biconditional
19Facts ???????
- ??? ????? ???? ??? ???? ?? ?? ???? ?? ??? ??
???? ???? ??? ?????? ???? ????? ?? ????? ?? ???
????? ??? ???? ?????? - ?????? ????????? ???? ???? Artificial
intelligence is a computer system - ???? ????? Cat is an animal
- ??? ???? ??????? ?????
- ?? ???? ?????? ?? ???? ???? Ahmed mother is
married to Khalid father - ???? ??????? ???? ????? ????? (True)
- ??? ??? ????? ?????? ??????? Cat is human
- ??? ????? ????? (false)
20Rules ???????
- ??? ????? ???? ???? ??????? ?? ??????? ???
?????? ?? ??????? ????? ??????? ???? ??? ??
?????? ????. - ?? ???? ?????? ???? ?????? Easy come easy go
- ??? ???? ???? every way has an answer
- ?? ???? ??????? ?? ???? ???? if ??? ???? ??????
- ??? ??? ??????? ???? ????? ??? ??????? ?? ????
???????? if animal give milk it is a mammal
21Predicate Calculus Logic (FOPL)
- ?????? ????? ?????? ????? ??? ?????? ??????? ??
- operator (variables_1, variables_2,)
- EXAMPLES
- COMPUTER_COURSE(ARTIFICIAL_INTELLEGIENCE)
- ANIMAL(CAT)
22???? ?????? ????????? ?? ??????? ??????? ??????
????? Symbol ?????? Meaning
? ???For All
? ???? Exist
? ??? NOT
? ?And
v ?? OR
? ??? Then
gt ???? ?? Greater than
lt ??? ?? Less than
ge ???? ?? ?? ?????Greater than or equal
le ??? ?? ?? ?????Less than or equal
????? equal
23Predicate Calculus Logic (FOPL)
- Example She likes chocolate ? likes (she,
chocolate). - Universal quantifier (?X) ? to show all object is
true Eg All students ? (?X (student (X)) - Existential quantifier (?X) ? to show existence
/ partial object is true Eg Some people ?( ?X
(people (X))
24The Example of FOPL
Normal If it doesnt rain today, Ahmad will go
to the beach. FOPL ?rain(
today)? go(Ahmad, beach) Normal All volleyball
players are tall FOPL ?X
(volleyball_player (X) ? tall (X)) Normal Some
people like durian.
FOPL ?X (person(X) ? likes(X,
durian)) Normal Nobody likes wars
FOPL ? ?X likes (X, wars)
25The Truth Table
P Q NOT ?(P) AND P Q OR P v Q Implies P ? Q Biconditional P ?? Q
T T F T T T T
T F F F T F F
F T T F T T F
F F T F F T T
26The Example of Logical Operation
Consider P and Q as a propositional statement.
Show the result when (P (P ? Q)) ? Q
P Q P ? Q P (P ? Q) (P (P ? Q)) ? Q
T T T T T
T F F F T
F T T F T
F F T F T
27Implementing Propositional Logic
- IF the battery is dead THEN the car wont start
- P battery is dead Q car wont start
- Battery is dead T, car wont start T
- Battery not dead F, car will start F
- Equivalence to P ? Q
P Q P ? Q
T T T
T F F
F T T
F F T
28The Example of PROLOG Language
My name is Ahmad bin Abdullah. My father is
Abdullah bin Abdul Karim.
?- grandfather(X,Y). X abdul_karim , Y ahmad
?- father(X,Y). X abdullah , Y ahmad X
abdul_karim , Y abdullah
son(ahmad,abdullah). son(abdullah,abdul_karim).
grandfather(X,Y)- fahter(X, Somebody), fahter(S
omebody, Y). father(X,Y)- son(Y,X).
29The Application from PROLOG Language
Congkak!
Games Reversi
Travelling Salesman Analysis
30????? ?????? ???? ?? ???? ?????? ?????? ?????.
?????? ?? ???? ??? ????? ?? ???? ?? ??? ????????
?? ?????? 1.??? ??? ?????? ??????? 2. ???
??????
Mammals
Subset-of
2
legs
Person
HasMother
Subset of
Female Person
Male Person
Subset-of
Member of
Member of
Sister of
Mariam
Ahmad
legs
1
31????? ?????? ???? ?? ???? ?????? ?????? ?????.
?????? ?? ???? ??? ????? ?? ???? ?? ??? ????????
?? ?????? 1.??? ??? ?????? ??????? 2. ???
??????
- Sister_of(Mariam,Ahmed)
- Legs(Ahmed)1
- Member_of(Mariam,Female_Person)
???? ????????? ???? ?? ???? ????? ????? ???
????? ?????
Person ?????? ????? ? Person Subset of Mammal Legs 2 Has Mother Female Person
Ahmed ?????? ????? ? Ahmed Member of Male Person Legs 1 Has Sister Mariam