Chapter 9. Rules and Expert Systems

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,
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
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.
Scientific Thinking - 1 A. It is not what the man of science believes that distinguishes him, but how and why he believes it. B. A hypothesis is scientific.
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.
Artificial Intelligence: Definition “... the branch of computer science that is concerned with the automation of intelligent behavior.” (Luger, 2009) “The.
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 
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.
17/1/1 © Pearson Education Limited 2002 Artificial Intelligence & Expert Systems Lecture 1 AI, Decision Support, Architecture of expert systems Topic 17.
Knowledge Representation Fall 2013 COMP3710 Artificial Intelligence Computing Science Thompson Rivers University.
Chapter 9. Rules and Expert Systems 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
1 Chapter 13 Artificial Intelligence and Expert Systems.
Artificial Intelligence: Applications
EXPERT SYSTEMS BY MEHWISH MANZER (63) MEER SADAF NAEEM (58) DUR-E-MALIKA (55)
By Muhammad Safdar MCS [E-Section].  There are times in life when you are faced with challenging decisions to make. You have rules to follow and general.
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.
Artificial Intelligence, P.I
Chapter 9. Rules and Expert Systems
Inexact Reasoning 2 Session 10
DSS & Warehousing Systems
Introduction to Expert Systems Bai Xiao
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
COMP3710 Artificial Intelligence Thompson Rivers University
Habib Ullah qamar Mscs(se)
Presentation transcript:

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

Rules and Expert Systems Course Outline Part I – Introduction to Artificial Intelligence Part II – Classical Artificial Intelligence, and Searching Knowledge Representation Searching Search Methodologies Advanced Search Genetic Algorithms (relatively new study area) 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 Systems

Rules and Expert Systems 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 Systems

Rules and Expert Systems Chapter Outline Rules for Knowledge Representation Rule-Based Systems Forward Chaining Backward Chaining Rule-Based Expert Systems TRU-COMP3710 Rules and Expert Systems

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 Systems

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 Systems

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 Systems

Rules for Knowledge Representation Topics Rules for Knowledge Representation A rule consists of an antecedent and a consequence (action, conclusion). IF A THEN B, or A -> B When there are more than one antecedent, AND (&), OR (|), NOT (~), ... or , , , ... (conjunction, disjunction, negation) 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’ TRU-COMP3710 Rules and Expert Systems

Rules and Expert Systems Topics 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 TRU-COMP3710 Rules and Expert Systems

Rules and Expert Systems 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. This step takes some time. 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 Systems

Rules and Expert Systems 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 Systems

Rules and Expert Systems 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 Systems

Rules and Expert Systems 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 Systems

Rules and Expert Systems 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 Systems

Rules and Expert Systems 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 Systems

Rules and Expert Systems 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: Give rules priorities and to use the conclusion that has the highest priority. The rule with the longest antecedent is applied. The rule that matches with the most recently added facts is applied. TRU-COMP3710 Rules and Expert Systems

Rules and Expert Systems Topics 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. TRU-COMP3710 Rules and Expert Systems

Rules and Expert Systems 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. The process looks like a recursion. TRU-COMP3710 Rules and Expert Systems

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

Rules and Expert Systems Topics Backward Chaining Rule 1 A  B -> C Rule 2 A -> D Rule 3 C  D -> E Rule 4 A  E  F -> G Rule 5 A  E -> H Rule 6 D  E  H -> I Fact 1 A Fact 2 B Fact 3 F Goal to prove H [Q] Which one is better??? [Q] Use both of them??? [Q] Prove or disprove G. Using forward chaining: Facts Rules triggered Rule fired A, B, F 1, 2 1 A, B, C, F 2 2 A, B, C, D, F 3 3 A, B, C, D, E, F 4, 5 4 A, B, C, D, E, F, G 5 5 A, B, C, D, E, F, G, H 6 STOP Using backward chaining: Facts Goals Matching rules A, B, F H 5 A, B, F E 3 A, B, F (C, D) 1 A, B, C, F (T, D) 2 A, B, C, D, F (T, T)  STOP TRU-COMP3710 Rules and Expert Systems

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

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 Systems

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 Systems

Rules and Expert Systems 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 Systems

Rules and Expert Systems 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 Systems

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 Systems

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 Systems

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.  recursion If none of the above applies, we have failed to prove H. TRU-COMP3710 Rules and Expert Systems

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 glandular fever Rule 2: IF tired and sore throat THEN diagnose tonsillitis Fact: headache => Forward chaining -> Hypothesis 1: G.F. -> backward chaining => ask if tired TRU-COMP3710 Rules and Expert Systems

Rules and Expert Systems 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 Systems

Rules and Expert Systems Topics 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 and ambiguity? E.g., IF name is “Bob”  weather is cold THEN tell “Bob” ‘Wear a coat’ TRU-COMP3710 Rules and Expert Systems