1 / 42

DT228/3 Intelligent Systems Development

DT228/3 Intelligent Systems Development. Rule-Based Expert Systems. Contents. In this lecture we will review rule-based expert systems What do we mean by rule-based expert systems? Architecture of a rule-based expert system Inference in rule-based expert systems Forward chaining

kalkin
Download Presentation

DT228/3 Intelligent Systems Development

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. DT228/3 Intelligent Systems Development Rule-Based Expert Systems

  2. Contents In this lecture we will review rule-based expert systems • What do we mean by rule-based expert systems? • Architecture of a rule-based expert system • Inference in rule-based expert systems • Forward chaining • Backward chaining • Limitations of rule-based expert systems

  3. What is an Expert System? An expert system is a computer system that: • Performs functions similar to those normally performed by a human expert • Uses a representation of human expertise in a specialist domain to perform functions similar to a human domain expert • Operates by applying an inference mechanism to a body of specialist expertise represented in a knowledge base

  4. What is a Rule-Based Expert System? If you had to explain to somebody how to cross a road you could do it with simple rules Statements in this IF-THEN form are referred to as production rules A rule-based expert system captures the knowledge of an expert in a set of production rules and combines these with observed data to generate inferences IF: the traffic light is green THEN: the action is go IF: the traffic light is red THEN: the action is wait

  5. Production Rules Production rules • IF-THEN expressions • IF some condition(s) exists THEN perform some action(s) Condition-action pair • Condition: pattern that determines when a rule may be applied to problem instance • Action: defines associated problem solving step Antecedent – Consequent • IF <antecedent> THEN <consequent>

  6. Production Rules (cont…) Rule can have multiple antecedents • Conjunction AND • Disjunction OR • Or a combination of both IF <antecedent0> AND <antecedent1> … AND <antecedentn> THEN <consequent> IF <antecedent0> OR <antecedent1> … OR <antecedentn> THEN <consequent> IF <antecedent0> AND <antecedent1> … AND <antecedentn> OR <antecedent0> OR <antecedent1> … OR <antecedentn> THEN <consequent>

  7. Production Rules (cont…) Consequents can also have multiple clauses Some production rule examples IF <antecedent> THEN <consequent0>, <consequent1>, …<consequentn-1>,<consequentn> IF the fuel tank is empty THEN the car is dead IF patient has stomach pains AND (temperature > 98 OR patient is nauseous) THEN diagnosis is appendicitis, action is call the surgeon IF the season is autumn AND the sky is cloudy AND the forecast is drizzle THEN advice is take an umbrella

  8. Rule-Based Expert System Model Long Term Memory Working Memory Fact Production Rule Inference Engine Production System Explanation Facilities User Interface User

  9. Characteristics of a Rule-Based Expert System

  10. Production System Model Long Term Memory Working Memory Fact Production Rule Inference (Reasoning) Conclusion

  11. Production System Long-term memory • Stores the production rules used to make inferences Working memory • Current state of world • Pattern that is matched against the condition part of rules to select appropriate problem-solving actions • Actions may alter working memory

  12. Production System (cont…) Inference cycle (Recognize-Act Cycle) • Working memory is initialized at start of reasoning • Current state is maintained as set of patterns in working memory • Patterns matched against conditions in rules to find a satisfied rule • Fire the selected rule • An action is performed changing working memory • Repeat until working memory no longer matches rule conditions

  13. Data Driven Search Strategy Forward Chaining: Begins with problem description and infers new knowledge from the data Applies rules of inference to current description of world and adds inferred results to problem description • Many rules may be executed that have nothing to do with the goal Rule matching continues until the goal has been reached May not be efficient

  14. Data-Driven: How Does it Work? Data-driven search proceeds in cycles Inference cycle matches the current state of the world against the sets of production rules • The current state of the world is the data that is assumed to be true or deduced as true from previously fired production rules Action of a rule adds new fact(s) to the working memory when fired Cycle stops when no further rules can be fired

  15. Forward Chaining Example Database A C B D E Knowledge Base Y & D → Z X & B & E → Y A → X C → L L & M → N Suppose that we know the facts A, B, C, D, E and the rules shown in the knowledge base to the left What facts can we infer from this?

  16. Forward Chaining Example Database A C B D E X Knowledge Base Y & D → Z X & B & E → Y A → X C → L L & M → N Inference Cycle 1

  17. Forward Chaining Example Database A C B D E X L Knowledge Base Y & D → Z X & B & E → Y A → X C → L L & M → N Inference Cycle 1

  18. Forward Chaining Example Database Database A C B D E A C B D E X X L L Knowledge Base Knowledge Base Y & D → Z Y & D → Z X & B & E → Y X & B & E → Y A → X A → X C → L C → L L & M → N L & M → N Inference Cycle 1 Inference Cycle 2

  19. Forward Chaining Example Database Database A C B D E A C B D E X X L Y L Knowledge Base Knowledge Base Y & D → Z Y & D → Z X & B & E → Y X & B & E → Y A → X A → X C → L C → L L & M → N L & M → N Inference Cycle 1 Inference Cycle 2

  20. Forward Chaining Example Database Database Database A C B D E A C B D E A C B D E X X L Y L X L Y Knowledge Base Knowledge Base Knowledge Base Y & D → Z Y & D → Z Y & D → Z X & B & E → Y X & B & E → Y X & B & E → Y A → X A → X A → X C → L C → L C → L L & M → N L & M → N L & M → N Inference Cycle 1 Inference Cycle 2 Inference Cycle 3

  21. Forward Chaining Example Database Database Database A C B D E A C B D E A C B D E X X L Y L X L Y Z Knowledge Base Knowledge Base Knowledge Base Y & D → Z Y & D → Z Y & D → Z X & B & E → Y X & B & E → Y X & B & E → Y A → X A → X A → X C → L C → L C → L L & M → N L & M → N L & M → N Inference Cycle 1 Inference Cycle 2 Inference Cycle 3

  22. Forward Chaining Example Database Database Database A C B D E A C B D E A C B D E After inferring facts X, L, Y and Z there are no more rules that can be fired X X L Y L X L Y Z Knowledge Base Knowledge Base Knowledge Base Y & D → Z Y & D → Z Y & D → Z X & B & E → Y X & B & E → Y X & B & E → Y A → X A → X A → X C → L C → L C → L L & M → N L & M → N L & M → N Inference Cycle 1 Inference Cycle 2 Inference Cycle 3

  23. Goal-Driven Search Strategy Backward Chaining: A desired goal is placed in working memory, inference cycle attempts to find evidence to prove it Search knowledge base for rules that might lead to goal • Rules that have the goal in their action parts If condition of such rule matches fact in working memory then rule is fired and goal is proved

  24. Goal Driven: How Does it Work? Goal driven search proceeds in cycles Stack rule • Set up sub-goal to prove condition • Search for rules to prove sub-goal • Continue process of stacking until no rules found that can prove sub-goal Most efficient when want to infer one particular fact User may be asked to input additional facts

  25. Backward Chaining Example Database A C B D E Suppose that we know the facts A, B, C, D, E and the rules shown in the knowledge base to the left Can we infer the fact Z? Knowledge Base Y & D → Z X & B & E → Y A → X C → L L & M → N

  26. Backward Chaining Example Database A C B D E Z Knowledge Base Y & D → Z X & B & E → Y A → X C → L L & M → N Goal: Z

  27. Backward Chaining Example Database A C B D E Z Knowledge Base Y & D → Z X & B & E → Y A → X C → L L & M → N Goal: Z

  28. Backward Chaining Example Database Database A A C C B B D D E E ? Z Y Knowledge Base Knowledge Base Y & D → Z Y & D → Z X & B & E → Y X & B & E → Y A → X A → X C → L C → L L & M → N L & M → N Goal: Z Sub-goal: Y

  29. Backward Chaining Example Database Database A A C C B B D D E E ? Z Y Knowledge Base Knowledge Base Y & D → Z Y & D → Z X & B & E → Y X & B & E → Y A → X A → X C → L C → L L & M → N L & M → N Goal: Z Sub-goal: Y

  30. Backward Chaining Example Database Database Database A A A C C C B B B D D D E E E ? ? Z Y X Knowledge Base Knowledge Base Knowledge Base Y & D → Z Y & D → Z Y & D → Z X & B & E → Y X & B & E → Y X & B & E → Y A → X A → X A → X C → L C → L C → L L & M → N L & M → N L & M → N Goal: Z Sub-goal: Y Sub-goal: X

  31. Backward Chaining Example Database Database Database A A A C C C B B B D D D E E E ? ? Z Y X Knowledge Base Knowledge Base Knowledge Base Y & D → Z Y & D → Z Y & D → Z X & B & E → Y X & B & E → Y X & B & E → Y A → X A → X A → X C → L C → L C → L L & M → N L & M → N L & M → N Goal: Z Sub-goal: Y Sub-goal: X

  32. Backward Chaining Example Database Database A A C C B B D D E E Database A C B D E X ? Z Y Knowledge Base Knowledge Base Knowledge Base Y & D → Z Y & D → Z Y & D → Z X & B & E → Y X & B & E → Y X & B & E → Y A → X A → X A → X C → L C → L C → L L & M → N L & M → N L & M → N Goal: Z Sub-goal: Y Sub-goal: X

  33. Backward Chaining Example Database A C B D E Database Database A C B D E A C B D E X Y X Z Knowledge Base Knowledge Base Knowledge Base Y & D → Z Y & D → Z Y & D → Z X & B & E → Y X & B & E → Y X & B & E → Y A → X A → X A → X C → L C → L C → L L & M → N L & M → N L & M → N Goal: Z Sub-goal: Y Sub-goal: X

  34. Backward Chaining Example Database Database Database A C B D E A C B D E A C B D E X Y Z X Y X Knowledge Base Knowledge Base Knowledge Base Y & D → Z Y & D → Z Y & D → Z X & B & E → Y X & B & E → Y X & B & E → Y A → X A → X A → X C → L C → L C → L L & M → N L & M → N L & M → N Goal: Z Sub-goal: Y Sub-goal: X

  35. Backward Chaining Example Database Database Database A C B D E A C B D E A C B D E Backward chaining inferred Z from the facts and rules that were available X Y Z X Y X Knowledge Base Knowledge Base Knowledge Base Y & D → Z Y & D → Z Y & D → Z X & B & E → Y X & B & E → Y X & B & E → Y A → X A → X A → X C → L C → L C → L L & M → N L & M → N L & M → N Goal: Z Sub-goal: Y Sub-goal: X

  36. Data Driven Vs. Goal Driven Data-driven reasoning is appropriate when there exist many equally acceptable goal states, a narrow body of facts and rules and a single initial state • Required facts are available • It is difficult to form a goal to verify Goal directed inference is relevant when:- • Relevant data must be acquired during the inference process • Large number of applicable rules exist • An obvious goal to verify is available

  37. Conflict Resolution What if more than one rule matches a in a particular situation? We have actually already seen this in one of our examples What should we do? Database A C B D E Knowledge Base Y & D → Z X & B & E → Y A → X C → L L & M → N

  38. Conflict Resolution What if more than one rule matches a in a particular situation? We have actually already seen this in one of our examples What should we do? • The answer is referred to as conflict resolution Database A C B D E X L ? ? Knowledge Base Y & D → Z X & B & E → Y A → X C → L L & M → N

  39. Conflict Resolution (cont..) What if more than one rule matches a in a particular situation? • Patterns are matched against conditions in rules to produce a set of satisfied rules • These rules are known as the conflict set • Conflict Resolution • One rule is selected and fired • Action is performed which changes working memory • Repeat until working memory no longer matches rule conditions

  40. Conflict Resolution (cont..) How do you choose which rule from the conflict set to fire? • Rule Ordering • Choose the first rule in the text, ordered top-to-bottom. • Recency • Prefers rules that use facts most recently added • Focuses on single line of reasoning • Specificity • More specific rules are preferable to more general • A rule is more specific if it has more conditions - implies a rule will match fewer potential working memory patterns

  41. Conflict Resolution (cont..) • Refraction • Once a rule has fired it may not fire again until working memory elements that match its conditions have been modified • Discourages looping Structure of rules and the conflict resolution scheme used controls the fashion in which the space is searched Allows us to encode heuristics into production rules

  42. Summary In this lecture we have covered • What is a rule-based expert systems? • Overall architecture of rule-based expert systems • How inference works in a rule-based expert system

More Related