Expert Systems
Total Page:16
File Type:pdf, Size:1020Kb
Prof.dr.sc. Bojana Dalbelo Bašić Faculty of Electrical Engineering and Computing Department of Electronics, Microelectronics, Computer and Intelligent systems www.zemris.fer.hr/~bojana [email protected] Expert systems © Bojana Dalbelo Bašić FER travanj, 2008. 1. INTRODUCTION . In the early days of AI (50s and 60s of the 20th century), people have tried to develop sophisticated inference techniques . These techniques did not rely on knowledge. The goal in this period was to develop software systems for general problem solving (GPS) . The failure to develop a general problem solving system gave rise to a different approach: the developement of knowledge based systems 2. RULE-BASED SYSTEMS How can one most easily represent human knowledge? . A vast majority of human knowledge (expert knowledge) can be represented using if – then rules . If the temperature of the patient is greater than 38°C then medications that lower the temperature should be prescribed . If the traffic light is red then stop . These rules are called production rules Production systems 2. RULE BASED SYSTEMS . An important step in successful solving of AI problems → reducing the scope or domain of the problem Expert General knowledge knowledge . Expert knowledge (domain knowledge) is knowledge specific for a given domain (e.g., medicine, finances, chess etc.), unlike general problem solving knowledge Expert systems 3. BASIC SCHEMA OF RULE-BASED SYSTEMS . Expert systems are a branch of AI that uses knowledge specialized for a certain problem domain to solve a problem at the level of a human expert . Basic schema of a rule-based system – expert system. Facts Knowledge base UserUser Expert Inference engine knowledge IMPORTANT – separating domain knowledge from Expert system the inference procedure 3. BASIC SCHEMA OF RULE-BASED SYSTEMS Facts Knowledge base UserUser Expert Inference engine knowledge Inference engine -> Expert system EXPERT SYSTEM SHELL is the expert system without the rules 4. INSPIRATION – THE COGNITION PROCESS Beginning of production systems: . Logician E. Post 1943. suggested production rules in formal theoretical computer science. Strength of PRs is equivalent to the Turing machine: production systems can be used for all solvable problems . 1972. Paper «Human problem Solving», Newell and Simon, 920 pages. Human cognition can be modeled by if then rules. One rule – a chunk of knowledge. 4. INSPIRATION – THE COGNITION PROCESS . A model of the human cognition process is imitated in the production system . Senses stimulate the brain with stimuli. Such stimuli activate knowledge in our long term memory (in a prod. system those are if – then rules) . Short term memory – temporary storage of knowledge for the period of when then inference procedure is executed – represents the number of «chunks of knowledge» that can be considered simultaneously - (rules which can be activated at the same time) 4. INSPIRATION – THE COGNITION PROCESS . Cognition process – finds rules that will be activated by stimuli – (in a prod. system this is the inference engine, it finds rules and resolves conflicts) . Newell i Simon – set up the basic model of modern production systems . 1970 – the paradigm of knowledge based systems is widely accepted 5. PRODUCTION SYSTEMS - NOMENCLATURE Synonyms: . Rule based systems . Production systems . Expert systems (In a classical sense these are systems that contain expert knowledge, obtained through a series of conversations between the knowledge-base engineer and a domain expert) Knowledge Expert Human- -base system expert engineer knowledge- base This procedure is the “bottleneck” in building an expert system 6. Application . Production systems - an alternative to conventional algorithmic programming Some areas of application for expert systems: . various kinds of medicial diagnoses (internal medicine, pulmology, infectious diseases etc.) . diagnoses of faults in complex electronic and electromechanical devices . many applications in legal systems (e.g., planning income and assets to minimize taxes) . applications in finances and banking (e.g., evaluation of credit standing for an individual or a company) 6. Application . An example of application: medicine . Diagnosing and determining therapy based on symptoms knowledge acquired Knowledge acquired through in medical school experience – heuristic knowledge doctor inference Expert knowledge – human knowledge: . human – expert . influence of fatigue and emotions on an assesment . duration of the knowledge is limited 7. Building a system attempt of formalising expert knowledge EXPERT using a computer SYSTEMS . Specialized (expert) knowledge gathered and organised for specialized, domain limited use Knowledge Expert Human- -base system expert engineer knowledge- base . This step can be automated 8. Examples of early ES Examples of early successful expert systems: . DENDRAL – discovering molecular structure of substances based on spectrometry . MYCIN – diagnosing infectuous blood diseases . PROSPECTOR – estimating existence of ore pased on geographical characteristics . XCON/R1 – DEC a system for choosing components when building a complex computer system 9. PRODUCTION SYSTEMS Expert systems – advantages: . built based on the knowledge of more than one expert - expert knowledge repository for a domain . can be easily multiplied an widely used Rule based systems are based on: . production rules (prodrules) If ……………. then ………………… Condition (state) Action premise, antecedent conclusion,consequent 9. PRODUCTION SYSTEMS . If it’s raining then take an umbrella condition-action . If car motor doesn’t start and the lights don’t work then the problem is the battery or the cables . If the patient is in a chronically generally bad state and gender is female and age < 30 and premise - patient has symptom A and conclusion biochemical test shows value C . then the diagnosis is autoimmune chronic hepatitis 9. PRODUCTION SYSTEMS state- . If John is a student of FER consequence then John is a student of the University in Zagreb RuleRule basedbased systemssystems areare usedused veryvery oftenoften becausebecause thethe majoritymajority ofof humanhuman knowledgeknowledge cancan bebe representedrepresented usingusing productionproduction rulesrules (if(if –– then).then). 10. PRODUCTION SYSTEMS - LOGIC . In logic: implication A → B (If A is true then B is true) Logical formulae . In production rules: If A then B actions, commands, equations, programs … . Production systems are a combination of two kinds of knowledge: [1] factual (A is true) A MODUS PONENS [2] conditional (rule exists) A → B (B is true) B 11. Definition of the PRODUCTION SYSTEM Definition – PRODUCTION SYSTEM is defined by: 1. SET OF PRODUCTION RULES [2] (production is a pair condition - action) 1. WORKING MEMORY (list of facts Knowledge – base containing the description of the current [1] state of the world in the inference procedure) 1. MATCH – ACT CYCLE This is a control mechanism consisting of a sequence of actions: pattern matching – choosing the rule to apply by resolving conflicts – applying the rule. In a more specific sense the knowledge base can refer only to the set of production rules. Knowledge base is also called the rule base. 12. SCHEMA OF PRODUCTION SYSTEM FUNCTION . Schema of production system function 2. Set of conflicted PRODUCTION rules RULES 3. Choosing a 1. Matching WORKING rule MEMORY 4. Applying the rule adding new facts and rules 12. SCHEMA OF PRODUCTION SYSTEM FUNCTION Description of a production system 1. SET OF PRODUCTION RULES – 1 PR (also called a condition-action pair) -> 1 chunk of knowledge from the problem domain. 1. WORKING MEMORY contains a set of facts . Facts (samples) from WM -> current state in the procedure of solving the problem. 12. SCHEMA OF PRODUCTION SYSTEM FUNCTION 1. MATCH – ACT cycle – is the control structure ofof a production system Samples from the working memory are compared with the conditional parts of the rules from the rule base. When a conditional part of a rule matches samples from the working memory, then that rules is enabled, and it is put into the set of conflicted rules. At the start of the cycle the set of conflicted rules is empty. 12. SCHEMA OF PRODUCTION SYSTEM FUNCTION After the matching procedure the set of conflicted rules can contain one or more enabled rules. If the set of conflicted rules is empty then the procedure is finished. If there is more than one enabled rule, then ONE rule is chosen and applied (the rule fires). Choice of the rule that fires is called conflict resolution. Firing of a rule means applying the right hand side of the rule – changing the contents of the working memory. After a rule has fired the control cycle repeats with the modified contents of the working memory. 12. SCHEMA OF PRODUCTION SYSTEM FUNCTION . Conflict resolution can be very simple – e.g. the first enabled rule fires, but it can also be complex, i.e. it can include a heuristic to choose which rule fires . Note: When a production rule is applied it can also be said that the rule fires. Example . A simple production system for sorting strings which consist of letters a,b and c SET OF PRODUCTION RULES: 1. ba → ab 2. ca → ac 3. cb → bc Example 1. ba → ab 2. ca → ac 3. cb → bc Iteration WORKING M Set of The rule that is MEMORY a conflicted chosen to t rules fire 0 cbaca c 3, 1, 2 1 h 1 cabca i 2 2 2 acbca n 3, 2 2 g 3 acbac 1, 3 1 4 acabc 2 2 5 aacbc 3 3 6 aabcc ∅ Stop Example 1. ba → ab 2. ca → ac 3. cb → bc Iteration WORKING M Set of The rule that is MEMORY a conflicting chosen to t rules fire 0 cbaca c 3, 1, 2 1 h 1 cabca i 2 2 2 acbca n 3, 2 2 g 3 acbac 1, 3 1 4 acabc 2 2 5 aacbc 3 3 6 aabcc ∅ Stop 14. INFERENCE PROCESS IN RULE-BASED SYSTEMS . A sequence made of several conclusions that link the starting description of the problem with the solution is called a CHAIN Forward chaining SOLUTION/ KNOWN GOAL/ DATA CONCLUSION Backward chaining . Inference procedure, i.e. automatic advancement along the chain is called chaining.