Uncertain knowledge Certainty and Evidence 1 Structure of a rule-based expert system External Database External Program Expert System Knowledge Base Database Rule: IF-THEN Fact Inference Engine Explanation Facilities User Interface User Developer Interface Knowledge Engineer Expert 2 Example Rule Legal knowledge Rule if and and and and and then the plaintiff did receive an eye injury there was just one eye that was injured the treatment for the eye did require surgery the recovery from the injury was almost complete the visual acuity was slightly decreased by the injury the condition is fixed increase the injury trauma factor by $10000 Rule if and the plaintiff did not wear glasses before the injury the plaintiff's injury does require the plaintiff to wear glasses increase the inconvemience factor by $1500 3 then Problems with Knowledge Knowledge is usually incomplete, inconsistent, uncertain, or all three. 4 Uncertainty Uncertainty is defined as the lack of the exact knowledge that would enable us to reach a perfectly reliable conclusion. Classical logic permits only exact reasoning. It assumes that perfect knowledge always exists and the law of the excluded middle can always be applied. ~T =F 5 Sources of uncertain knowledge Weak implications. Domain experts and knowledge engineers have the painful task of establishing concrete correlations between IF (condition) and THEN (action) parts of the rules. Therefore, expert systems need to have the ability to handle vague associations, for example by accepting the degree of correlations as numerical certainty factors. 6 Uncertainty in Terminology Terminology: Medical (and other life and human sciences) terminology allows considerable scope for vagueness, ambiguity, inexactness,imprecision and/or uncertainty: • "adequate" dosage of a drug • "stable" condition of patient • 'the patient is "feverish"' • 'this is a "possible" case of meningitis 7 Exercise Due to linguistic imprecision it can be difficult to express knowledge in the precise IF-THEN form of production rules. Sortthe following terms in a column in order of certainty from most certain to least certain. usually, seldom, hardly ever, rarely, often, always, may be, generally, normally, usually not, certainly, not often, now and then, rather often, generally, never, frequently, very often, not always, about as often as not, sometimes, infrequently, once in a while, almost never, commonly, by-and-large, hardly ever Next to each write a number between 0 and 100 representing the certainty that you associate with terms such as usually, often, 8 sometimes, generally . . . Unknown data When the data is incomplete or missing, the only solution is to accept the value “unknown” and proceed to an approximate reasoning with this value. 9 Views of different experts. Large expert systems usually combine the knowledge and expertise of a number of experts. Unfortunately, experts often have contradictory opinions and produce conflicting rules. To resolve the conflict, the knowledge engineer has to attach a weight to each expert and then calculate the composite conclusion. But no systematic method exists to obtain these weights. 10 Certainty Factors Consider a simple rule: IF A is X THEN B is Y An expert may not be absolutely certain that this rule holds. IF A is X THEN B is Y {cf 0.7}; 11 Class Exercise - Construct a rule base representing this knowledge A doctor explains the following to a knowledge engineer: “Nasal congestion together with a sore throat generally indicates a strep throat. A strep throat and chest congestion together usually indicate allergic rhinitis. Chest congestion, nasal congestion and a sore throat together are often an indication of pneumonia. Chest congestion and nasal congestion without the sore throat can also indicate pneumonia.” 12 Certainty Factors Calculations The certainty factor assigned by a rule is propagated through the reasoning chain. This involves establishing the net certainty of the rule consequent when the evidence in the rule antecedent is uncertain: cf (H,E) = cf (E) cf 13 Example, IF sky is clear THEN the forecast is sunny {cf 0.8} and the current certainty factor of sky is clear is 0.5, then cf (H,E) = 0.5 0.8 = 0.4 This result can be interpreted as “It may be sunny”. 14 Certainty of Conjunction evidence .. E1 . AND evidence En THEN hypothesis H {cf } IF the certainty of hypothesis H, is established as follows: cf (H,E1E2...En) = min [cf (E1), cf (E2),..., cf (En)] cf 15 Certainty of Conjunction For example, IF sky is clear AND the forecast is sunny THEN the action is ‘wear sunglasses’ {cf 0.8} and the certainty of sky is clear is 0.9 and the certainty of the forecast of sunny is 0.7, then cf (H,E1E2) = min [0.9, 0.7] 0.8 = 0.7 0.8 = 0.56 16 Certainty of Disjunction evidence .. E1 . OR evidence En THEN hypothesis H {cf } IF the certainty of hypothesis H, is established as follows: cf (H,E1E2...En) = max [cf (E1), cf (E2),..., cf (En)] cf 17 Example IF sky is overcast OR the forecast is rain THEN the action is ‘take an umbrella’ {cf 0.9} and the certainty of sky is overcast is 0.6 and the certainty of the forecast of rain is 0.8, then cf (H,E1E2) = max [0.6, 0.8] 0.9 = 0.8 0.9 = 0.72 18 Alternately - Two pieces of evidence Suppose the knowledge base consists of the following rules: Rule 1: IF A is X THEN C is Z {cf 0.8} Rule 2: IF B is Y THEN C is Z {cf 0.6} What certainty should be assigned to object C having value Z if both Rule 1 and Rule 2 are used? 19 Accumulation of Evidence Common sense suggests that, if we have two pieces of evidence (A is X and B is Y) from different sources (Rule 1 and Rule 2) supporting the same hypothesis (C is Z), then the confidence in this hypothesis should increase and become stronger than if only one piece of evidence had been obtained. 20 Accumulation of Evidence Calculation cf1 + cf2 -(cf1 * cf2) where cf1 is the confidence in hypothesis H established by Rule 1; cf2 is the confidence in hypothesis H established by Rule 2; 1 > cf1 + cf2 -(cf1 * cf2) > max(cf1,cf2) 21 Exercise - Calculation of Certainty in a derivation tree Draw the derivation tree and calculate the certainty of G A & B -> G (90) C | D -> A (80) E -> B (90) F -> B (80) C (70) D (90) E (80) F (80) 22 Thresholds • As the line of reasoning proceeds the accumulated confidence may decrease • At a certain point we may lose confidence in the line of reasoning • Thresholds are used cause the inference engine to abandon a portion of a search tree and search for a better alternative 23 The certainty factors theory provides a practical alternative to Bayesian reasoning. The heuristic manner of combining certainty factors is different from the manner in which they would be combined if they were probabilities. The certainty theory is not “mathematically pure” but does mimic the thinking process of a human expert. 24