Chapter 9. Rules and Expert Systems Fall 2013 Comp3710 Artificial Intelligence Computing Science Thompson Rivers University.

Slides:



Advertisements
Similar presentations
Modelling with expert systems. Expert systems Modelling with expert systems Coaching modelling with expert systems Advantages and limitations of modelling.
Advertisements

CHAPTER 13 Inference Techniques. Reasoning in Artificial Intelligence n Knowledge must be processed (reasoned with) n Computer program accesses knowledge.
1 Rule Based Systems Introduction to Production System Architecture.
Rulebase Expert System and Uncertainty. Rule-based ES Rules as a knowledge representation technique Type of rules :- relation, recommendation, directive,
Building a Knowledge Base with VPExpert (VPX. exe) see also: vpxguide
Reasoning Forward and Backward Chaining Andrew Diniz da Costa
CS 484 – Artificial Intelligence1 Announcements Choose Research Topic by today Project 1 is due Thursday, October 11 Midterm is Thursday, October 18 Book.
Inferences The Reasoning Power of Expert Systems.
Expert System Shells - Examples
Reasoning System.  Reasoning with rules  Forward chaining  Backward chaining  Rule examples  Fuzzy rule systems  Planning.
Intelligent systems Lecture 6 Rules, Semantic nets.
Rule Based Systems Michael J. Watts
Chapter 12: Expert Systems Design Examples
Rule Based Systems Alford Academy Business Education and Computing
1 5.0 Expert Systems Outline 5.1 Introduction 5.2 Rules for Knowledge Representation 5.3 Types of rules 5.4 Rule-based systems 5.5 Reasoning approaches.
Lecture 04 Rule Representation
Artificial Intelligence CAP492
1 Chapter 9 Rules and Expert Systems. 2 Chapter 9 Contents (1) l Rules for Knowledge Representation l Rule Based Production Systems l Forward Chaining.
Rules and Expert Systems
© C. Kemke1Reasoning - Introduction COMP 4200: Expert Systems Dr. Christel Kemke Department of Computer Science University of Manitoba.
Production Rules Rule-Based Systems. 2 Production Rules Specify what you should do or what you could conclude in different situations. Specify what you.
Marakas: Decision Support Systems, 2nd Edition © 2003, Prentice-Hall Chapter Chapter 7: Expert Systems and Artificial Intelligence Decision Support.
EXPERT SYSTEMS Part I.
Building Knowledge-Driven DSS and Mining Data
CPSC 433 Artificial Intelligence CPSC 433 : Artificial Intelligence Tutorials T01 & T02 Andrew “M” Kuipers note: please include.
Artificial Intelligence CSC 361
1 Backward-Chaining Rule-Based Systems Elnaz Nouri December 2007.
Artificial Intelligence Lecture No. 15 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Chapter 14: Artificial Intelligence Invitation to Computer Science, C++ Version, Third Edition.
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
Artificial Intelligence
School of Computer Science and Technology, Tianjin University
Knowledge based Humans use heuristics a great deal in their problem solving. Of course, if the heuristic does fail, it is necessary for the problem solver.
Chapter 9: Rules and Expert Systems Lora Streeter.
 Architecture and Description Of Module Architecture and Description Of Module  KNOWLEDGE BASE KNOWLEDGE BASE  PRODUCTION RULES PRODUCTION RULES 
1 CHAPTER 13 Decision Support Systems and Intelligent Systems, Efraim Turban and Jay E. Aronson 6th ed, Copyright 2001, Prentice Hall, Upper Saddle River,
Expert System Note: Some slides and/or pictures are adapted from Lecture slides / Books of Dr Zafar Alvi. Text Book - Aritificial Intelligence Illuminated.
Rules and Expert Systems
1 Knowledge Based Systems (CM0377) Introductory lecture (Last revised 28th January 2002)
Chapter 7. Propositional and Predicate Logic Fall 2013 Comp3710 Artificial Intelligence Computing Science Thompson Rivers University.
Knowledge Representation Fall 2013 COMP3710 Artificial Intelligence Computing Science Thompson Rivers University.
Of An Expert System.  Introduction  What is AI?  Intelligent in Human & Machine? What is Expert System? How are Expert System used? Elements of ES.
A Brief History of AI Fall 2013 COMP3710 Artificial Intelligence Computing Science Thompson Rivers University.
Artificial Intelligence
Forward and Backward Chaining
Expert System Seyed Hashem Davarpanah University of Science and Culture.
Some Thoughts to Consider 5 Take a look at some of the sophisticated toys being offered in stores, in catalogs, or in Sunday newspaper ads. Which ones.
1 Chapter 13 Artificial Intelligence and Expert Systems.
Artificial Intelligence: Applications
Chapter 12. Probability Reasoning Fall 2013 Comp3710 Artificial Intelligence Computing Science Thompson Rivers University.
Artificial Intelligence Logical Agents Chapter 7.
Inexact Reasoning 2 Session 10
Knowledge Representation
Chapter 7. Propositional and Predicate Logic
Advanced AI Session 2 Rule Based Expert System
Rules: Knowledge Representation & Manipulation
Lecture #1 Introduction
CHAPTER 1 Introduction BIC 3337 EXPERT SYSTEM.
Chapter 9. Rules and Expert Systems
Inexact Reasoning 2 Session 10
DSS & Warehousing Systems
Architecture Components
Knowledge Representation
CS62S: Expert Systems Based on:
Intro to Expert Systems Paula Matuszek CSC 8750, Fall, 2004
CPSC 433 : Artificial Intelligence Tutorials T01 & T02
Chapter 7. Propositional and Predicate Logic
Knowledge Representation
Chapter 9. Rules and Expert Systems
Probabilistic Reasoning
Presentation transcript:

