Presentation is loading. Please wait.

Presentation is loading. Please wait.

Inferencing using forward- and backward-chaining.

Similar presentations


Presentation on theme: "Inferencing using forward- and backward-chaining."— Presentation transcript:

1 Inferencing using forward- and backward-chaining

2 Forward-chaining Sequential inferencing of rules Check premises of rules one by one to verify true or false May take a longer time to discover answer due to ordering of rules

3 Forward-chaining (example) Patient comes into a doctor’s office and complains about certain ailments. The doctor must infer what is wrong with the patient Observed facts: Patient has a temperature of 102 Patient has been sick for 2 months Patient has a sore throat

4 Forward-chaining (example) Rule 1 If the patient has a sore throat and we suspect a bacterial infection then we believe the patient has a strep throat Rule 2 If the patient’s temperature is > 100 Then the patient has a fever Rule 3 If the patient has been sick over a month and the patient has a fever Then we suspect a bacterial infection

5 Forward-chaining (example) The system takes each rule in turn and checks to see if its premises are listed in the working memory When the system finds matches for all the premises, it places the rule’s conclusion in the working memory Thus, the system gains new problem information that it uses for further reasoning When no rule emerges that can be fired, the system stops

6 Forward-chaining (example) Cycle 1 Rule 1, Premise 1 Sore throat ? true Rule 2, Premise 2 Bacterial infection? unknown Rule 2, Premise 1 Temperature > 100? true Fire Rule 2: Patient has fever

7 Forward-chaining (example) Cycle 2: Rule 1 unknown and Rule 2 fired Rule 3, Premise 1 Sick over a month? true Rule 3, Premise 2 Patient has a fever? true Fire Rule 3: bacterial infection

8 Forward-chaining (example) Cycle 3 Rule 1, Premise 2 Bacterial infection: true Fire Rule 1: strep throat Stop

9 Backward-chaining Search is from goal to goal Start from a possible ultimate goal Try to prove the premises of the ultimate goal The premises of the ultimate goal become the subgoals Search continues with the effort to prove true or false these subgoals by looking at the premises of these subgoals If all the premises of the subgoals are true, then the subgoals and the goal are true

10 Backward-chaining (example) Rule 1 If there are signs of throat infection and there is evidence that the organism is streptococcus Then the patient has strep throat Rule 2 If the patient’s throat is red Then there are signs of throat infection Rule 3 If the strain of the organism is grampos and the morphology of the organism is coccus and the growth of the organism is chains Then there is evidence that the organism is streptococcus Observed: Patient’s throat is red

11 Backward-chaining (example) Step 1: Goal – patient has a strep throat Step 2: Goal proven? No Step 3: Find rules with goal in the then part of Rule 1 Step 4: See if Rule 1, premise 1 is true (unknown) Step 5: Find rules with this premise in then part of Rule 2 Step 6: See if Rule 2, Premise 1 is true (true)

12 Backward-chaining (example) Step 7: Fire Rule 2 Step 8: See if Rule 1, Premise 2 is true Step 9: Find rules with this premise in then-part Rule 3 Step 10: Assuming that all three premises of Rule 3 requires user input and all are true, then the system adds this new information to the working memory and fires the conclusion of Rule 3 Step 11: Conclude that the patient has strep throat

13 Backward-chaining Faster search because goal-based Ordering of rules will usually start with the ultimate goals at the top and the subgoals proving these goals will be ordered below Grouping rules related to one subgoal together is important especially in a long list of rules

14 Exercise Based on the following sets of rules, determine whether you should invest long- term in Malaysia using backward-chaining Observed: economic situation in Malaysia is stable. Rule 1 If gross capita per income increases Then long-term investment is viable

15 Exercise Rule 2 If employment rate is high Then gross capita per income increases Rule 3 If employment rate is low Then gross capita per income decreases

16 Exercise Rule 4 If economic situation is stable Then employment rate is high Rule 5 If economic situation is unstable Then employment rate is low

17 Exercise If forward-chaining is used, will the ordering of rules change? Show the inferencing using forward-chaining


Download ppt "Inferencing using forward- and backward-chaining."

Similar presentations


Ads by Google