An expert system is a computer program that uses artificial intelligence to solve complex problems in a specialized domain that usually requires human expertise. It consists of a knowledge base containing facts and rules, an inference engine that applies the rules to the facts to deduce solutions, and a user interface. For example, a medical diagnosis expert system allows a user to diagnose their disease based on their symptoms by checking the system's knowledge base of symptoms and their associated diseases. The knowledge base is developed by interviewing human experts and representing their knowledge as if-then rules. The inference engine uses forward or backward chaining to match the user's inputs to the rules and deduce the most likely diagnosis. The user interface then communicates the system's diagnosis and explanation to
2. What is an EXPERT SYSTEM?
● An expert system is a computer expert that emulates the decision making
ability of a human expert.
● Expert system, a computer program that uses artificial intelligence methods
to solve complex problems within a specialized domain that ordinarily
requires human expertise.
3. Example: Making of a medical diagnosis expert
system
● A medical diagnosis expert system lets the user diagnose his disease without
going to a real doctor (but of course, user has to go to a real doctor for
treatment)
6. Components of an Expert System
1. Knowledge Base
2. Inference Engine
3. User Interface
7. 1. Knowledge Base
● A knowledge base is an organized collection of facts about the system’s
domain.
● Facts for a knowledge base must be acquired from human experts through
interviews and observations.
● This knowledge is then usually represented in the form of “if-then” rules
(production rules): “If some condition is true, then the following inference can
be made (or some action taken).”
● A probability factor is often attached to the conclusion of each production
rule and to the ultimate recommendation, because the conclusion is not a
certainty.
8. Components of Knowledge Base
● Factual Knowledge − It is the information widely accepted by the Knowledge
Engineers and scholars in the task domain.
● Heuristic Knowledge − It is about practice, accurate judgement, one’s ability
of evaluation, and guessing.
9. Knowledge Acquisition
● The knowledge base is formed by readings from various experts, scholars,
and the Knowledge Engineers. The knowledge engineer is a person with the
qualities of empathy, quick learning, and case analyzing skills.
● He acquires information from subject expert by recording, interviewing, and
observing him at work, etc.
● He then categorizes and organizes the information in a meaningful way, in
the form of IF-THEN-ELSE rules, to be used by interference machine. The
knowledge engineer also monitors the development of the ES.
10. Knowledge Base for Medical Diagnosis Expert
system
Symptoms Disease
Fever, cough, conjunctivitis, running nose, rashes Measles
Fever,headache, ache, conjunctivitis, chills,sore
throat,cough,running nose
Flu
Headache, sneezing, sore throat, running nose,
chills
Cold
Fever, chills,ache,rashes Chickenpox
11. 2. The Inference Engine
● An inference engine interprets and evaluates the facts in the knowledge
base in order to provide an answer or to reach a goal state
● For example, if the KB contains the production rules “if x, then y” and “if y, then
z,” the inference engine is able to deduce “if x, then z.”
● In medical diagnosis ES, if a user has Fever, chills,ache,rashes, then user
is suffering from chickenpox
● Strategies used by the inference engine
○ Forward chaining
○ Backward chaining
12. Forward Chaining
● “What can happen next?”
● It is a data-driven strategy.
● The inferencing process moves from the facts of the case to a goal
(conclusion).
● The inference engine attempts to match the condition (IF) part of each rule in
the knowledge base with the facts currently available in the working memory.
● If several rules match, a conflict resolution procedure is invoked;
14. Forward Chaining in Medical Diagnosis ES
● A user has fever, headache, ache, conjunctivitis, chills,sore
throat,cough,running nose.
● In forward chaining, the inference engine will use the symptoms specified to
conclude to the disease the user is suffering from.
● After going through the above symptoms, the inference engine concludes that
the user is suffering from flu by checking the knowledge base.
15. Backward Chaining
● “Why this happened?”
● On the basis of what has already happened, the Inference Engine tries to find
out which conditions could have happened in the past for this result.
● This strategy is followed for finding out cause or reason.
● The inference engine attempts to match the assumed (hypothesized)
conclusion - the goal or subgoal state - with the conclusion (THEN) part of the
rule.
● If such a rule is found, its premise becomes the new subgoal.
● In an ES with few possible goal states, this is a good strategy to pursue.
17. Backward Chaining in Medical Diagnosis ES
● Suppose a user has measles.
● Now, the inference engine will look up in the knowledge base to derive the
symptoms that could have resulted in measles.
● It inferred that the symptoms were fever, cough, conjunctivitis, running nose,
rashes.
● This worked as only few states were present.
18. 3. User Interface
● User interface provides interaction between user of the ES and the ES itself.
● The user of the ES need not be necessarily an expert in Artificial Intelligence.
● It explains how the ES has arrived at a particular recommendation. The
explanation may appear in the following forms −
○ Natural language displayed on screen.
○ Verbal narrations in natural language.
○ Listing of rule numbers displayed on the screen.
19. Code for medical diagnosis ES: 1
#include <iostream>
using namespace std;
void measels(char,char,char,char,char);
void flu(char,char,char,char,char,char,char,char);
void cold(char,char,char,char,char);
void chickenpox(char,char,char,char);
20. Code for medical diagnosis ES: 2
int main()
{
char name[50];
char a,b,c,d,e,f,g,h,i,j,k;
cout << "Please enter your name.. " << endl;
cin>> name;
cout << "Do you have fever? (y/n)"<< endl;
cin>>a;
cout << "Do you have rashes? (y/n)"<< endl;
21. Code for medical diagnosis ES: 3
cin>>b;
cout << "Do you have headache? (y/n)"<< endl;
cin>>c;
cout << "Do you have running nose? (y/n)"<< endl;
cin>>d;
cout << "Do you have conjunctivitis? (y/n)"<< endl;
cin>>e;
cout << "Do you have cough? (y/n)"<< endl;
cin>>f;
cout << "Do you have ache? (y/n)"<< endl;
22. Code for medical diagnosis ES: 4
cin>>g;
cout << "Do you have chills? (y/n)"<< endl;
cin>>h;
cout << "Do you have swollen glands? (y/n)"<< endl;
cin>>i;
cout << "Do you have sneezing? (y/n)"<< endl;
cin>>j;
cout << "Do you have sore throat? (y/n)"<< endl;
cin>>k;
23. Code for medical diagnosis ES: 5
measles(a,f,e,d,b);
flu(a,c,g,e,h,k,f,d);
cold(c,j,k,d,h);
chickenpox(a,h,g,b);
return 0;
}
24. Code for medical diagnosis ES: 6
void measles(char q,char w,char r,char t,char y)
{
if(q=='y'&&w=='y'&& r=='y' && t=='y' && y== 'y')
cout<< "You may have measles"<< endl;
else
cout<< "";
}
25. Code for medical diagnosis ES: 7
void flu(char q,char w,char r,char t,char y,char p,char l,char x)
{
if(q=='y'&&w=='y'&& r=='y' && t=='y' && y== 'y'&& p=='y' && l=='y' && x=='y')
cout<< "You may have flu."<< endl;
else
cout<< "";
}
28. Limitations of Expert System
No technology offers an easy and total solution. Large systems are costly and
require significant development time and computer resources. ESs also have their
limitations which include:
● Limitations of the technology
● Problems with knowledge acquisition
● Maintaining human expertise in organizations
● https://www.youtube.com/watch?v=TRzBk_KuIaM&t=460s