Chapter 9. Rules and Expert Systems Fall 2013 Comp3710 Artificial Intelligence Computing Science Thompson Rivers University

TRU-COMP3710 Rules and Expert Systems2 Course Outline Part I – Introduction to Artificial Intelligence Part II – Classical Artificial Intelligence Knowledge Representation Searching Knowledge Represenation and Automated Reasoning Propositinoal and Predicate Logic Inference and Resolution for Problem Solving Rules and Expert Systems Part III – Machine Learning Part IV – Advanced Topics

TRU-COMP3710 Rules and Expert Systems3 Chapter Objectives Rule-based expert systems Do forward chaining with example rules and facts Do backward chaining with example rules and facts Explain what a rule-based expert system consists of List the two parts in expert systems, which can not be easily solved

TRU-COMP3710 Rules and Expert Systems4 Chapter Outline 1. Rules for Knowledge Representation Rules for Knowledge Representation 2. Rule-Based Systems Rule-Based Systems 3. Forward Chaining Forward Chaining 4. Backward Chaining Backward Chaining 5. Rule-Based Expert Systems Rule-Based Expert Systems

TRU-COMP3710 Rules and Expert Systems5 Rules for Knowledge Representation Here are some interesting quotes. Each problem that I solved became a rule which served afterwards to solve other problems. - Rene Descartes As a rule we disbelieve all the facts and theories for which we have no use. - William James

TRU-COMP3710 Rules and Expert Systems6 Rules for Knowledge Representation Hell, there are no rules here -- we're trying to accomplish something. - Thomas A. Edison Get your facts first, and then you can distort them as much as you please. - Mark Twain If the facts don't fit the theory, change the facts. - Albert Einstein

TRU-COMP3710 Rules and Expert Systems7 Rules for Knowledge Representation [Q] How do you want to represent our knowledge? [Q] How do we do [logical] reasoning? Facts and rules: IF… THEN rules can be used to represent knowledge: IF it rains, THEN you will get wet Rules can also be recommendations or actions: IF it rains, THEN you should wear a coat

TRU-COMP3710 Rules and Expert Systems8 Rules for Knowledge Representation A rule consists of an antecedent and a consequence (action, conclusion). IF A THEN B, orA -> B When there are more than one antecedent, AND (&), OR (|), NOT (~),...or , , ,...(conjunction, disjunction) Truth table?(T  F)  (  T  F)T -> F ??? In general, the antecedent of a rule compares an object [variable] with a possible value, using an operator. I.e., the antecedent of a rule is a Boolean expression. IF x  3 IF name is “Bob” IF weather is cold IF name is “Bob”  weather is cold THEN tell “Bob” ‘Wear a coat’ Topics

TRU-COMP3710 Rules and Expert Systems9 Rule-Based Systems A rule-based system or production system is a system that uses knowledge in the form of rules to provide diagnoses or advice on the basis of input data (facts). The system consists of a database of rules (knowledge base), a database of facts, and an inference engine which reasons about the facts using the rules to draw conclusions. Conclusions are often derived using deduction (deductive reasoning). Forward chaining: using deduction to reach a conclusion from a set of antecedents (i.e., facts) Backward chaining: starts from a conclusion (i.e., hypothesis) and tries to show it by following a logical path backward from the conclusion to a set of antecedents that are in the database of facts Topics

