Rule-Based Expert Systems Expert Systems Acknowledge that computers do not posses general knowledge (common sense) Attempt to train computer in a “limited domain” Experts have deep, often complex knowledge, but generally for a limited domain Can A Computer Do What an Expert Does? Limited domain The system has a finite, and relatively small number of things it needs to “know” about. The processing might be complex, but computers are good at that. Can the expert knowledge be extracted? Knowledge Engineers do the extracting Experts provide their knowledge Programmers encoded the knowledge into an “expert system.” Some History In the early to mid 1980’s the desire to build “expert systems” was very high in the US and elsewhere. Japanese 5th generation computing project AI researchers aggressively recruited by industry Expert systems were considered by many to be “the next big thing.” Overstatement of Capabilities The results of several expert systems were oversold. Prospector didn’t really discover millions of dollars worth of Molybdenum. The originators of the system never made this claim, but despite their efforts to stop it, the story is repeated to this day. Frequently Cited Examples of Expert Systems MYCIN Infectious blood disease diagnosis Dendral Analyzed mass-spectra (chemistry) PROSPECTOR Geological analysis R1 Configure a VAX computer Expert knowledge can be difficult to extract Experts often do not really know how they do things themselves. Although the expert can perform the tasks, he/she does not necessarily have access to the mechanism used. Experts have reasons to be uncooperative in the process of disseminating their expertise. Experts often disagree on both processes and conclusions. The process might require judgment that is not easily codified. Rule-based Expert Systems Sets of IF-THEN rules are established to codify expert knowledge. If <antecedent> then <consequent> Antecedents can be combined using logical operators If <a> and <b> or <c> then <consequent> IF “3 enemy stones in a row” AND NOT “3 friendly stones in a row” Then “place a stone in the row with 3 enemy stones.” Knowledge Engineers Tasked with working with the expert to extract expertise and codify in a set of rules. Has training in the development of expert systems, but not necessarily in the application domain. Know the capabilities of the technology and knows how to apply it. Expert System Shells Separate the mechanisms for making inference from the rule base Facilitate the entry of rules by non- programmers Provide reuse for what would otherwise be redundant code across expert systems Expert System Components Inference Engine Forward or Backward-chaining Conflict resolution algorithms Rule-base IF-THEN rules Database Current state on which IF-THEN rules are applied. Explanation Facilities An important advantage rule-based expert systems hold over other types of AI Inference Engines Forward-chaining Submit current data to all rules Rules make conclusions, which in turn, generate new data “Inference Chains” result from initial data and the data generated in conclusions. Backward-chaining Try to prove a conclusion by working backwards from ways to prove it. Forward-chaining Example (A,B,E, and D are given) If Y and D then Z If X and B and E then Y If A then X If C then L If L and M then N A X B Y Z L C D E Example from Negnevitsky Backward Chaining Prolog uses backward chaining Work backward from the goal. Check rules that can provided the desired goal. Backward Chaining Example If Y and D then Z If X and B and E then Y If A then X If C then L If L and M then N A X B Y Z B C E D D E Forward or Backward Chaining? What do experts use? Are we trying to prove a particular hypothesis? Backward chaining Are we trying to find all possible conclusions? Forward chaining What does the rule set look like? Could be either one or a combination of both. Conflict Resolution What happens when two rules provide conflicting conclusions? If it has feathers then it is a bird If it can’t fly then it is not a bird What if has feathers, but can’t fly? Conflict Resolution Methods Use rule-order as an implied priority The first rule to provide an answer is used. Assign a priority to each rule, the rule with the higher priority is sustained. Longest Matching Strategy uses the rule with the most specific information. If it cannot fly and has feathers then it is a bird. Certainty-based conflict resolution Measures of certainty are provided for data and rules. Most certain rule is sustained. Frame-based Expert Systems Frame Marvin Minsky (1975) Frame-based Expert Systems utilize frames to encapsulate data and methods about an entity. Frames are similar to objects, but the data types and processing methods are quite different. Frames A frame is a data structure with typical knowledge about a particular object or concept [Negnevitsky]. Frame is a collection of attributes called “slots” Example slots for a truck Engine size Number of wheels Slots consists of attribute/value pairs called facets Value/18 Default Value/4 Range/[3-18] User Query/”Enter the number of wheels:” Demons Slots or facets can contain procedures that are executed with the data is accessed or changed When_Changed demon is executed when new information is placed in a slot. Might include forward chaining or backward chaining rules When_Needed demon is executed when information is read from a slot Might include code to read sensors or try to prove a goal Inheritance Frames can inherit from other frames. Frame implicitly contains all the slots contained in the inherited frame unless the frame overrides the slot with its own definition. Inheritance is established with the “IS-A” relationship In frames, inheritance is principally used to provide default values, rather than structure and methods. Other Frame Relationships Aggregation (a-part-of) An engine is a-part-of a car A spark plug is a-part-of an engine Association (Other semantic relationships) Examples Ownership (computer has-owner Joe) Uses (dentist uses drill) Location (Joe is-near theDesk) No Limits on Relationships Frame can employ multiple inheritance Frame can have any number of relationships Relationships can be of any type that is useful. Interactions of Frames and Rules Different frame-based systems use different mechanisms. Rules are often invoked by demons. Some systems allow different rule sets to be applied to different frames Why Use Frames? In large systems, frames can provide the system the capability to find relevant information quickly. Making inferences from the most relevant information can provide greater efficiency and allow searches to be constrained. Relationships between frames can be provided at a relatively low cost. Advantages of Expert Systems Provide an explanation capability What rules fired to provide the conclusion? Why other conclusions were not made. For simple domains, the rule-base might be simple and easy to verify and validate. The system might use a method similar to what the expert uses. Expert system shells provide a means to build simple systems without programming Disadvantages of Expert Systems When the number of rules is large, the effect of adding new rules can be difficult to assess. Expert knowledge is not usually easily codified into rules. Expert often lack access to their own analysis mechanisms. Validation/Verification of large systems is very difficult. Track record does not seem to contain many successes. Relatively high-risk to implement.