37
Backward-Chaining Rule-Based System

Backward chaining rule-based system

Embed Size (px)

Citation preview

Page 1: Backward chaining rule-based system

Backward-Chaining Rule-Based System

Page 2: Backward chaining rule-based system

Introduction:

● The principle objective of backward chaining is to prove some goal or hypothesis

● The process begins by collecting GOAL RULES

● The premise of the goal rules may be supported by other rules, so they are set as Sub-Goals

Page 3: Backward chaining rule-based system

Introduction:

● The inference engine searches through the system’s rules in a recursive fashion.

● Backward Chaining inference engine will reach some premise that is not supported by any of the system’s rules (a Primitive) --> Ask User

Page 4: Backward chaining rule-based system

Introduction:

● The answer is placed in the current memory

● The process continue until all goals and sub-goals are searched memory contains all information provided by user and inferred by rules.

Page 5: Backward chaining rule-based system

Medical Consultation Systems

MYCIN was an early expert system that used artificial intelligence to identify bacteria causing severe infections, such as bacteremia and meningitis, and to recommend antibiotics, with the dosage adjusted for

patient's body weight

Page 6: Backward chaining rule-based system

Medical Consultation Systems

● Like MYCIN , performs diagnosis for infectious blood diseases

● Unlike MYCIN , doesn’t identify organ but rather the nature of the infection

● 3 different expert systems: Diagnosis, Prescription, Prescription Changes

Page 7: Backward chaining rule-based system

Megningitis Diagnosis Expert System

● The system has only one goal :Prove or disprove “Infection is

meningitis”

● One Goal rule : RULE 1This can be proven if the user already knows that the patient has meningitis or the system can infer it.

Page 8: Backward chaining rule-based system

Megningitis Diagnosis Expert System

● The system has only one goal :Prove or disprove “Infection is

meningitis”

● One Goal rule : RULE 1This can be proven if the user already knows that the patient has meningitis or the system can infer it.

● RULE 2,3,4 : search the test results

Page 9: Backward chaining rule-based system

Megningitis Diagnosis Expert System

● The system has only one goal :Prove or disprove “Infection is

meningitis”

● One Goal rule : RULE 1This can be proven if the user already knows that the patient has meningitis or the system can infer it.

● RULE 2,3,4 : search the test results

● RULE 5 : searches the area of patient symptoms

Page 10: Backward chaining rule-based system

Meningitis diagnosis rules

● STEP 1: Find rules with hypothesis in “THEN” part

EMPTY

Working Memory

● STEP 2: see if first premise in RULE 1 is listed in working memory

NO

Page 11: Backward chaining rule-based system

Meningitis diagnosis rules

EMPTY

Working Memory● STEP 3: see if this premise exists in

“THEN” part of any rule

- NO

● STEP 4: This premise is a primitive

Question : “Do you know if patient has Meningitis ?”

Answer : NO

Patient known to have Meningitis - FALSE

Page 12: Backward chaining rule-based system

Meningitis diagnosis rules

EMPTY

Working Memory● STEP 5: look at second premise in

RULE 1 and see if it’s in working memory

- NO

● STEP 6: see if this premise exists in “THEN” part of any rule

Patient known to have Meningitis - FALSE

Page 13: Backward chaining rule-based system

Meningitis diagnosis rules

EMPTY

Working Memory● STEP 7: see if first premise in RULE

2 is listed in working memory

- NO

● STEP 8: see if this premise exists in “THEN” part of any rule

Patient known to have Meningitis - FALSE

Page 14: Backward chaining rule-based system

Meningitis diagnosis rules

EMPTY

Working Memory

● STEP 9: Q: Were test run?A:

YES

Patient known to have Meningitis - FALSE

Tests run- TRUE

● STEP 10: Q: Were culture seen?

A: YES

Culture seen- TRUE

Page 15: Backward chaining rule-based system

Meningitis diagnosis rules