TRU-COMP3710 Rules and Expert Systems10 Forward Chaining Forward chaining is a reasoning model that works from a set of facts and rules towards a set of conclusions, diagnoses or recommendations. Also known as data-driven reasoning When a fact matches the antecedent of a rule, the rule fires, and the conclusion of the rule is added to the database of facts. Take the facts from the database See if any combination of these matches all the antecedents of one of the rules in the database When all the antecedents of a rule are matched by facts, then this rule is triggered. When a rule is triggered, it is then fired, which means its conclusion is added to the facts database.

TRU-COMP3710 Rules and Expert Systems11 Forward Chaining Example of elevator Rule 1: IF floor = first & button = first THEN open door Rule 2: IF floor = first & button = second THEN goto second floor Rule 3: IF floor = first & button = third THEN goto third floor Rule 4: IF floor = second & button = first & going to third floor = T THEN remember to goto first floor Fact 1:floor = first Fact 2:button = third Fact 3:day = Tuesday The facts match Rule ??? and the conclusion ??? is added to the database of facts

TRU-COMP3710 Rules and Expert Systems12 Forward Chaining Example of elevator – cont Rule 1: IF floor = first & button = first THEN open door Rule 2: IF floor = first & button = second THEN goto second floor Rule 3: IF floor = first & button = third THEN goto third floor Rule 4: IF floor = second & button = first & going to third floor = T THEN remember to goto first floor Fact 1:floor = second (<- first) Fact 2:button = Fact 3:day = Tuesday Fact 4:going to third floor = T

TRU-COMP3710 Rules and Expert Systems13 Forward Chaining Example of elevator – cont Rule 1: IF floor = first & button = first THEN open door Rule 2: IF floor = first & button = second THEN goto second floor Rule 3: IF floor = first & button = third THEN goto third floor Rule 4: IF floor = second & button = first & going to third floor = T THEN remember to goto first floor Fact 1:floor = second (<- first) Fact 2:button = first Fact 3:day = Tuesday Fact 4:going to third floor = T

TRU-COMP3710 Rules and Expert Systems14 Forward Chaining Example of elevator – cont Rule 1: IF floor = first & button = first THEN open door Rule 2: IF floor = first & button = second THEN goto second floor Rule 3: IF floor = first & button = third THEN goto third floor Rule 4: IF floor = second & button = first & going to third floor = T THEN remember to goto first floor Fact 1:floor = second (<- first) Fact 2:button = first Fact 3:day = Tuesday Fact 4:going to third floor = T Rule 4 is fired. [Q] What if someone pressed the button on the second floor?

TRU-COMP3710 Rules and Expert Systems15 Forward Chaining Example of elevator – cont Fact 1:floor = third Fact 2:button = second Fact 3:button = first There are more than one possible conclusion, i.e., there can be multiple rules matching with the facts. Conflict resolution needs to be applied to decide which rule to fire.

TRU-COMP3710 Rules and Expert Systems16 Conflict Resolution Sometimes more than one rule will fire at once, and a conflict resolution strategy must be used to decide which conclusion[s] to use. Some ideas: 1. Give rules priorities and to use the conclusion that has the highest priority. 2. The rule with the longest antecedent is applied. 3. The rule that matches with the most recently added facts is applied.

TRU-COMP3710 Rules and Expert Systems17 Meta Rules The rules that determine the conflict resolution strategy are called meta rules. Meta rules define knowledge about how the system will work. For example, meta rules might define that knowledge from Expert A is to be trusted more than knowledge from Expert B. Meta rules are treated by the system like normal rules, but are given higher priority. Topics

TRU-COMP3710 Rules and Expert Systems18 Backward Chaining In cases where a particular conclusion, i.e., hypothesis, is to be proved, backward chaining can be more appropriate. Works back from a conclusion towards the original facts. When a conclusion matches the conclusion of a rule in the database, the antecedents of the rule are compared with facts in the database.

TRU-COMP3710 Rules and Expert Systems19 Backward Chaining Example: Rule 1A  B -> C Rule 2A -> D Rule 3C  D -> E Rule 4A  E  F -> G Rule 5 A  E -> H Rule 6D  E  H -> I Fact 1A Fact 2B Fact 3F [Q] What do we want to do with the above databases? Goalto prove H [Q] Do we humans use Forward Chaining or Backward Chaining?

TRU-COMP3710 Rules and Expert Systems20 Backward Chaining Rule 1A  B -> C Rule 2A -> D Rule 3C  D -> E Rule 4A  E  F -> G Rule 5 A  E -> H Rule 6D  E  H -> I Fact 1A Fact 2B Fact 3F Goalto prove H [Q] Which one is better??? [Q] Use both of them??? Using forward chaining: FactsRules triggeredRule fired A, B, F1, 21 A, B, C, F22 A, B, C, D, F33 A, B, C, D, E, F4, 54 A, B, C, D, E, F, G55 A, B, C, D, E, F, G, H6STOP Using backward chaining: FactsGoalsMatching rules A, B, FH5 A, B, FE3 A, B, FC, D1 A, B, C, FD2 A, B, C, D, F  STOP Topics

