mp 2009 knowledge rep

40
Knowledge Representation CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009) 1 Rule-based Expert System Structure of rule-based Characteristics of rule-based Forward Chaining Backward Chaining Advantage & Disadvantage of rule- based Predicate Calculus Topic 2

Upload: tahipunyaorang

Post on 08-May-2017

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

1

Knowledge Representation

Rule-based Expert SystemStructure of rule-based

Characteristics of rule-basedForward ChainingBackward Chaining

Advantage & Disadvantage of rule-basedPredicate Calculus

Topic 2

Page 2: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

2

Knowledge?◦ “Know-how”, in some domain◦ Theoretical or practical understanding of a domain /

subject / area◦ Data Information Knowledge Meta-knowledge◦ It consists of relationship between information

Categories of knowledge◦ Priori knowledge

universally true and cannot be denied without contradiction◦ Posterior knowledge

the truth or false of the knowledge can be verified using sense experience

What is Knowledge?

Page 3: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

3

Categories of knowledge - continue◦ Procedural Knowledge

Describe how to solve the problem Provide direction on how to do something

◦ Declarative Knowledge Describe what is known about a problem Know something is true and false

◦ Meta-Knowledge Describe knowledge about another knowledge

◦ Heuristics Knowledge Describe rules of thumb that guides the reasoning process

◦ Structural Knowledge Describe an expert overall mental model of the problem

◦ Tacit Knowledge Unconscious knowledge, can not be expressed by language Unconsciously know how to do something

What is Knowledge? - continue

Page 4: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

4

Two ways to represent knowledge:◦ Formal

Predicate Calculus Propositional logic Resolution

◦ Informal Object-Attribute Value (OAV) Semantic Network Production Rules Frames

What is Knowledge? - continue

Page 5: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

5

3 common knowledge representation schemes

Logic – Propositional Logic, Predicate Calculus when human/system receive input or facts about

something Eg:

Representation: Regular sentence: Abu makan nasi Logical sentence: abu_makan_nasi or makan (Abu,

nasi)

What is Knowledge? - continue

Page 6: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

6

3 common knowledge representation schemes◦ Object (Frames)

There are a few methods in object-based representation teknik OAV, rangkaian semantic, Kerangka, pohon keputusan skrip.

What is Knowledge? - continue

Page 7: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

7

3 common knowledge representation schemes

Rules Use IF condition THEN action

What is Knowledge? - continue

Page 8: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

8

◦ What to Represent? Objects: facts about object in our world domain – Ex.

Guitars have single strings, trumpets are brass instruments

Events: actions that occur in our world – Steve Vai played the guitar in Frank Zappa’s Band

Performance: a behavior like playing the guitar involves knowledge about how to do things.

Meta-knowledge: knowledge about what we know.

What is Knowledge? - continue

Page 9: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

9

Expert?

◦ Those who possess knowledge are called experts◦ Most powerful or important people in an organization◦ Has deep knowledge (facts and rules) and strong practical

experience in a particular domain◦ Human mental process is internal and it’s too complex to be

represented as an algorithm◦ Most experts are capable of expressing their knowledge in

the form of rules for problem solving

What is Knowledge? - continue

Page 10: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

10

Statements represented in the IF-THEN form are called production rules or just rules

A rule provides some description of how to solve problem

Term “rule” in AI that is the most commonly used type of knowledge representation

Rule is defined as a IF-THEN structure where given information or facts in IF part and actions in THEN part

Knowledge Representation

Page 11: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

11

Statements represented in the IF-THEN form are called production rules or just rules

A rule provides some description of how to solve problem

Term “rule” in AI that is the most commonly used type of knowledge representation

Rule is defined as a IF-THEN structure where given information or facts in IF part and actions in THEN part

Knowledge Representation

Page 12: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

12

Example of rules from expert Expert in crossing roads:

Knowledge / RulesIF the ‘traffic light’ is greenTHEN the action is go

IF the ‘traffic light’ is redTHEN the action is stop