EMPTY

Working Memory

Patient known to have Meningitis - FALSE

Tests run- TRUE

Culture seen- TRUE

Page 16: Backward chaining rule-based system

Meningitis diagnosis rules

EMPTY

Working Memory

Patient known to have Meningitis - FALSE

Tests run- TRUE

Culture seen- TRUE

● STEP 11: Q: The appearance of the culture is coccus?

A: Why

System: This will aid in determining if cultures look like Meningitis

Page 17: Backward chaining rule-based system

Meningitis diagnosis rules

EMPTY

Working Memory

Patient known to have Meningitis - FALSE

Tests run- TRUE

Culture seen- TRUE

● STEP 11: Q: The appearance of the culture is coccus?

A: Why

System: This will aid in determining if cultures look like Meningitis

Page 18: Backward chaining rule-based system

Meningitis diagnosis rules

EMPTY

Working Memory

Patient known to have Meningitis - FALSE

Tests run- TRUE

Culture seen- TRUE

● STEP 12:

User: Why?

System: This will determining if “we suspect meningitis from test results”

Page 19: Backward chaining rule-based system

Meningitis diagnosis rules

EMPTY

Working Memory

Patient known to have Meningitis - FALSE

Tests run- TRUE

Culture seen- TRUE

● STEP 13:

Q: The appearance of the culture is coccus?

A: No Appearance of cultures is coccus-FALSE

Page 20: Backward chaining rule-based system

Meningitis diagnosis rules

EMPTY

Working Memory

Patient known to have Meningitis - FALSE

Tests run- TRUE

Culture seen- TRUE

● STEP 14: look at second premise in RULE 2 and see if it’s in working memory

- NoAppearance of cultures is coccus-FALSE

Page 21: Backward chaining rule-based system

Meningitis diagnosis rules

EMPTY

Working Memory

Patient known to have Meningitis - FALSE

Tests run- TRUE

Culture seen- TRUE

● STEP 15: see if this premise exists in “THEN” part of any rule

Appearance of cultures is coccus-FALSE

Page 22: Backward chaining rule-based system

Meningitis diagnosis rules

EMPTY

Working Memory

Patient known to have Meningitis - FALSETests run- TRUE

Culture seen- TRUE

● STEP 16: All premises of RULE 5 are unknown and primitives Questions Appearance of cultures is

coccus-FALSESuffering persistent headaches- TRUE

Q: Has the patient been suffering persistent headaches ?

A: YES

Page 23: Backward chaining rule-based system

Meningitis diagnosis rules

EMPTY

Working Memory

Patient known to have Meningitis - FALSETests run- TRUE

Culture seen- TRUE

● STEP 16: All premises of RULE 5 are unknown and primitives Questions Appearance of cultures is

coccus-FALSESuffering persistent headaches- TRUE

Q: Has the patient been suffering dizziness?

A: YESSuffering dizziness- TRUE

Page 24: Backward chaining rule-based system

Meningitis diagnosis rules

EMPTY

Working Memory

Patient known to have Meningitis - FALSETests run- TRUE

Culture seen- TRUE

● STEP 16: All premises of RULE 5 are unknown and primitives Questions Appearance of cultures is

coccus-FALSESuffering persistent headaches- TRUE

Q: Has the patient been lethargic?A: YES Patient been lethargic -

TRUE

Page 25: Backward chaining rule-based system

MCS: Example 2SYSTEM: My first recommendation is the following:

AMPICILLINDose: 3.8g (30ml)

GENTAMICINDose: 131mg (3.2ml)

Page 26: Backward chaining rule-based system

MCS Example 3The goal of the alternative prescription system is to allow the user to choose some alternative drug, which the system will then check for effectiveness and safety.

Page 27: Backward chaining rule-based system

Alternative Prescription rules

Working Memory

● STEP 1:

Drug recommendation AMPICILLIN-TRUE