TRU-COMP3710 Rules and Expert Systems21 Types of Expert Systems Rule-Based Systems in this textbook The 70s and 80s Neural Networks Belief (Bayesian) Networks Blackboard Systems Case-Based Reasoning...

TRU-COMP3710 Rules and Expert Systems22 Architecture of Expert Systems End users; domain experts; knowledge engineers An expert system uses expert knowledge derived from human experts to diagnose illnesses, provide recommendations and solve other problems.

TRU-COMP3710 Rules and Expert Systems23 Architecture of Expert Systems Knowledge base: database of rules (domain knowledge). Explanation system: explains the decisions the system makes. User Interface: the means by which the end user interacts with the expert system. Knowledge base editor: allows domain experts or knowledge engineers to edit the information in the knowledge base. Inference engine

TRU-COMP3710 Rules and Expert Systems24 Expert System Shells The part of an expert system that does not contain any domain specific or case specific knowledge is the expert system shell. A single expert system shell can be used to build a number of different expert systems. Examples of an expert system shell are CLIPS (C Language Interpreted Production System) and JESS (The Java Expert System Shell)

TRU-COMP3710 Rules and Expert Systems25 Example: CLIPS CLIPS is C Language Integrated Production System – an expert system shell. CLIPS uses a LISP-like notation to enter rules.

TRU-COMP3710 Rules and Expert Systems26 The Rete Algorithm One potential problem with expert systems is the number of comparisons that need to be made between rules and facts in the database, when there are many rules and facts. [Q] How to solve? Any good data structure? A rete is a directed, acyclic, rooted graph (a sort of tree). A path from the root node to a leaf represents the left hand side of a rule. Each node stores details of which facts have been matched so far. As facts are changed, the changes (adding, updating, deleting) are propagated through the tree. This makes an efficient way for expert systems to deal with environments which change often.

TRU-COMP3710 Rules and Expert Systems27 Knowledge Engineering A knowledge engineer takes knowledge from experts and inputs it into the expert system. A knowledge engineer will usually choose which expert system shell to use. The knowledge engineer is also responsible for entering meta-rules. [Q] Is it the most difficult part in the development of an expert system?

TRU-COMP3710 Rules and Expert Systems28 Backward Chaining in Expert Systems A common method for building expert systems is to use a rule-based system with backward chaining. Typically a user enters a set of facts into the system, and the system tries to see if it can prove any of the possible hypotheses using these facts. In some cases it will need additional facts, in which case the system will often ask the user questions, to ascertain facts that could enable further rules to fire. Backward chaining is often used in expert systems that are designed for medical diagnosis.

TRU-COMP3710 Rules and Expert Systems29 Backward Chaining in Expert Systems Algorithm: For each hypothesis, H:  If H is in the facts database, it is proved.  Otherwise, if H can be determined by asking a question, then enter the user’s answer in the facts database. Hence, it can be determined whether H is true or false, according to the user’s answer.  Otherwise, find a rule whose conclusion is H. Now apply this algorithm to try to prove this rule’s antecedents.  If none of the above applies, we have failed to prove H.

TRU-COMP3710 Rules and Expert Systems30 Backward Chaining in Expert Systems  Usually backward chaining is used in conjunction with forward chaining.  Forward chaining to derive new facts and asks questions in order to carry out its backward chaining analysis.  E.g.,  Rule 1:IF tired and headache THEN diagnose gladular fever  Rule 2:IF tired and sore throat THEN diagnose tonsilitis  Fact:headache  => Forward chainging -> Hypothesis 1: G.F. -> backward chaining  =>ask if tired

TRU-COMP3710 Rules and Expert Systems31 Example: CYC A frame based production system. Uses a database of over 1,000,000 facts and rules, encompassing all fields of human knowledge. CYC can answer questions about all kinds of knowledge in its database, and can even understand analogies, and other complex relations.

TRU-COMP3710 Rules and Expert Systems32 The Last Questions [Q] Which part is difficult to implement? [Q] Have expert systems been successful? [Wikipedia] The expert system has a major flaw which explains its low success although the principle has existed for 70 years: knowledge collection and interpretation into rules, the knowledge engineering. Most developers have no method to perform this task. They work manually what opens to many possibilities for errors. [Q] How to handle uncertainty? E.g., IF name is “Bob”  weather is cold THEN tell “Bob” ‘Wear a coat’ Topics