150 likes | 531 Views
Rule-based representation. Example IF GMAT score >= 600 THEN Admit student to MBA program ELSE do not admit student. Example (conjunctive condition clauses) IF sky is clear AND temperature is low THEN chance of frost is high Example (disjunctive condition clauses)
E N D
Rule-based representation Example IF GMAT score >= 600 THEN Admit student to MBA program ELSE do not admit student. Example (conjunctive condition clauses) IF sky is clear AND temperature is low THEN chance of frost is high Example (disjunctive condition clauses) IF age of car is new OR condition of car is good THEN cat should start AND trip should be safe OR in THEN-part?
Rules Example IF interest_rate > 10 IF interest_rate > 10 AND loan >= 10,000 AND (loan >= 10,000 OR due_date = today OR due_date = today) THEN review_loan = True. THEN review_loan = True. OR has precedence / left-to-right evaluation • A rule’s premise is true if it has been testes and premise is satisfied. • If premise is true, the rule is said to be triggered. • A rule fires implies that the action specified by the conclusion clauses is taken.
Multiple rules Rule 1: IF A = x Assume facts: OR B = y A = x THEN D = d1 B = not y Rule 2: IF A = x C = not Z AND C = z Which rule fires? AND B = NOT y THEN D = d2 Facts: A = x, C = z, B = not y. Which rule fires? Multiple values for a variable? Symptoms for a disease In presence of uncertainty
Inference Techniques • Deductive Reasoning Combines facts (axioms) with general knowledge in the form of implications to conclude new facts. Example: Axiom: I am sleeping in class Implication: Sleeping in class => Rude shock in exams Conclusion: I will get a rude shock in the exam. Modus ponens IF A is true, and if A => B, then B is true.
Inference techniques • Inductive reasoning Generalizing from specific facts. case 1: Game on 21st Sept. (Friday), It rained, We lost. case 2: Game on 5th Nov. (Friday), It rained, We lost. ….. Induce general rule: If game is on a Friday AND it rains Then we lose. • Abductive Reasoning Deduction with plausible implications IF B is true, and A=>B, then A is true.
Inference technqiues • Monotonic Reasoning facts remain static over period of problem-solving • Non-monotonic reasoning facts need to remain static over period of problem-solving. Truth Maintenance Systems used for non-monotonic reasoning.
Inference: Forward Chaining • Example R1: IF A and C THEN E Given facts: R2: IF D and C THEN F A is true R3: IF B and E THEN F B is true R4: IF B THEN C What can be concluded? R5: IF F THEN G Cycle through rules, looking for rules whose premise matches the working memory. Working memory A, B R4 fires: assert new fact C A, B, C R1 fires: assert new fact E A, B, C, E R3 fires: assert new fact F A, B, C, E, F R5 fires: assert new fact G A, B, C, E, F, G Concludes everything possible from available information
Inference • Recognize-Resolve-Act cycle Recognize match rule premises to facts in working memory, identify rules that can fire Resolve if more than one rules can fire, choose one rule Act fire the chosen rule and add its conclusion to working memory
Forward Chaining: Example R1: IF the patient has a sore throat AND we suspect a bacterial infection Facts: THEN we believe the patient has strep throat Patients temperature=102 R2: IF the patient’s temperature is > 100 Has been sick for 2 months THEN the patient has fever Has a sore throat R3: IF the patient has been sick for over a month AND the patient has fever THEN we suspect a bacterial infection Cycle 1: Consider R1, R2, R3 R2 fires: assert patient has fever Cycle 2: consider R1, R3 R3 fires: assert bacterial infection Cycle 3: R1 fires: assert strep throat Data driven reasoning: will fire all rules possible, can continue reasoning about irrelevant details.
Inference: Backward chaining • Attempts to prove a hypothesis (goal) by gathering supporting information Example R1: IF B and C THEN G R4: IF E or F THEN C R2: IF A and G THEN I R5: IF D and C THEN K R3: IF D and G THEN J Goal: I Goal I: need to trigger R2 Subgoal C: Need to trigger R4 Need both A and G Need E or F Subgoal A: need user input (ask user) Subgoal E: need user input (ask user) Subgoal G: Need to trigger R1 Need both B and C Subgoal B: need user input (ask user)
Combining Forward & Backward Chaining • Separate systems • separate expert-systems for different sub-tasks • one sub-system solves part of problem, then passes control to another • Demon Rules A rule that fires whenever its premises match contents of the working memory
Demon Rules • demon rules amongst backward chaining rules, but they do not participate in the normal backward-chaining inference. • A demon rule remains dormant until information in premises appears in working-memory; then the rule fires. • The firing on one demon-rule can cause other demon rules to fire -- like a series of forward chaining rules in an otherwise backward chaining process.
Demon rules: Example Demon 1 Tank pressure Problem IF Power of off AND Tank Pressure > 1000 THEN Problem = Tank Pressure Problem Demon 2 Emergency Situation IF Problem = Tank Pressure Problem THEN Situation = Emergency Demon 3 Evacuate IF Situation = Emergency THEN Response = Evacuate Personnel
Specifying Rules (Variable, value) variable = value, variable <= value variable IS value variable IS NOT value Example IF car = red AND car = old AND cat = automatic What is car here? THEN car = sid Object, Attribute, Value Object: car Attributes: Values car_color: red, white, green car_age: old, new car_transmission automatic, stick car_owner sid, frog, ...
Object, Attribute, Value Example IF GPA equal or exceeds 3.5 THEN accept into honor society Attribute: GPA Attribute: accept into honor society Value: 3.5 (student_acceptance_status) Object: Student (implicit) Value: yes Example IF client is risk adverse THEN invest in bluechip stock Object: Client Attribute: client risk profile Attribute: client investment strategy