Rule-Based Expert System

Page 13: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

13

Rules as knowledge representation scheme◦ Rules contain two parts:

IF part – antecedent (premise of condition) THEN part – consequent (conclusion or action)

◦ In general, rules can contain multiple antecedents joint by AND (conjunction), OR (disjunction) or combination of both

◦ Good habit to avoid mixing conjunctions and disjunctions in the same rule

◦ The consequent of rule can also have multiple clauses

Rule-Based Expert System - continue

Page 14: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

14

Examples of Rules Single:

IF <antecedent>THEN <consequent>

ConjuctionsIF <antecedent 1>AND <antecedent 2> :AND <antecedent n>THEN <consequent>

Rule-Based Expert System - continue

Page 15: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

15

DisjuctionsIF <antecedent 1>OR <antecedent 2>

:OR <antecedent n>THEN <consequent>

Consequent with multiple clausesIF <antecedent>THEN <consequent 1>

<consequent 2>:

<consequent n>

Rule-Based Expert System - continue

Page 16: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

16

Antecedent◦Two parts:

Object (linguistic part) eg. ‘traffic light’ Value eg. red Object and value are linked by an operator

eg. Is, are, is not, are not Operator identifies the object and assigns the value Operator assign a symbolic value to a linguistic object Mathematical operator define object as numerical and

assign it a numerical valueeg IF ‘age of a customer’ < 18

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

Rule-Based Expert System - continue

Page 17: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

17

Consequent Combines an object and a value connected by an operator Operator assigns the value to the linguistic object

eg. IF ‘traffic light’ is greenTHEN action is go

Numerical objects and simple arithmetic expression can be used in rule consequent

eg IF ‘income’ > 16283THEN ‘discount’ = ‘income’ * 1.5 / 100

Rule-Based Expert System - continue

Page 18: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

18

Rules can represent◦Relations◦Recommendations◦Directives◦Strategies◦Heuristics

Rule-Based Expert System - continue

Page 19: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

19

Examples◦Relations

IF the ‘fuel tank’ is emptyTHENthe car is dead

◦RecommendationsIF the season is autumnAND the sky is cloudyAND the forecast is drizzleTHEN the advice is ‘take an umbrella’

Rule-Based Expert System - continue

Page 20: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

20

◦DirectivesIF the car is deadAND the ‘fuel tank’ is emptyTHEN the action is ‘refuel the car’

◦StrategiesIF the car is deadTHEN the action is ‘check the fuel

tank’step1 is completeIF step1 is completeAND the ‘fuel tank’ is fullTHEN the action is ‘check the battery’step2 id complete

Rule-Based Expert System - continue

Page 21: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

21

◦HeuristicsIF the spill is liquidAND the ‘spill pH’ < 6AND the ‘spill smell’ is vinegarTHEN the ‘spill material’ is ‘acetic

acid’

Rule-Based Expert System - continue

Page 22: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

22

Expert System ◦Expert system – a computer program capable of

performing at the level of human expert in a narrow problem area

◦Use computer to Act as an intelligent assistant in some domain to solve

problem Be able to integrate new knowledge and show

knowledge in a form that is easy to read and understand

Able to explain / show how it reaches a particular conclusion

Page 23: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

23

Expert System Shell - continue

◦Expert system shell can be considered as an expert with knowledge removed

◦Users has to add knowledge in the form of rules and provide relevent data to solve problem

◦Five members in Expert System Development

Page 24: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

24

Expert System Shell - continue

◦Expert System development team

Page 25: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

25

Structure of Rule-based Expert System

◦Production system

Page 26: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

26

Structure of Rule-based Expert System

◦Basic Structure

Page 27: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

27

Structure of Rule-based Expert System◦Complete Structure

Page 28: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

28

Comparison of human experts, expert system and conventional program

Characteristics of Rule-Based System

Page 29: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

29

The inference engine compares each rule in knowledge base with facts contain in the database

Inference Technique

