0% found this document useful (0 votes)
77 views24 pages

Ch. 02 - Rule-Based Expert Systems

The document provides an overview of rule-based expert systems, focusing on forward and backward chaining methods for decision-making. It explains how these methods are applied in systems like MYCIN for diagnosing infections and includes practical exercises for implementing these techniques in Python. Additionally, it outlines homework tasks for creating expert systems that diagnose medical conditions based on user-input symptoms.

Uploaded by

Yuddho Seavminh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views24 pages

Ch. 02 - Rule-Based Expert Systems

The document provides an overview of rule-based expert systems, focusing on forward and backward chaining methods for decision-making. It explains how these methods are applied in systems like MYCIN for diagnosing infections and includes practical exercises for implementing these techniques in Python. Additionally, it outlines homework tasks for creating expert systems that diagnose medical conditions based on user-input symptoms.

Uploaded by

Yuddho Seavminh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Rule-Based

Expert Systems

By: SEK SOCHEAT


Advisor to DCS and Lecturer
Mobile: 017 879 967
Expert System Email: socheatsek@norton-u.com
2024 – 2025 socheat.sek@gmail.com
Y3 – DCS – NU
Table of Contents:
1. Understanding Rule-Based Systems (Forward and
Backward Chaining)
1. Introduction to Rule-Based Expert Systems
3. Practical Exercise
2. Forward Chaining in MYCIN - Theory and
Examples Diagnosing Infections and Recommending
3. Practical: Implement a Simple Forward Chaining Treatment with System-Inspired Logic
System in Python

2. Backward Chaining - Theory and Use Cases 4. Homework


1. Introduction to Backward Chaining in MYCIN Create a system and answer questions.
2. Theory and Example of Backward Chaining
3. Practical: Implement Backward Chaining in Python
4. Comparison and Q&A

2
1. Understanding Rule-
Based Systems (Forward
and Backward Chaining)
Rule-based expert systems use "rules"
to make decisions based on data. They
often employ two main inference
methods:

1. Forward Chaining

2. Backward Chaining

3
Forward Chaining
What is Forward Chaining?

This is a data-driven approach that begins with


available data and applies rules to infer new
facts until a goal is achieved.

It’s commonly used in diagnostic systems


where the system starts with initial information
and follows logical steps to arrive at
conclusions.

4
Backward Chaining
What is Backward Chaining?

A goal-driven approach that starts with a


hypothesis and works backward through rules to
confirm if the initial conditions support this
hypothesis.

It's often used in systems designed for planning


or recommendation, as it seeks evidence to
validate a specific outcome​​.

5
Forward vs. Backward Chaining

• Forward Chaining: Starts with known data and applies rules to


infer all possible conclusions, ideal for generating multiple results.
Used in systems where all potential outcomes are needed.

• Backward Chaining: Starts with a specific goal and works


backward to see if conditions support it, making it efficient for
confirming specific hypotheses. Used in targeted diagnosis or
troubleshooting systems.

6
Forward Chaining in MYCIN - Theory

MYCIN uses forward chaining to diagnose


infections by starting with patient data and applying
rules sequentially. Each rule checks if current facts
meet its conditions, and if they do, it adds a new
fact or conclusion, often with a certainty factor to
express confidence. This process continues,
generating further inferences, until MYCIN reaches
a recommended diagnosis and treatment​​.

7
Forward Chaining in MYCIN - Theory

1. Begin with Patient Data: MYCIN starts with known symptoms and lab results.

2. Apply Rules: It checks if each rule’s conditions match the known data.

3. Generate New Facts: When a rule is satisfied, MYCIN infers a new fact.

4. Use Certainty Factors: It assigns confidence levels to each inference.

5. Repeat Process: Newly inferred facts trigger more rules, creating a chain of
inferences.

6. Reach Diagnosis and Treatment: MYCIN continues until it arrives at a


diagnostic conclusion.

8
Examples
Implementing a forward-chaining system focused on
diagnosing COVID-19 based on common symptoms.

9
Examples
Implementing a forward-chaining system focused on
diagnosing COVID-19 based on common symptoms.

10
2. Backward Chaining - Theory
and Use Cases
Backward Chaining is a goal-driven inference method in which
the system starts with a hypothesis (goal) and works backward to
determine if existing data supports it. It checks the rules and
searches for conditions that could confirm the goal, then evaluates
if those conditions are met by known facts.

11
Use Cases
Unlike forward contact tracing, backward contact tracing
identifies the source of newly detected cases.
• Medical Diagnosis: Begins with a suspected disease and works
backward through symptoms and test results to confirm it.

• Troubleshooting Systems: Starts with a problem (e.g., device failure)


and traces back possible causes to find the solution.

• Recommendation Systems: Proposes items by first setting a desired


recommendation, then confirming if user preferences align with it.

12
Use Cases
Unlike forward contact tracing, backward contact tracing
identifies the source of newly detected cases.

13
Introduction to Backward Chaining in MYCIN

• In MYCIN, backward chaining starts with a suspected


diagnosis and works backward to confirm it.

• The system checks rules that support the hypothesis,


verifying if symptoms and test results align with the
conditions needed to confirm the disease.

• This approach helps MYCIN efficiently narrow down


diagnoses based on specific medical data.

14
Theory of Backward Chaining

• Backward chaining is a goal-driven inference method.

• It begins with a specific goal or hypothesis and works in reverse,


examining available data and rules to confirm if the goal can be met.

• The system checks rules that would achieve the goal and attempts to
satisfy the conditions of these rules by searching for supporting data.

• If conditions aren't met, it continues to examine other rules or sub-


goals that could support the initial hypothesis.

15
Example of Backward Chaining

16
Example of Backward Chaining

Result:

17
3. Practical Exercise
Implement an expert medical system, is trying to determine if a patient
has pneumonia by using backward chaining.
System could diagnoses pneumonia as below:
1. Pneumonia diagnosis requires:
• Cough
• Chest pain
2. Cough is confirmed if:
• The patient has a persistent cough
3. Chest pain is confirmed if:
• The patient experiences sharp pain when breathing
Given: The patient reports persistent cough and sharp pain when
breathing.

18
Solution:

19
Solution:

20
Homework:
Create a backward-chaining expert system that can diagnose multiple
conditions based on user-input symptoms. Use the following
conditions:
5. Chest Pain is confirmed if:
1. Pneumonia requires: • Sharp Pain when Breathing
• Cough and Chest Pain 6. Sneezing is confirmed if:
2. Cold requires: • Frequent Sneezing
• Sneezing and Runny Nose 7. Runny Nose is confirmed if:
3. Flu requires: • Nasal Congestion
• Fever and Body Aches 8. Fever is confirmed if:
4. Cough is confirmed if: • Temperature above 100°F
• Persistent Cough 9. Body Aches are confirmed if:
• Muscle Pain
21
Homework:
Tasks:
1. Implement the system using backward
chaining to confirm a diagnosis based on
symptoms entered by the user.
2. Ensure the system can confirm multiple
conditions based on the symptoms
provided in each session.
3. Use while True to continuously gather
symptoms until the user decides to stop.

22
Homework:
Questions:
1. How does backward chaining help in
narrowing down the possible diagnoses
based on user input?
2. Explain the output of the program when
the user inputs symptoms for both a Cold
and Flu.
3. How would you modify the system to give
a confidence score for each diagnosis?

23
Thank You
SEK SocheaT
socheatsek@norton-u.com

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy