1 / 30

Knowledge-based Systems 2004 - 2005

Knowledge-based Systems 2004 - 2005. Lecture 3: Production Rules & Chaining Lora Aroyo (with slides from Michel Klein, VU, Amsterdam). Outline of topics. Representation & Reasoning Time & Space Uncertainty and Vagueness Production Rules & Chaining Rule-based systems

dixon
Download Presentation

Knowledge-based Systems 2004 - 2005

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Knowledge-based Systems2004 - 2005 Lecture 3: Production Rules & Chaining Lora Aroyo (with slides from Michel Klein, VU, Amsterdam)

  2. Outline of topics • Representation & Reasoning • Time & Space • Uncertainty and Vagueness • Production Rules & Chaining • Rule-based systems • Forward & Backwards chaining • Matching • Conflict resolution • Classification • Configuration • Diagnosis symbol level knowledge level Lecture 4

  3. Knowledge & Rules • Rules are symbol level (SL): • rules: representation of knowledge • chaining: search technique • Formalisation of knowledge level (KL) • Remember: • KL: analysis, using e.g. search spaces, search knowledge, task-sequencing knowledge, etc. • SL: formalisation of this, using representations as rules, frames, inheritance, etc. Lecture 4

  4. Example • in a computer program • knowledge level consists of the information contained in itsdata structures that it uses to perform certain actions • symbol level consists of the program's algorithms, the data structures themselves, etc. Lecture 4

  5. Knowledge & Rules (2) Choice: form of representation • KL • corresponds well to the expert • easy to analyse formally • etc. • SL • corresponds well to machine • efficient in execution • etc. • Choice at KL does not dictate choice at SL! Lecture 4

  6. Knowledge vs Symbol Level • Allen Newell, 1980s - a way to rationalize an agent's behavior • agent takes actions based on knowledge it possesses • in attempt to reach goals • chooses actions according to the principle of rationality • knowledge-based agents: • use pool of logical sentences • to infer conclusions about the world • knowledge level - specify what the agent knows and what its goals are • knowledge level - a logical abstraction separate from details of implementation • knowledge level - world oriented (concerns environment of agent) • symbol level - system oriented (includes mechanisms for agent to operate) • knowledge level rationalizes the agent's behavior • symbol level mechanizes the agent's behavior Lecture 4

  7. What is Rule-based System? • Working memory (temporary data) • facts that are acquired • Rule base (permanent data) • triggering pattern • action to be executed • Interpreter/Inference engine • controls process • retrieval / match • refinement / conflict resolution • execution • applies rules to the working memory Lecture 4

  8. What is a Rule? if A1 & … & An then B • Ai: • conditions • match against database (working memory) • obtain from user • B: • conclusion • add to working memory • more general: an action, e.g., removing something from the working memory Lecture 4

  9. Knowledge: Different Types • Heuristic association • IFaddress = hospitalTHENhealth = bad • Causal relation • IFdisease-type = infectionTHENtemp = high • Situation + action • IFdisease-type = infectionTHENprescription = anti-biotics • Logical relation • IFtemp > 37THENfever • advantages & disadvantages Model Representation knowledge type 1… rulesknowledge type n Lecture 4

  10. Modus Ponens • Mode that affirms • If P, then Q. • P. • Therefore, Q. • P  Q • P • ├ Q • If today is tuesday, then I will go to work. • Today is tuesday. • Therefore, I will go to work. Lecture 4

  11. Modus Tollens • Mode that denies • Proof by contrapositive • If P, then Q. • Q is false. • Therefore, P is false. • P  Q • ⌐Q • ├ ⌐P If there is fire here, then there is oxygen here. There is no oxygen here. Therefore, there is no fire here. If Lizzy was the murderer, then she owns an axe. Lizzy does not own an axe. Therefore, Lizzy was not the murderer. Lecture 4

  12. Resolution • X, P(X) implies Q(X). • P(a). • Therefore, Q(a). All Greeks are europeans. Homer is a Greek. Therefore, Homer is a European. Lecture 4

  13. Rules are not Logic • Rules are (possibly) non-monotonous IF DISEASEk THEN DRUGnIF DISEASEkAND PREGNANT THEN DRUGx • Rules are (possibly) uncertain IF PAIN-IN-CHEST THEN HEART-ATTACK (0.6)AND PAIN-IN-CHEST (0.9) HEART-ATTACK (0.6*0.9 = 0.54) Lecture 4

  14. if Shape=long &Color=(green or yellow) thenFruit=banana if Shape=(round or oblong) & Diam>4 then Fruitclass=vine if Seedcount=1 then Seedclass=stonefruit if Seedcount>1 then Seedclass=multiple if Fruitclass=vine &Color=green thenFruit=watermelon if Fruitclass=vine & Surface=rough & Color=tan then Fruit=cantaloupe if Fruitclass=tree&Color=orange & Seedclass=stonefruit thenFruit=apricot if Fruitclass=tree & Color=(red or yellow or green) & Seedclass=multiple thenFruit=apple Example: Rules Lecture 4

  15. Rules as an AND/OR Graph if Shape = long if Fruitclass = vine& Color = (green or yellow) & Color = greenthen Fruit = banana then Fruit = watermelon if Shape = (round or oblong)& Diam > 4then Fruitclass = vine Shape=long Fruit = banana Shape=round Shape=oblong Fruitclass = vine Diam > 4 Color=green Fruit = watermelon Color=yellow Lecture 4

  16. Rule Usage • Pattern Matching • checking whether a rule is applicable • Chaining • coupling of rules • E.g., IF A THEN B IF B THEN C A B C (forward) ?C ?B ?A (backward) Lecture 4

  17. goals data data goals Forward & Backward Chaining Forward Chaining • start from the data (data driven) • apply rules with true condition • conclusion is used for condition of another rule Backward Chaining • start from the condition to test (goal driven) • apply rules with usable conclusion • condition of applied rule is used for selecting another rule Lecture 4

  18. Example of Forward Reasoning • Facts: • Diameter = 1.5 • Shape = round • Color = orange • Surface = smooth • Seedcount = 10 • Reasoning: • {3, 5}  3 (Fruitclass = tree) • {5}  5 (Seedclass = multiple) • {10}  10 (Fruit = orange) • {set of possible rules}  the rule that was fired Lecture 4

  19. Reasoning Process: Forward • Matching: compare conditions to facts in working memory • Conflict Resolution: selecting applicable rules • Execution: • ADD new facts • DELete old facts • (which is indicated in the conclusion) Match Conflict Resolution Execution Lecture 4

  20. Matching = compare conditions to facts in working memory • Matching: form of patterns • AND, OR, NOT, ¬ • note: NOT = not present in working memory = not known not true (closed world assumption) • Matching: Variables IF colour-body = var1 AND colour-stem = var2 AND var1var2THEN …var1…var2… Lecture 4

  21. Matching (2) • Matching: Form of conditions • anonymous variables • Fruit = <shape, colour, diam, seedcount><long, ?, ?, var1> <long, $, var1> • Constraints: • <long, NOT red, $>(= <long, var1, $> AND var1  red ) • <long, red | green, $>(= <long, var1, $> AND (var1 = red OR var1 = green) ) Lecture 4

  22. Conflict Resolution = selecting applicable rules • select first applicable rule • reject rules which duplicate existing results • prefer rules with the most premises • prefer rules which match the most recent facts • select no rules already applied to same facts • select rule with highest certainty • … • or combinations Lecture 4

  23. Stop Conflict Resolution when • conflict resolution gives empty results • input of conflict resolution is empty • no rule is selected • goal-expression is in working memory Lecture 4

  24. Reasoning Process: Backward • Matching = compare conclusions & facts with goals • Execution = • replace goal by conditions of selected rules (= new goals)or • remove goal when it is a fact • Stop = no more goals • Conflict Resolution see forward • Backtracking: if rule for a goal does not succeed, then try other rules for that goal Lecture 4

  25. Choice: Forward / Backward • Forward when • many possible conclusions • few data is necessary • data acquisition is cheap • unfocussed • Backward when • few possible conclusions • a lot of data is necessary • data acquisition is expensive • focussed Lecture 4

  26. Example: Forward / Backward • Forward: Real-time process control = detect possible problems on the basis of incoming observations (measurements) • Backward: Classification = determine type/class on basis of properties • First forward, then backward: Diagnosis = First: generate hypothesis on basis of available data = Then: test hypothesis on basis of acquiring data Lecture 4

  27. Problems with Rules • Infinite rules • if A then A • if A then Bif B then Cif C then A • Inconsistent rules • if A then Bif B then Cif A & D then ¬C • unreachable conclusions • unusable conditions Lecture 4

  28. Problems with Rules (2) • Difficult to modify • if A1 then B1if A2 then B2…if An then Bn • additional condition ¬ C • if A1 & ¬C then B1if A2 & ¬C then B2…if An & ¬C then Bn Lecture 4

  29. 1 1 2 2 1’ 1’ 1 1 2 2 1’ 2 1 2’ 2’ 2’ Problems with Rules (3) Seemingly unnecessary steps Lecture 4

  30. What did we learn? • Rules consist of: • conditions • conclusions • Rules can be used for many different knowledge types • Rules are less general than first-order logic • There are two ways of chaining: • forward: starts from data (conditions of rules) • backward: starts from goals (conclusions of rules) • Conflict resolution is required to choose rule Lecture 4

More Related