The matching of rule IF parts to the facts produce inference chains

The inference chains indicates how an expert system applies the rules to reach a conclusion

Page 30: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

30

Example of chaining inference techniquesSuppose Database contains facts A, B, C, D and E Knowledge base contains three rules

Rule 1: IF Y is trueAND D is trueTHEN Z is true

Rule 2: IF X is trueAND B is trueAND E is trueTHEN Y is true

Rule 3: IF A is trueTHEN X is true

Inference Technique - continue

Page 31: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

31

Inference chain Inference Technique - continue

A X

B

E

Y

DZ

Diagram indicates how the expert system applies the rules to infer fact Z

The inference engine must decide when the rules have to be fired (executed)

Two principal ways are Forward Chaining and Backward Chaining (Waterman & Hayes Roth 1978)

Rule 3

Rule 2Rule 1

Page 32: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

32

Forward chaining data driven◦ Premise clause match situation then assert

conclusion Inference strategy that begins with a set of

known facts, derives new facts using rules whose premises match the known facts, continues until goal reached or no more rules matches.

Example:-◦ As given in slides 26 & 27

Forward Chaining

Page 33: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

33

Example◦ Page 37 of (Negnevitsky, 2005)

Forward Chaining – continue

Page 34: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

34

Example:-◦ Patient visit a doctor to complaint about certain ailments.

Rules :-◦ Rule 1:

IF patient has sore throatAND suspect bacterial infectionTHEN believe patient has strep throat

◦ Rule 2:IF patient temperature > 100THEN patient has fever

◦ Rule 3IF patient sick over a monthAND patient has a feverTHEN suspect a bacterial infections

Assert the following facts (from user):-1. Patient temperature > 1022. Patient has been sick for 12 months3. Patient has sore throat

Forward Chaining - continue

Page 35: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

35

Backward Chaining goal driven◦ Determine facts in the conclusion to prove the

conclusion is true An inference strategy that attempts to

prove a hypothesis by gathering supporting information

Example:-◦ A patient visit a doctor and after listening, the

doctor believe patient has strep throat thus doctor have to prove his assumption

Backward Chaining

Page 36: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

36

Rule 1:IF there are signs of throat infectionAND there is evidence that organism is streptococcusTHEN patient has strep throat

Rule 2:IF patient throat is redTHEN there are signs of throat infections

Rule 3:IF stains of organisms is gramposAND morphology of the organism is cossusAND growth of the organism is chainsTHEN there is evidence that the organism is streptococcus

OBJECTIVE:- to prove that ‘The patient have strep throat’

Backward Chaining - continue

Page 37: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

37

Example: Page 39 of (Negnevitsky, 2005)Backward Chaining - continue

Page 38: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

38

To study how domain expert solves problem◦ Choose forward chaining if the expert needs to gather information and

infers from it◦ Choose backward chaining if the expert begins with hypothetical solution

and find facts to prove it

In expert system, it is a natural way to use forward chaining for analysis and interpretation eg DENDRAL – determine the molecular structure of unknown soil based on its mass spectral data (Feigenbaum et al. 1971)

For diagnostic purposes, usually backward chaining is usedeg MYCIN – a medical expert system for diagnosing infectious blood diseases (Shortliffe, 1976)

How Do We choose Forward Chaining or Backward Chaining

Page 39: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

39

Many expert system shells use a combination of forward and backward chaining inference techniques

The basic inference mechanism is usually backward chaining. Only when a new fact is establish, forward chaining is employed to maximise the use of the new data

Can we combine forward and backward chaining

Page 40: MP 2009 Knowledge Rep

CSC463-Fundamentals of AI (UiTM Trg MP Jul 2009)

40

Advantages◦ Natural language representation◦ Uniform structure◦ Separation of knowledge from its processing◦ Dealing with incomplete and uncertain knowledge

Disadvantages◦ Opaque relations between rules◦ Ineffective search strategy◦ Inability to learn

Advantage & Disadvantage of Rule-Based System