Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas [email protected] 363CS...

25
Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas [email protected] 363CS – Artificial Intelligence

Transcript of Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas [email protected] 363CS...

Page 1: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

Lecture 7: 17/5/1435

knowledge Representation

Lecturer/ Kawther [email protected]

363CS – Artificial Intelligence

Page 2: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

Introduction Real knowledge representation and reasoning

systems come in several major varieties. These differ in their intended use, expressivity,

features,… Some major families are

1. Logic programming languages

2. Theorem provers

3. Rule-based or production systems

4. Semantic networks

5. Frame-based representation languages

6. Databases (deductive, relational, object-oriented, etc.)

7. Constraint reasoning systems

8. Description logics

9. Bayesian networks

10. Evidential reasoning

Page 3: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

What is Knowledge?

data – primitive verifiable facts, of any representation. Data reflects current world,often voluminous frequently changing.

information – interpreted dataknowledge – relation among sets of data

(information), that is very often used for further information deduction. Knowledge is (unlike data) general. Knowledge contains information about behaviour of abstract models of the world.

Page 4: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

Data, Information, Data, Information, KnowledgeKnowledge? ?

4

DATA

INFORMATION

KNOWLEDGE

WISDOM

Non-algorithmic(heuristic)

Algorithmic

Non-programmable

programmable

Page 5: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

Knowledge Knowledge Representation Representation TechniquesTechniques

5

TECHNIQUES

Object-Attribute Value

Frames

Semantic Networks

Logic

Rules

Page 6: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

Object-Attribute-Value Object-Attribute-Value (OAV)(OAV)

6

Using fact : “

•Eg: The ball’s color is red (assign red to the ball’s 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

Page 7: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

OAV Triplets Diagram OAV Triplets Diagram (i)(i)

7

Fact :=: “The chair’s color is red and priced at $ 35.00 ”

CHAIR

RED

$ 35.00

Color

Priced

Object Attribute Value

Page 8: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

OAV Triplets Diagram OAV Triplets Diagram (ii)(ii)

8

Fact :=: “TIN 313 is a compulsory subject for MSc Int Sys., code for Artificial Intelligence, and taught by Mr Yousef Salahat”

TIN 313

MSc Int. Sys

Mr Yousef Salahat

Compulsory subject

Taught

Artificial Intelligence

Code

Page 9: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

Rules BasedRules Based

9

IF condition THEN action statements.      (premise              (goal      antecedent)          consequent)

•Example IF “Temperature is hot” THEN “turn on the air-conditioning system”

Page 10: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

Rules Based System (I)Rules Based System (I)

10

Rule 1:IF the ball’s color is red THEN I like the ball.

Rule 2:IF I like the ball THEN I will buy the ball.

IF ball’s color = red THEN like = ball

IF like = ball THEN will buy the ball

Ball’s color = red

Like = ball

Will buy = ball

Question: Ball’s color?

Answer: Red1

2

3

45

Working Memory

Knowledge Base

Page 11: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

Rules Based System (II)Rules Based System (II)

11

•Rule 1: IF x has a sore throat AND suspect bacterial infectionTHEN x has strep throat

•Rule 2:IF x temperature is > 37 cTHEN x has a fever

•Rule 3:IF x has been sick > a monthAND x has a feverTHEN suspect bacterial infection

•Patient’s temperature = 38 c

•Patient has been sick > 2 months

•Patient has a sore throat

•Conclusion ?

Patient has Strep throat

38حرارة المريض

المريض تعبان من شهرين

المريض لديه التهاب حلق

المريض لديه بكتيريا في الحلق

Page 12: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

The Example of Semantic The Example of Semantic Networks (Bird)Networks (Bird)

12

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.

AnimalAnimalBirdBird

WingsWings

ParrotParrot AirAir

OstrichOstrich

WalkWalk

FlyFly

is-a

travel

travel

has

is-a

Breathe

“exceptional handling”

Page 13: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

Frames StructureFrames Structure

13

Frame Name: BIRD

Properties:

Color = unknown

Wings = 2

Flies = True

Frame Name: OSTRICH

Properties:

Color = brown/dark

Wings = 2

Flies = False

Class Name: BIRD

Page 14: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

LogicLogic المنطق الرياضي المنطق الرياضي

14

•The oldest representation existed

•Implemented using PROLOG, LISP programming language.

Page 15: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

Logical OperatorsLogical Operators

General Name

Formal Name

Symbols

Not Negation

And Conjunction

Or Disjunction

If… Then/Implies

Conditional

If and only if Biconditional

15

Page 16: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

FactsFacts

16

•Artificial intelligence is a computer system

•Cat is an animal

Or combine

•Ahmed mother is married to Khalid father = True

•Cat is human = false

Page 17: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

RulesRules القواعدالقواعد

17

•Easy come easy go

•every way has an answer

or

If

• animal give milk it is a mammal

Page 18: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

Predicate Calculus Logic Predicate Calculus Logic (FOPL)(FOPL)

18

operator (variables_1, variables_2,…)

EXAMPLES:

COMPUTER_COURSE(ARTIFICIAL_INTELLEGIENCE)

ANIMAL(CAT)

Page 19: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

Mathmatical LogicMathmatical Logic

Meaning Symbol

For All

Exist

NOT

And

OR v

Then

Greater than gt

Less than lt

Greater than or equal ge

Less than or equal le

equal =

19

Page 20: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

Predicate Calculus Logic Predicate Calculus Logic (FOPL)(FOPL)

20

•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))]

Page 21: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

The Example of FOPLThe Example of FOPL

21

Normal: “If it doesn’t 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)

Page 22: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

Implementing Propositional Implementing Propositional LogicLogic

P Q P Q

T T T

T F F

F T T

F F T

22

“IF the battery is dead THEN the car won’t start”

•P = battery is dead & Q = car won’t start

•Battery is dead = T, car won’t start = T

•“Battery not dead” = F, “car will start” = F

•Equivalence to P Q

Page 23: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

23

Mammals Mammals

PersonPerson

Female Person

Female Person

Male

Person Male

Person

Mariam Mariam Ahmad Ahmad

HasMother

Sister of

Subset of

Member of

Subset-of

Subset-of

Member of

2legs

legs

1

Example:

Page 24: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

Sister_of(Mariam,Ahmed)Legs(Ahmed)=1Member_of(Mariam,Female_Person)

Ahmed frame: : Ahmed

Member of : Male PersonLegs: 1

Has Sister : Mariam

Person frame:Person:

Subset of : MammalLegs: 2

Has Mother : Female Person

24

Example

:حالة استثنائيةأحمد له رجال

واحدة بينما لكل البشر رجالن

Page 25: Lecture 7: 17/5/1435 knowledge Representation Lecturer/ Kawther Abas k.albasheir@sau.edu.sa 363CS – Artificial Intelligence.

ResolutionTheorem. Resolution is sound. Thai

is, all derived formulas are entailed by the given ones

Theorem: Resolution is refutationally complete.

That is, if a clause set is unsatisfiable, then Resolution will derive the empty clause eventually.

If a clause set is unsatisfiable and closed under the application of resolution inference rule then it contains the empty clause.

35