Drug recommendation GENTAMICIN-TRUE

System : The following drugs are recommended:

Drug1 = AMPICILLINDrug2 = GENTAMICIN

Page 28: Backward chaining rule-based system

Alternative Prescription rules

Working Memory

● STEP 2:

System : Do you want to consider another prescription?

User: YES

Drug recommendation AMPICILLIN-TRUE

Drug recommendation GENTAMICIN-TRUE

Page 29: Backward chaining rule-based system

Alternative Prescription rules

Working Memory

● STEP 3:

System : Which drug would you like to delete?

User: AMPICILLIN

COMMENT: System binds ?deleted _drug to AMPICILLIN

Drug recommendation AMPICILLIN-TRUE

Drug recommendation GENTAMICIN-TRUE

Page 30: Backward chaining rule-based system

Alternative Prescription rules

Working Memory

● STEP 4:

System : What drug would you like to add?

User: STREPTOMYCIN

Drug recommendation AMPICILLIN-TRUE

Drug recommendation GENTAMICIN-TRUE

Page 31: Backward chaining rule-based system

Alternative Prescription rules

● STEP 5:System : The requested drug STREPTOMYCIN comes from the drug class AMINOGLYCOSIDES and would not be an effective replacement for AMPICILLIN which comes from the drug class PENICILLINS. To be elective, the alternative drug should come from the same drug class.

Drug recommendation AMPICILLIN-TRUE

Drug recommendation GENTAMICIN-TRUE

Working Memory

Alternative drug considered - FALSE

Page 32: Backward chaining rule-based system

Alternative Prescription rules

● STEP 6:System : Would you like to try another drug?

User: YES

COMMENT: RULE 9 fires and a number of facts are retracted and the system is cycled.

Drug recommendation AMPICILLIN-TRUE

Drug recommendation GENTAMICIN-TRUE

Alternative drug considered – FALSE

Working Memory

Page 33: Backward chaining rule-based system

Alternative Prescription rules

Working Memory

● STEP 7:System : What drug would you like to add?

User: PENICILLIN

COMMENT. The system again determine the classes of the deleted and requested drugs, and checks to see that they come from the same class-RULE 6.

Drug recommendation AMPICILLIN-TRUE

Drug recommendation GENTAMICIN-TRUE

Alternative drug considered – FALSE

Page 34: Backward chaining rule-based system

Alternative Prescription rules

● STEP 8:System : The requested drug PENICILLIN comes from the drug class PENICILLINS and would be an effective replacement for AMPICILLIN which also comes from the drug class PENICILLINS.

COMMENT: The system now is satisfied that the new requested drug is an effective replacement for the deleted drug. It next checks to see if the drug should be safe for the patient on the basis of the patient's age.

Drug recommendation AMPICILLIN-TRUE

Drug recommendation GENTAMICIN-TRUE

Alternative drug considered – FALSE

Working Memory

Requested Drug effective - TRUE

Page 35: Backward chaining rule-based system

Alternative Prescription rules

● STEP 9:

System : What is the age of the patient in years?

User: 30

COMMENT: The system now must check to see if the patient is old enough to take the drug – Rule 8. The system calls the external program “AGE” which obtains the minimum allowable age for the requested drug from the database “DRUGS.”

Drug recommendation AMPICILLIN-TRUE

Drug recommendation GENTAMICIN-TRUE

Alternative drug considered – FALSE

Requested Drug effective - TRUE

Working Memory

Page 36: Backward chaining rule-based system
Page 37: Backward chaining rule-based system

Alternative Prescription rules

● STEP 10:

System : The patient is 30 years old which is fine for the drug PENICILLIN which has minimum safe age requirement of 15 years.

Working Memory

Drug recommendation AMPICILLIN-TRUE

Drug recommendation GENTAMICIN-TRUE

Alternative drug considered – FALSE

Requested Drug effective - TRUE

Requested Drug safe - TRUE