1、KB DSS Intro 1 Lucy Hederman4 Rule-based Expert SystemsA rule-based expert system is an expert system (see intro) which works as a production system in which rules encode expert knowledge.Most expert systems are rule-based. Alternatives are frame-based - knowledge is associated with the objects of i
2、nterest and reasoning consists of confirming expectations for slot values. Such systems often include rules too. model-based, where the entire system models the real world, and this deep knowledge is used to e.g. diagnose equipment malfunctions, by comparing model predicted outcomes with actual obse
3、rved outcomescase-based - previous examples (cases) of the task and its solution are stored. To solve a new problem the closest matching case is retrieved, and its solution or an adaptation of it is proposed as the solution to the new problem.KB DSS Intro 2 Lucy HedermanTypical Expert System Archite
4、cture(from Luger and Stubblefield)KB DSS Intro 3 Lucy HedermanData-driven Rule-based Expert SystemsUse Forward Chaining:Given a certain set of facts in WM, use the rules to generate new facts until the desired goal is reached.To forward chain the inference engine must:1. Match the condition patterns
5、 of rules against facts in working memory.2. If there is more than one rule that could be used (that could “fire“), select which one to apply (this is called conflict resolution)3. Apply the rule, maybe causing new facts to be added to working memory4. Halt when some useful (or goal) conclusion is a
6、dded to WM (or until all possible conclusions have been drawn.)KB DSS Intro 4 Lucy HedermanGoal-driven Rule-based Expert SystemsUse Backward Chaining:Work backwards from a hypothesised goal, attempting to prove it by linking the goal to the initial facts.To backward chain from a goal in WM the infer
7、ence engine must:1. Select rules with conclusions matching the goal.2. Replace the goal by the rules premises. These become sub-goals.3. Work backwards till all sub-goals are known to be true -either they are facts (in WM)or the user provides the information.KB DSS Intro 5 Lucy HedermanExampleA prod
8、uction system IDENTIFIER, which identifies animals.R1 IF the animal has hairTHEN it is a mammalR2 IF the animal gives milkTHEN it is a mammalR3 IF the animal has feathersTHEN it is a birdR4 IF the animal fliesthe animal lays eggsTHEN it is a birdR5 IF the animal is a mammalthe animal eats meatTHEN i
9、t is a carnivoreR6 IF the animal is a mammalthe animal has pointed teeththe animal has clawsthe animals eyes point forwardTHEN it is a carnivoreR7 IF the animal is a mammalthe animal has hoovesTHEN it is an ungulateR8 IF the animal is a mammalthe animal chews cudTHEN it is an ungulate ANDit is even-
10、toedR9 IF the animal is a carnivorethe animal has a tawny colourthe animal has dark spotsTHEN it is a cheetahKB DSS Intro 6 Lucy HedermanR10 IF the animal is a carnivorethe animal has a tawny colourthe animal has black stripesTHEN it is a tigerR11 IF the animal is an ungulatethe animal has long legs
11、the animal has a long neckTHEN it is a giraffeR12 IF the animal is an ungulatethe animal has a white colourthe animal has black stripesTHEN it is a zebraR13 IF the animal is a birdthe animal does not flythe animal has long legsthe animal has a long neckthe animal is black and whiteTHEN it is an ostr
12、ichR14 IF the animal is a birdthe animal does not flythe animal swimsthe animal is black and whiteTHEN it is a penguinR15 IF the animal is a birdthe animal is a good flierTHEN it is an albatrossKB DSS Intro 7 Lucy HedermanPROBLEM:Given these facts in working memory initially:the animal gives milkthe
13、 animal chews its cudthe animal has long legsthe animal has a long neckEstablish by forward chaining that the animal is a giraffe.Given the facts that:the animal has hairthe animal has clawsthe animal has pointed teeththe animals eyes point forwardthe animal has a tawny colourthe animal has dark spo
14、tsEstablish by backward chaining that the animal is a cheetah.HINT: start with R9, first subgoal : the animal is a carnivore etc.KB DSS Intro 8 Lucy HedermanGoal-driven search is suggested if: A goal or hypothesis is given in the problem statement or can be easily formulated(theorem-proving, diagnos
15、is hypothesis testing). There are a large number of rules that match the facts, producing a large number of conclusions - choosing a goal prunes the search space. Problem data are not given (or easily available) but must be acquired as necessary (e.g. medical tests).Data-driven search is suggested i
16、f: All or most of the data is given in the problem statement (interpretation problems) Large number of potential goals but few achievable in a particular problem instance. It is difficult to formulate a goal or hypothesis.Data-driven search can appear aimless but produces all solutions to a problem
17、(if desired)Mixed reasoning is also possible - facts get added to the WM and sub-goals get created until all the sub-goals are present as facts.KB DSS Intro 9 Lucy HedermanExplanation Facility in Expert SystemsRule-based systems can be designed to answer questions likeWHY do you want to know this fa
18、ct ? (i.e. where is the reasoning going?)HOW did you deduce this fact ? (i.e. how did we get here?)Explanation facilities are useful for debugging a rulebase but also for instilling confidence in users of the ES.A tracer module records the rules that have been used. To answer HOW questions these rul
19、es are searched for one where the fact in question is a consequent (action/then part).(see MYCIN case study)The production system architecture provides the essential basis for explanation facility, and the facility contributes to the success and popularity of rule-based ES.KB DSS Intro 10 Lucy Heder
20、manHandling Uncertainty in Expert SystemsUncertainty arises from abductive rules, heuristic rules or missing or unreliable data.ABDUCTION: ES rules are frequently not sound logically, but are abductive. The abductive ruleif the engine does not turn over andthe lights do not come onthen the problem i
21、s battery or cables.is not always right, but would be typical of a car diagnosis system. Its converse, while not so useful is logically sound :if the problem is battery or cablesthen the engine does not turn over andthe lights do not come onAbductive reasoning is very important in diagnosis - diseas
22、es cause symptoms, but we have sympoms and want to work back to the cause.To reason with uncertainty, we attach confidence measures to facts and to rules. We need mechanisms to combine these measures.KB DSS Intro 11 Lucy Hedermanxyz? x ? xy ?(1) (2)(3)What confidence can I have in the conjunction of
23、 uncertain facts ?What confidence can I have in a particular rules conclusion given the confidence of its premise ?How do I combine confidences for supporting arguments ?Handling uncertainty in rule-based expert systemsThree situations need to be handled.(1) If A and B and C then If my confidence in
24、 A is x and in B is y and in C is z how confident am I about their conjunction (A and B and C)?(2) If D then EIf my confidence in D is x how confident can I be in E?(3) If the same fact F is deduced from (two) separate rules with confidences x and y, how confident am I in F? KB DSS Intro 12 Lucy Hed
25、ermanA. Simple (Conservative) Rules(1) Confidence in the conjunction ismin (x, y z) a chain is as strong as its weakest link(2) Confidence in rule conclusion is x . a a is the rules attenuation factor(3) Confidence in the multiply derived fact ismax (x, y) a conclusion is no more certain than the st
26、rongest supporting argument.KB DSS Intro 13 Lucy HedermanB. Bayesian Probability Theory BasedConfidence measures are probabilities.(1) Confidence in conjunction is = x . y . z(2) Confidence in a rule is based on Bayes theorem P(D i,S) = P(S| D i) * P(D i)(P(S| D k) * P(D k) k=1n(there should be a su
27、mmation symbol on the bottom line)which relates P(Di|S) the probability of having disease i if you have the symptom S,to measures of P(Di) the probability of having disease i in general,P(S|Di) the probability of having the symptom S if you have disease i, and P(S|Dk) for all possible diseases Dk, t
28、he probability of having symptom S if you have diseases Dk. (Diseases are hypotheses; symptoms are evidence.)KB DSS Intro 14 Lucy HedermanDifficulties with Bayes Theorem:Bayes theorem assumes that relationships between evidence and hypotheses are independent of one another. (e.g. the probability of
29、someone who has flu having a sore throat and the probability of someone who has flu having a temperature, should be independent. But are they ?)Probabilities should be collected statistically, and kept up to date with all new discoveries about diseases and their symptoms. This is impractical.Bayes-b
30、ased probability is not a good way to model uncertainty in medical diagnosis systems.Nonetheless, doctors feel that they can make informed assessment of their confidence in their heuristic rules.KB DSS Intro 15 Lucy HedermanC. Stanford Certainty Factor Algebra(See also MYCIN notes.)CF (H|E) is the c
31、ertainty factor of hypothesis H given evidence E.-1 (ident organism-1 klebsiella .25)there is evidence (.25) that the identity of organism-1 is klebsiella(sensitive organism-1 penicillin -1.0)it is known that org-1 is NOT sensitive to penicillin.Rules: condition-action pairsCondition is a conjunctio
32、n (AND) of factsIF: (AND (same-context infection primary-bacteremia)(membf-context site sterilesite)(same-context portal GI)THEN: (conclude context-ident bacteroid tally .7)If the infection is primary bacteremia and the site of the culture is a sterile one and the suspected portal of entry is GI tra
33、ct then there is suggestive evidence (.7) that infection is bacteroid.Consequent (then-part) can Add facts to database Write to terminal Change a value in a fact, or its certaintyKB DSS Intro 20 Lucy Hederman Lookup a table Execute a LISP procedureOperation:Routine questionsSpecific questions about
34、symptomsDepth-first goal driven consideration of each “known“ organismTerminates “depth-search“ when certainty measures get too low.Selection criterion is to maximise certainty - if a rule can prove a goal with certainty 1 then no more rules need be considered.Goal-driven so that questions appear to
35、 be directed - less frustrating, more confidence building for the user.English-like interaction (see handout).Answers WHY by printing the rule under consideration.Exhaustive consideration of possible infections - patient may have more than one.KB DSS Intro 21 Lucy HedermanUncertainty in MYCINIf A: s
36、tain is gram positiveand B: morphology is coccusand C: growth conformation is chainsthen there is suggestive evidence (0.7) that H: organism is streptococcus 0.7 is the measure of increase of belief (MB) of H given evidence A and B and C.MB ranges 0 to 1. Assigned by subjective judgement usually.As
37、a guide:1 if P(H)=1MB(H|E) = maxP(H|E),P(H) - P(H) otherwisemax1,0 - P(H)Measures of disbelief also allowed. These also range 0 to 1.1 if P(H)=1MD(H|E) = minP(H|E),P(H) - P(H) otherwisemin1,0 - P(H)KB DSS Intro 22 Lucy HedermanNote if E and H are independent, E does not change the belief in H:P(H|E)
38、 = P(H), so MB = MD = 0.MB(H|E) should only be 1 if E logically implies H.Initially each hypothesis has MB=MD=0.As evidence is accumulated these are updated.At the end a certainty factor CF = MB-MD is computed for each hypothesis.The largest absolute CF values used to determine appropriate therapy. Weakly supported hypotheses |CF| 2 are ignored.MYCINs handling of uncertainty is an ad-hoc method (based on probability). But it seems to work as well as more formal approaches.