Expert System
Expert System
Course outline
Introduction
This is a tutorial on Expert Systems. The tutorial will lead the student to the understanding of what Expert
System is; the basic concepts in building Expert Systems as well as the architecture of Expert Systems. In
addition, the elements in the construction of Expert Systems and tools for building Expert systems are
presented. The text also discusses the reasoning methods, evaluation techniques applied in expert systems and
the language and tools of knowledge engineering.
The reader is advised to get a firm grip of the discussions in this tutorial or stumble on without it. To make an
‘A’ in this course, you are advised to attend classes, study the notes after each day’s lecture, ask the lecturer
questions where you have issues and obtain answers; and take the examination confidently without depending
on ‘microchip’.
Back to business! To be able to understand what an Expert system is, one needs an understanding of some
basic concepts. Thus, we define some terms:
1.1 Definition of Terms
Fact
Fact is a thing that is known, an item or element under consideration. For instance, the title of a book is a fact
about a book.
Data
1
2
Data are facts collected together. They provide the basis of reasoning or calculation. Data are commonly
referred to as unprocessed information. For instance, a set of facts such as title, author, publisher, etc, can be
used as data used to describe a book.
Information
Information is data collected about something or somebody and represented in a meticulous arrangement to
provide knowledge in a particular circumstance.
Knowledge
Knowledge is a practical or theoretical understanding of a subject or area under consideration. Knowledge is
a combination of data, information and past experience. It is information put into a specific context.
Knowledge is the sum of what is currently known. It is generally believed that knowledge is power; hence
those who possess a lot of knowledge and experience are called experts. Knowledge is required to display
intelligence.
Human Expert
An expert is
- a person who has in-depth knowledge in an area or who is skilful in a particular area
- a person that is skilled in an area due to great knowledge acquired in the area
- a person who has great ability acquired from research or experience, in a particular area of study
or profession.
Definition of system
- A system is a set of entities (things) working together as a whole to achieve a particular purpose
- a set of rules or procedures by which something is done
- an organized method by which a particular purpose is achieved
What is an Expert System (ES)
Expert Systems are often referred to as Knowledge Based Systems (KBS). Knowledge Based Expert Systems
are computer programs that ‘think’ and do things intelligently like human experts. According to Turban and
Aronson (2001), an expert system is a system that uses human knowledge captured in a computer to solve
problems that ordinarily require human expertise. Edward Feigenbaum, one of the pioneers of research in
artificial intelligence, defines an expert system as an intelligent computer program that uses knowledge and
inference procedures to solve problems that are difficult enough to require significant human expertise for
their solution. From the above definitions, we notice that
- it exhibits intelligence
- it uses knowledge
- for it to use the knowledge, it must acquire the knowledge from human experts
- with the knowledge at its disposal, it applies inference
- with the knowledge and inference, it provides an expert-like solution to a difficult problem.
Currently expert systems are used in a variety of fields. Some of these systems are
MYCIN – MYCIN is a medical expert system that helps doctors to diagnose bacteria-induced diseases
ONCOCIN – an expert system that assists Physicians in managing complex drug regiments for treating
cancer patients.
PROSPECTOR – is an expert system that helps Geologist to detect where mineral deposits can be found
Genesis – an expert system that assists scientists in planning and cloning experiments
Guidon – an expert system that is applied in education to teach students by correcting answers to technical
questions
Expert systems were born out of a need to make up for the limitations associated with human conventional
decision making processes. The need for expert systems include the following
- Humans sometimes shirk responsibility and may not be available when needed to solve a
problem; expert systems are available for use all the time
- Human experts are inconsistent in their everyday decision making; expert systems provide
accurate solutions depending on the knowledge provided
- Expert systems are capable of comprehending large amounts of data
- Human experts cannot retain large amount of data in memory while an expert system can retain
large amount of data in working memory
- Humans are slow in recalling information stored in their memory while expert systems have high
degree of knowledge recall
1.4 Benefits of Expert systems
1. The solutions provided by expert systems can easily be reproduced, that is, it can be used in different
places at the same time. A human expert can only function in a place at a time
3
4
2. Their performance ability is very high. The speed and capability of expert systems is by far higher
than that of a human expert.
3. An ES is always available for use
4. ES is convenient to use. It has friendly user interface which make it easy to be used by users
5. ES do not differentiate between people (does not care about relationships or status). But priority can
be built into expert systems depending on the problem.
6. Unlike a human expert, Expert System has no impediment to work in dangerous hazardous
environments, making it an essential tool for some procedures or actions
They generate the best solution when compared to human experts provided solutions.
1.5 Problems that can be Solved by Expert Systems
Even though expert systems solve a variety of complex problems faster and efficiently, not every problem can
be solved by expert systems. It is important to determine if the problem to be solved is the type that can be
solved by an expert system before using expert system methodology to solve a problem. Expert systems are
designed to mimic the intelligent abilities found in domain experts and make the knowledge available to the
members of the organisation for the purpose of problem solving.
The type of problem that Expert systems solve are problems that are ordinarily solved by professionals in a
particular domain such as by medical doctors, automobile engineers and other experts. Expert systems are
built to solve problems for which there is no single solution and therefore, cannot be completely defined by
conventional algorithms. For instance, one should not build an expert system to add numbers from 1 to 100
or sort data in a defined order since there are easier methods to handle that.
Knowledge
Data
Data
In (a) we notice that conventional programs work with data and a set of algorithms to solve a
problem. In contrast, in (b) expert system employs knowledge base, and inference engine to
solve problems. Hence, ES applies knowledge and reasoning to arrive at a conclusion unlike
conventional programs that use data and set of instructions
- Conventional programs need well-defined inputs or starting conditions, expert systems on the other
hand can operate with any combination of starting information since they know how to obtain the
unknown data they need. For instance, in conventional program, if a procedure is to calculate the
product of A and B, and data A is supplied without supplying the data B; it will not work because
of incomplete data. In expert system however, incomplete input can be handled by drawing
conclusions to provide an answer to the unknown or provide a degree of certainty based on what
is known.
- Conventional programs often require extensive modifications to incorporate new modules. In ruled
based expert systems for instance, rule sets can consult other rule sets to find the information
needed. Once expert system is developed it can be used by any other program or expert system
with little or no modification.
5
6
Expert systems are applied in many areas which earlier required human expertise. The range of applications
of expert systems technology to industrial and commercial problems are many. The following are some major
areas of applications of expert systems.
Diagnosis and Troubleshooting of Devices
This class comprises systems that figure out faults and suggest corrective actions for a malfunctioning device
or process. There are probably more diagnostic applications of ES than any other type. The diagnostic problem
can be stated in the abstract as: given the evidence presenting itself, what is the underlying
problem/reason/cause?
Medical Diagnosis
Medical diagnosis was one of the first knowledge areas to which expert systems were applied, and a variety
of expert systems have been developed to solve a variety of medical related problems
Planning and Scheduling
Systems under this category analyse a set of one or more potentially complex and interacting goals in order to
determine a set of actions to achieve those goals, and/or provide a detailed temporal ordering of those actions,
taking into account human and materiel constraints. This class has great commercial potential. Examples
include airline scheduling of flights, personnel, and manufacturing process planning.
Configuration of Manufactured Objects from Subassemblies
Configuration is a case where a solution to a problem is provided from a given set of elements related by a set
of constraints. Expert systems are used in this area for modular home building, manufacturing, and other
problems involving complex engineering design and manufacturing.
Financial Decision Making
The financial organisations such as banks have been a vigorous user of expert systems. Expert systems have
been created to assist bankers in determining whether to make loans to businesses and individuals. Also,
insurance companies have used expert systems to assess the risk presented by customers and to determine a
price for the insurance.
In addition, expert systems are applied in other areas such as Agriculture, Chemistry, Communication, Image
Processing, Environment, Power systems, Transportation, Engineering, etc.
Knowledge Publishing
The primary function of the expert system in this area is to deliver knowledge that is relevant to a user's
problem, in the context of the user's problem. Two widely used expert systems developed in this area are (1)
an advisor which counsels a user on appropriate grammatical usage in a text and (2) a tax advisor that
accompanies a tax preparation program and advises a user on tax strategy, tactics, and individual tax policy.
Process Control
6
7
Expert Systems under this category analyses real-time data from physical devices with the goal of noticing
anomalies, predicting trends, and controlling for both optimality and failure correction. For instance, oil
companies use expert systems to monitor processes oil refineries.
Design and Manufacturing
These systems assist in the design of physical devices and processes, ranging from high-level conceptual
design of abstract entities all the way to factory floor configuration of manufacturing processes.
1.9 Disadvantages of Expert Systems
- An Expert System lacks common sense, so it is essential to specify in knowledge base every
condition and circumstance in the problem context
- Informal conversation is not possible in expert system
- The ability of a person to learn from mistakes is relatively high and fast but designing an Expert
System that provides these conditions is rather complex.
- For a human expert, it is not very difficult to differentiate between the relevant issues and the
irrelevant ones. For an Expert System is not so trivial.
- An Expert System, unlike a human expert is unable to perceive any of the five senses, which limits
their ability to perception.
Exercise
Introduction
In this chapter, look at the components and architecture of expert systems. Also, an overview of human factors
associated with expert systems is presented.
2.1 Components of Expert Systems
There are three major components of an expert system. These are the user interface, knowledge base and
inference engine.
The user interface: This component is the part of the ES that users use to interact with the system.
The user interface is used to ask users questions and obtain answers which are used to make
inference and arrive at conclusions. The user interface can as well be used as explanation facility
to provide reasons for its solutions and the sequence of steps it followed to reach conclusions. The
user interface controls the dialog with the user and/or automatically reads in data. If no user dialog
7
8
takes place, the expert system is referred to as an embedded system otherwise it is called an
interactive system.
(i) The knowledge base (KB): The KB is used by the ES to store domain-specific knowledge and
rules, that is, it consists of facts and rules. The facts are stored in database of facts or working
memory. This is a store of facts collected in a current situation. For example, in the case of a
doctor diagnosing a patient to treat a particular illness, the doctor asks the patient questions, and
collects his complaints and stores in the database. The knowledgebase can also contain objects
and their attributes depending on the type of knowledgebase.
The rules in the knowledge base can be
(a) ‘rules of thumb’, that is, rules based on practical experience instead of theory
(b) < IF .. THEN> sequence of rules or statements.
(c) rules obtained by statistical techniques such as fuzzy logic and neural networks
This facts and rules in the knowledge base are given as input to the inference engine that process
them and arrive at conclusions. Information in the database varies according to situations. Values
in working memory or database of facts are used to evaluate antecedents in the knowledge base.
Consequences from rules in the knowledge base may create new values in working memory, update
old values, or remove existing values.
8
9
(control system). The inference engine contains program code for the problem-solving strategies and for the
interface to the user. The interface consists of three relatively independent parts: the user dialog part,
explanation facility for generating explanations and knowledge acquisition component. Typical architecture
of expert system is shown in fig. 2 below.
Expert System
9
10
when the weather is hot or cold and take appropriate action based on weather condition. But for an expert
system to do the same, rules as the ones shown below can be expressed to be applied to solve the problem
IF ‘temperature” greater than 370 (condition)
THEN (the action) switch on the Air conditioner
Knowledge Engineer
The knowledge Engineer is a person who extracts the knowledge of Domain Experts often by intensive
questioning using several knowledge collection methods. Sometimes, a knowledge engineer acquires
knowledge by reading related documents and formalizes the knowledge for the expert system.
He is responsible for designing, building and test running the expert system in most cases. He specifies the
reasoning methods to be used, and how to represent and handle facts and rules in the expert system. The
process of designing expert system is called knowledge engineering and consists of three steps: knowledge
acquisition (the process of obtaining the knowledge from experts), knowledge representation (the process of
selecting the most appropriate structures to represent the knowledge), and knowledge validation (testing that
the knowledge of ES is correct and complete)
The knowledge Engineer also decides on the choice of development software, programming language and
knowledge encoding techniques.
Programmer
The Programmer is a person that does the actual coding of the expert system, that is, he expresses the domain
knowledge in computer-understandable form. The programmer should be proficient in Artificial Intelligence
languages such as PROLOG, LISP, etc and also skilled in handling expert system shells and in conventional
high level programming languages such as C, C# C++, Python, Perl, PHP, Java, etc.
The User
The user is a person who uses the expert system when it is developed and put into use. The user interacts with
the system via the user interface hence user friendly user interface is a necessary requirement of an expert
system.
10
User Interface
11
User
Domain Expert
The process of constructing an expert system requires careful planning and patience. The following steps
should be taken to create the system:
1. The first thing to do is to ask the users of the system what they want and decide whether to create the
expert system from scratch or to use expert system shell.
2. Select the particular task and the task domain. Choose a task that the expert system can solve and solve
well. Ensure that the task and rules are stable
3. Choose the Shell to be used if Shell method is desired or the symbolic language if otherwise. Choose
the type of inference control required and/or the matching method.
4. Acquire initial knowledge about the task and the task domain. Identify the domain experts and select
the problem associated with the task. Obtain factual knowledge from both experts and from literature.
Obtain rules from experts and test the cases. Do extensive research.
5. Design the knowledge base and the inference engine using the information obtained from both experts
and from related documents
6. Design the input and output interfaces
7. Encode the knowledge using appropriate knowledge representation.
8. Implement the expert system.
9. Test the cases and evaluate the system.
11
12
This is hierarchical classification of knowledge. For people, this is a very natural reasoning process, but not
as much for computers. Hierarchical classification leads to enhanced generalization, information reduction
and also can dramatically increase performance. On the other hand, it can lead to reduced precision.
Rules; Rules represent a human-like knowledge representation. They are composed of simple if-then clauses
that are activated usually according to heuristics. Good features of rule-based systems are modularity,
simplicity and good performance. Rule-engines are generally not suitable for modelling complex world
relationships, and creating world models, but instead can be used to represent procedural or shallow
knowledge. Reasoning in a partially observable domain requires a measure of certainty in the proposition.
There have been many more or less successful approaches to represent the uncertainty in a rule-based
framework. This approach is very efficient in simple domains, but it’s use in complex systems is at least very
questionable. For all rule based systems, the data representation can be simple or complex depending on the
problem. The most fundamental scheme uses attribute-value pairs. For example, colour-white, and size-large.
3. Frames: Frames have been the first attempt to mimic human reasoning and knowledge hierarchy
representation. Frames are grouping of slots that represent semantically close knowledge. Despite their wide-
spread application, their background is mostly technically based, and offers a solid base for sound inference.
The principle of frames has been further enhanced and refined in Object Oriented Programming paradigm and
Multi-Agent System.
When a system is reasoning about multiple objects, it is necessary to include the object as well as the attribute-
value. For example, a furniture placement system might be dealing with multiple chairs with different
attributes, such as size, width, etc. The data representation in this case must include the object. Once there are
objects in the system, then each have multiple attributes. This leads to a record structure where a single data
12
13
item in working storage contains an object name and all its associated attribute-value pairs. Frames are a more
complex way of representing objects and their attribute-values. Frames add intelligence to the data
representation and allow objects to inherit values from other objects. Furthermore, each of the attributes can
be associated with procedures called “daemons” which are executed when the attribute is asked for or updated.
4. Logic. The basic notion of logic has been known already to old Greeks. It is a system
that defines a framework for representing relational knowledge and reasoning about it. Unlike rule systems,
logic is a very suitable tool for representing real world models. It can represent very complex relationships
among objects, it can represent hierarchies, and it is very extensible. The main problem of reasoning with
logic is that inference is usually an NP-complete (non-deterministic polynomial time) problem, and there have
not been many successful methods of expressing heuristic shallow knowledge using logics. The reasoning is
performed according to strictly defined rules of inference
13
14
First Applicable: if the rules are in a specified order, firing the first applicable one allows control over the
order in which rules fire. This is the simplest strategy and has potential for a large problem: that of an infinite
loop on the same rule. If the working memory remains the same, as does the rule-base, then the conditions of
the first rule have not changed and it will fire again and again. To solve this, it is a common practice to suspend
a fired rule and prevent it from re-firing and until the data in working memory, that satisfied the rule’s
conditions, has changed.
Random: Though it does not provide the predictability or control of the first applicable strategy, it does
have its advantages. For one thing, its unpredictability is an advantage in some circumstances (such as
games). A random strategy simply chooses a single random rule to fire the conflict set. Another possibility
for a random strategy is a fuzzy rule based system in which each of the rules has a probability such that
some rules are more likely to fire than others.
Most Specific: This strategy is based on the number of conditions of the rules. From the conflict set the rule
with the most conditions is chosen. This is based on the assumption that if it has the most conditions then it
has the most relevance to the existing data.
Least Specific Used: Each of the rules is accompanied by a time or step stamp, which marks the last time it
was used. This maximizes the number of individual rules that are fired at least once. If all rules are needed
for the solution of a given problem, this is a perfect strategy.
Best rule: For this to work, each rule is given a weight, which specifies how much it should be considered
over the alternatives. The rule with the most preferable outcomes is chosen based on the weight.
Where to Apply Rule-based technique
Rule–based systems are better to be applied in problems
- that has well–defined domain which can be easily represented.
- that do not change with time.
- where explanation of the reasoning process is very important.
14
15
Straight-chair-width-2
3. Records
Eg. Chairs
Object width colour type
Chair#1 3 Orange Easy
Chair#2 2 Brown Straight
IF
THEN
15
16
An expert system’s rule base is made up of many such inference rules. They are entered as separate rules and
it is the inference engine that uses them to draw conclusions. Because each rule is a unit, rules may be deleted
or added without affecting other rules (although it should affect which conclusions are reached). One
advantage of inference rules over traditional programming is that inference rules use reasoning which more
closely resemble human reasoning.
4.4 Ways of Representing Rules
Rules can represent relations, recommendations, directives, strategies and heuristics.
Examples:
1. Relation:
IF ‘fuel tank’ empty
THEN car is dead
2. Recommendation
IF season is autumn
AND sky is cloudy
AND forecast is drizzle
THEN recommend to ‘take an umbrella’
3. Directive
IF car is dead
AND ‘fuel tank’ is empty
THEN the action is ‘refuel the car’
4. Strategy
IF car is dead
THEN action is ‘check the fuel tank’
Step1 is complete
IF step1 complete
AND the ‘fuel tank’ is full
THEN action is ‘check the battery’
Step2 is complete
5. Heuristics
IF the spill is liquid
AND the ‘spill PH < 6’
AND the ‘spill smell’ is vinegar
THEN the ‘spill material’ is ‘acetic acid’
16
17
As aforementioned, in a rule-based system, knowledge is represented as rules. The figure below shows the
basic structure
Inference Engine
Explanation facility
User Interface
User
Rule 3: IF A is true
THEN X is true
The three rules can be represented as in a chain below
(a) Forward Chaining
Here we work from A to Z
A X
Y
B Z
D
E
Here we work from Z to A. As an exercise represent the above diagram using backward chaining
18
19
Using backward chaining to infer the type of animal called dog, we assert our goal – the animal is a dog and
find facts to support our claim thus
Dog
Is mammal
Lives on land Lives in water
Is domestic Not domestic
Can bark Cannot back
Here we can say that the animal is a dog because it is a mammal. We can infer that it is a mammal because it
lives on land, and since it is domestic and can back then we conclude that in fact, it is a dog.
Example 2:
For example, the following identifies birds
IF
Family is albatross and
Colour is white
THEN
Bird is layman albatross
IF
Family is albatross and
Colour is dark
THEN
Bird is black-footed albatross
The system would try all of the rules which gave the information that satisfy the goal of identifying the bird.
Each would trigger sub-goals. In the case of these two rules, the sub-goals of determining the family and the
colour would be perused. The following rule is the one that satisfies the family sub-goal:
IF
Order is tubenose and size large and wings long narrow
THEN
Family is albatross
The sub-goals of determining colour, size, and wings would be satisfied by asking the user. By having the
lowest level sub goal satisfied or denied by the user, the system effectively carries on a dialog with the user.
19
20
The user sees the system asking questions and responding to answers as it attempts to find the rule which
correctly identifies the bird.
Example 3:
Assume the following assertions are in the Working Memory
A1: running nose
A1: temperature =101.7
A3: headache
A4: cough
20
21
This is a lazy kind of inference. It does no work until absolutely necessary. This is in contrast to forward
chaining, where the system eagerly awaits new facts and tries applying conditions as soon as they arrive.
21
22
Example 4
R1: If someone is in final year computer science, then he needs a job.
R2: If someone is in final year computer science, then he lives in Kano
R3: if someone needs a job, he will apply to be an Engineer
If we add, John is in final year computer science, the system would do nothing at all.
22
23
This time, there is a fact that answers this question – John is in final year Computer Science. So we have
proved R1, and that is proved in R3. That answered the question.
In other problems, a goal is specified and the expert system must find a way to achieve that specified goal.
For instance, if there is an epidemic of a certain disease, the expert system could presume a given individual
had the disease and attempts to determine if its diagnosis is correct based on available information. A backward
chaining, goal-driven system will be used to accomplish this. To do this, the system looks for the action in the
THEN part of the rules that matches the specified goal. In other words, it looks for the rules that can produce
this goal. If the rule is found and fired, it takes each of that rule’s conditions as goals and continues until either
the available data satisfies all the goals or there are no more rules that match. Fig. 4 below shows how a
backward chaining procedure works.
Do goals
Return true match fact in
Conflict Set
Rule to fire found?
All
recursion
Exi
t
23
24
No rule
found
No rule
found
IF
24
25
Unplaced TV and
Sofa on wall(x) and
Wall(y) opposite wall(x)
THEN
Place TV on wall (y).
This rule would take a problem state with an unplaced television and transform it to a state that had the
television placed on the opposite wall from the sofa so that people sitting on the sofa can watch the television
opposite them. Since the television is now placed, this rule will not fire again. Other rules for other furniture
will fire until the furniture arrangement task is finished.
Example of Forward Chaining in Medical Diagnosis
Assume the following assertions are in Working Memory
A1: running nose
A1: temperature =101.7
A3: headache
A4: cough
25
26
Question: Can we establish that the patient having the symptoms can be diagnosed with typhoid?
Rule
base Determine possible rule to fire
Working
memory
Select
Fire rule rule to Conflict ?
resolution
Exit
If found
Conflict Set?
No rule
found
Exit if specified by rule (if goal is reached or no solution possible)
For an example of forward chaining, if neither is dominant, the number of facts in the working may help the
decision. If all (relevant) facts are already known, and the purpose of the system is to find where that
information leads, forward chaining should be selected. But if on the other hand, few or no facts are known
26
27
and the goal is to find if one of many possible conclusions is true, use backward chaining. The forward
chaining process is summarized as follows
1. Match the condition patterns of rules against facts in working memory.
2. If there is more than one rule that could be used (that could "fire"), select which one to apply (this is
called conflict resolution)
3. Apply the rule, maybe causing new facts to be added to working memory
4. Halt when some useful (or goal) conclusion is added to WM (or until all possible conclusions have
been drawn.)
Backward Chaining
Note that for a data-driven system, the system must be initially populated with data, in contrast to the goal-
driven system which gathers data as it needs them. Fig. 4.4 illustrates the difference between forward and
27
28
backward chaining system for two simplified rules. The forward chaining system starts with the data a=1 and
b=2 and uses the rules to derive d=4. The backward chaining system starts with the goal of finding a value for
d and uses the two rules to reduce that to the problem of finding values for a and b.
Conflict Resolution
So to resolve conflict, the following methods are used
28
29
1. Fire the rule with the highest priority, the priority may be the order of occurrence in the knowledge
base.
2. Fire the most specific rule, as specific rule is assumed to process more information than general rule.
3. Fire the rule which has most recently entered data in the database.
Rule based systems are adaptable to a variety of problems. In some problems, information is provided with
the rules and the expert system follows them to see where they lead. An example of this is a medical diagnosis
in which the problem is to diagnose the underlying disease based on a set of symptoms (in working memory).
A problem of this nature is solved using forward chaining (data-driven) system that compares data in the
working memory against the conditions (IF parts) of the rules and determines which rules to fire.
Chapter 5
Building Rule based Systems with Identification Trees
Semantic Network
A semantic network is the most basic structure upon which an identification tree is based. Identification trees
are simply called ID trees. Simply put, a semantic network consists of nodes representing objects and links
which have direction representing any relations between the objects and labels used to draw inferences and do
reasoning. All concepts in semantic networks are predefined named nodes. Semantic network as a
representation is arising because it allows us to systematically solve problems and also to make all the
constraints, all the objects, all the relationships, all the moves very explicit. For instance, in fig. 5.1, objects
include zoom, feline, fish, mouse, mammal and animal, the links are the lines that join the objects and the
labels are eats, is a, chases, is an (these are called the vocabulary of the network).
Zoom fish
eats
felin
mouse
is a chases
mammal
is a Is a Is an
animal
is an
Living thing
is a
Animal
is a is a
Pet Plant
is a Livestock
Cat Dog
Horse Tree Bus
is a is a is a is a
is a
Iroko
is a
Question: What is the relationship between Computer-Science-Club and ESUT Dodgers in the semantic
network displayed below
NUGA Games
Team Team
Exercise: Represent the following concepts in a semantic network with appropriate vocabulary: faculty,
lecturer, student, department, courses, grade.
30
31
Semantic tree
At the next level of complexity exits a semantic tree, which is simply a semantic network with a few additional
conditions and terms. Each node has a parent to which it is linked (with the exception of the root node which
is its own parent and which needs no link above).
Each link connects the parent node with any or all children nodes. A single parent node may have multiple
children, but no child has multiple parents. Nodes with no children are called leaf nodes. The difference
between semantic tree and semantic network is that a semantic network can have loops while a tree cannot.
For instance,
Roo
A B
C D
E
F
G
I H
J
The root node is the first node in the tree. It is parent to itself and to A and B. A is child to the root and
parent to C. B is child to the root and parent to D and E. C is a child to A and has no children of his own,
making it a leaf node. D is parent to F which is parent to leaf nodes I and J. E is a parent to leaf nodes G and
H.
Decision Tree
Decision trees are used to show alternatives, outcomes and payoffs. A decision tree comprises nodes and
arcs. The symbol represents nodes, represents an outcome node and – (called arcs or lines) represent
decision alternatives or outcomes. The example below shows how a decision tree can be used to solve
problems
Example 1: The ANAMCO manufacturing company must decide whether to manufacture a component part
at its Enugu site or buy the component from a supplier. The resulting profit depends on the demand for the
product.
The following payoff table shows the projected (expected) profit
31
32
Question: (a) Show the order of decisions and outcomes using a decision tree
(b) Calculate the expected payoff at each outcome node and
(c) Identify the best decision alternative based on the expected payoff
Tip: Take the state-of-nature probabilities as P(LD) = 0.35, P(MD= 0.35, P(HD) =
0.3
Solution: Step 1: We start with the decision node and show the order of decision
LD - N20,000
1 Manufacture MD 2 N40,000
HD N100,000
Purchase
3
LD N10,000
MD N45,000
HD N70,000
Step 2: We fold back the decision tree. This means the process of identifying the optimal decision in a
decision tree.
Step 3: We move from right to left and calculate expected payoff at each node
32
33
Step 4: At each decision node, select the best decision alternative (based on the expected alternative
calculated at each outcome node in step 3)
Here we make a decision. Since the company wants to maximize profit we choose the payoff with the
highest value, that is, we compare the value of EPM with EPP and choose the one with the highest value.
Note: If we are solving a maximization problem (as in this case where we want to maximize profit) we
select the maximum payoff, but if it is a minimization problem, eg if we want to minimize cost, we select
the minimum payoff.
Decision (answer): The best decision alternative would be to purchase the component since it yields the
highest expected payoff
Example 2: Peace Mass Transit is considering using online transportation system to manage its
transportation business. They are deciding to use in-house developers or buy the software from vendors or
use open source software. The resulting profit depends on whether they will have high patronage or low
patronage.
The following payoff table shows the projected (expected) profit
Question: (a) Show the order of decisions and outcomes using a decision tree
(b) Calculate the expected payoff at each outcome node and
(c) Identify the best decision alternative based on the expected payoff
33
34
LD N200,000
2
In-house MD N400,000
1 3
Step 2: We fold back the decision tree. This means the process of identifying the optimal decision in a
decision tree.
Step 3: We move from right to left and calculate expected payoff at each node
Step 4: At each decision node, select the best decision alternative (based on the expected alternative
calculated at each outcome node in step 3)
Here we make a decision. Since the company wants to maximize profit we choose the payoff with the
highest value, that is, we compare the value of EPI with EPV and EPO and choose the one with the highest
value.
34
35
Decision: The best decision alternative would be to use Open source software since it is more cost effective
Exercise: Mrs Asogwa is considering starting a business venture to produce shoes and earrings
With a favourable market she expects to make
N90,000 from a large facility or
N60,000 from a small facility
Decision trees can also be used to solve identification problem as the following example shows. Each node
of a decision tree is linked to a set of possible solutions. Each parent node that is not a leaf (and thus has
children) is associated with a test, which splits the set of possible answers into subsets representing every
possibility of the test’s outcomes. In fig.5.4 below, each non-leaf node serves as a test to lead to one of the
leaf outcomes.
Living thing
Animal
35 Plant
Pet
Livestoc
Cat Dog
Tree Bush
36
36
37
PROLOG
PROLOG is considered higher level language than LISP. It is very useful for declarative programming where
a set of statements or axioms are declared about a system that is to be reasoned about. It has the capability of
deducing the desired additional facts with built in powers of deduction. This simplifies the coding process and
the programmer has to just specify what is required rather than indicate how it is to be computed, hence freeing
programmers from worrying about the implementation details.
A PROLOG program consists of set of clauses. A clause is either a fact or a rule, which is used to indicate a
relationship between elements. PROLOG tries to match the arguments of the query with the facts in the data
base. This process is known as unification. If the unification succeeds, the variable is said to be
instantiated. Here description of domain is known as database. Variables in PROLOG are used to represent
unspecified domain elements.
The orders of database entries are very important because the efficiency of a program depend on order as it
can affect the amount of search required to satisfy the goal. Secondly, because of the exact nature of search
process, there might be cases where PROLOG may not find a solution even when it can be easily inferred
from the given information.
PROLOG applies the following inference process
• Given a goal, PROLOG searches the database, starting at the top, for a fact that matches the goal.
• When PROLOG finds a match and instantiates the appropriate variables, it leaves a pointer where the
match occurred.
When a goal matches the head of a rule rather than a fact, the atoms within the body of the rule are treated as
sub goals that must all be satisfied to prove that the head is satisfied.
Characteristics of Symbolic languages
Some of the distinguishing characteristics of programming languages needed for expert systems are
- Efficient mix of integer and real variables
- Good memory management procedures
- Extensive data manipulation routines
- Incremental compilation
- Tagged memory architecture
- Efficient search procedures
Expert system shell
A shell is a piece of software which helps in designing inference engine, knowledge base and user interface
for expert system. It provides user friendly software environment to the knowledge engineer for building an
expert system. It contains all the generic expert system logic required to build an expert system. In other
37
38
words, a shell is expert system software which has no domain knowledge but provides a facility for entering
the knowledge base.
A shell basically provides the following facilities
- A knowledge representation language
- Knowledge base editor
- Tracing and debugging facilities
- User interface facilities
- Facilities for uncertainty reasoning
- Rule induction facilities
Benefits of using expert system shell
- Shell enables the great programming efforts that go into building the user interface and inference
engine to be reused.
- It requires less programming skills to develop expert system with shell than with developing the
system from the scratch using symbolic or conventional programming methods.
- Expert system development project can be completed faster, cheaper and in more efficient way
Demerits of using expert system shell
- Expert system shells are tools for end user and the resulting software package may have poor
documentation, weak security and high maintenance.
- Since shells are not designed for specific domains, if the shell is a poor match for the type of
knowledge in the domain concerned, it may not replicate the expertise of an expert.
Criteria for Selection of expert system shell
The following criteria serve as a guide in deciding on the choice of expert system shell to use
- The characteristics of knowledge, and the style of inferences used by domain experts.
- The time and money available for the project.
- The programming capabilities available in-house.
- The hardware platform on which the system is to be run.
- The performance expectation from the system.
Expert System Tools
The main task of expert system development tools is making development of an expert system much easier
compared to developing it with programming language. Selecting the correct tool is vital in design and
development of an expert system. This is because
- They provide rich software development environment like structure editors, powerful debugging
and tracing facility, multi windows, graphics and so on.
- They allow rapid prototyping because of incremental compilers and automatic version control.
38
39
- Defining model, knowledge representation and inference design are built into the tools.
- They helps in maintaining the system and historical database.
In general, expert system tools are ranging from lowest level general purpose programming languages to
highest level hybrid development environments. There are many expert system development tools are
available. They are of different types as presented below
Types of Expert System Tools
In general, there are five types of expert system tools.
- Inductive tools
- Simple rule based tools
- Structured rule based tools
- Hybrid tools
- Domain specific tools
Inductive tools: Inductive tools generate rules from examples. Here a developer feeds in a large number of
examples from the machine’s information base. The tools use an algorithm to convert the examples into rules
and determine the order the system will follow when questioning the user.
Simple rule based tools: This type use IF-THEN rules to represent knowledge. They are useful for
developing expert systems containing fewer than 500 rules. The only problem with these tools is that they
lack high end editing facility for design of tools.
Structured rule based tools: They offer context trees, multiple instantiation, confidence factors, and more
powerful editors compared to simple rule based tools. Here IF-THEN rules are arranged into sets. These rule
sets act as separate knowledge bases. One set of rules can inherit the information acquired when other rule
sets are examined. These tools are more useful when we need to process large number of rules as rules can
be sub divided into sets.
Hybrid tools: Hybrid tools enable complex expert system development. These tools use object oriented
programming techniques to represent elements of every problem as objects. Here graphical user interface can
also be provided to users.
Domain specific tools: They are specially designed to be used only to develop expert systems for a particular
domain. It provides special development and user interface that make it possible to develop an expert system
faster. They are also referred to as narrow tools.
39
40
- Developer interface
- User interface
- System interface
- Training and support
A careful consideration of these criteria helps a lot in determining the right tool for the design and development
of expert system. In addition, the following questions need to be answered
- Is the tool portable on variety of hardware platforms?
- What is the cost of license? Open source tool is often preferred over proprietary tool because of cost
of purchase
- How frequently does the new version come and with what enhancement?
- What types of applications are developed and deployed using these tools?
- What other resources are required for implementation along with tools?
- Does the tool provide the knowledge representation mechanism suited for the problem domain?
- Does the tool have the flexibility to adopt to different knowledge representation techniques?
- Does the tool provide natural language interface for end user?
- What is the time taken to process rules, facts and execute it to display results?
- Does the tool provide user friendly interface for accepting input and displaying results?
- Does the tool provide interface with database and spreadsheets?
Types of Expert System tools
There are many expert system development tools available. Some of them are CLIPS (C Language Integrated
Production system), Loops, KEE, AGE, ART, ESIP Advisor, EXSYS, Guru, Insight, Rule Master, VP- Expert
and SRL, Jess, Vidwan, Knowledge Pro, K-Vision, Emycin, KAS, Leonardo, Xi Plus, Savoir &
XpertRule.. Currently, MATLAB and SciLab are also tools which are used widely used. MATLAB is a
proprietary tool, while SciLab is an open source tool. But both enables developer to design and develop
complex and hybrid expert system.
Evaluation of expert systems is a means of determining how well or good or accurate an expert system
fulfils the requirements specification of an expert system. It is an assessment of a system's reliability,
validity, quality and usability. Some view it in the context of verification and validation. Evaluation is done
after the development of a system. It is commonly referred to as Post Implementation Evaluation. During
evaluation, all the features and characteristics needed to satisfy the stated needs are assessed to ascertain
40
41
how well they satisfied the stated needs. Evaluation is an integral phase of system development life-cycle.
Evaluation enables a system to be justified in terms of its performance and benefits.
To ensure that a good evaluation is done, the system specification should be clearly spelled out and agreed
upon by both system developers and clients.
The specification document of an expert system should contain the what and the how. It should be noted
that the what part is contained in the knowledge base which, to a large extent, is the main component of
expert system. The how component of an expert system is contained in the inference engine. An expert
system specification should serve as both a contract between developers and clients, and as a blueprint for
designers and implementors. Specification should be stated early in the development cycle, so that
developers and clients agree about what is being developed.
(i) It helps to verify that the system satisfies the stated requirements
(ii) It is a means by which the system provides feedback to developers and system owners
(iii) It enables us to justify the adoption or rejection of a system
(iv) It helps us to determine the continuation or termination of a system
(v) It helps developers and users alike to clarify and set priorities for needed modifications
(vi) After evaluation, developers can confidently transfer responsibilities to users.
Evaluation Techniques
Evaluation of expert system can be done using a variety of approaches. These are - qualitative, quantitative
and hybrid approaches. The details of these approaches are left as an exercise.
41
Expert systems adapt their operations by updating their knowledge base with new information, allowing them to respond to changes in their environment or domain . This process is managed through a dynamic knowledge base and an inference engine capable of processing new rules and facts . The knowledge acquisition part of an expert system enables ongoing updates and modifications by human experts or knowledge engineers, thus ensuring that the system remains relevant and accurately reflects current expert knowledge . The incorporation of new data and rules allows the system to provide informed decisions and recommendations as circumstances evolve.
Forward chaining, a data-driven inference technique, begins with available data and advances by applying rules to derive conclusions until the goal is reached . An example of forward chaining would be using medical symptoms to diagnose a disease, where initial symptoms trigger rules leading to a final diagnosis . Meanwhile, backward chaining is a goal-driven technique that starts with a specific goal and works backwards through rules to find supporting data . An example of backward chaining could be diagnosing a disease by starting with the presumed diagnosis and finding symptom data that supports or refutes that diagnosis . Both methods employ logical inference but do so in opposite directions of reasoning.
Expert systems provide significant benefits in hazardous environments by enabling operations where human presence would be risky or inefficient . Their consistent and accurate decision-making capabilities, not influenced by emotional or physical factors, help ensure safety and reliability in decision-making processes . However, limitations include the dependency on initially encoded knowledge and potential inflexibility without continuous updates by knowledge engineers . These systems address safety concerns by operating autonomously without being subject to human error, fatigue, or environmental risks, thus minimizing danger to human workers . Nevertheless, reliance on accurate and current knowledge is crucial for the successful application of expert systems in such scenarios.
An expert system typically consists of several key components including a knowledge base, an inference engine, and a user interface . The knowledge base stores rules and facts derived from human experts, serving as the foundation for solving problems . The inference engine applies logical reasoning methods to the knowledge base, deriving new knowledge and drawing conclusions . The user interface facilitates interaction between the system and users, allowing users to input data and retrieve solutions . Together, these components interact to capture expert knowledge, process it using inferential logic, and communicate decisions or recommendations back to users.
Expert systems excel at solving problems that require significant human expertise and where solutions cannot easily be rendered through conventional algorithms . These include diagnosing medical conditions, managing agricultural processes, or financial and technical troubleshooting where expert judgment, decision-making, or complex rule evaluation are necessary . However, expert systems are not ideal for well-defined or numerical problems that can be solved using straightforward algorithms, such as arithmetic operations or sorting data, as these tasks do not require expert-level reasoning or complex rule application . The cost, complexity, and maintenance required for developing and updating expert systems also make them less suitable for simpler problem types.
Expert systems offer consistent decision-making as they are programmed based on specific rules and knowledge acquired from human experts, leading to consistent and accurate solutions as long as the input data matches the expert knowledge base . They are continuously available, without the limitations of human availability, which makes them highly reliable for organizations requiring constant decision support . In contrast, human experts may exhibit inconsistencies due to variable factors such as fatigue, mood, or cognitive biases, and are not always available for consultation . The implications for organizations include the potential for improved decision-making processes, reduced errors, and increased operational efficiency due to the high availability and consistency of expert systems.
Expert systems are defined by several key characteristics: they solve complex, intelligent problems that are difficult for humans to solve, they use conflicting and/or incomplete knowledge, they respond to changes in their knowledge base, and they interactively provide user-friendly experiences . In contrast to conventional programs that follow predefined algorithms, expert systems use a logical and inference-based approach to reason like human experts . Furthermore, expert systems must possess a feasible inference engine and an explanation facility to justify how conclusions are reached or why additional information is needed . Conventional programs typically lack this level of adaptability, reasoning capability, and interactive knowledge representation.
Uncertainty in expert systems is managed through techniques that accommodate ambiguous or incomplete data, ensuring decisions are made even without full certainty . One common method involves associating numeric values representing certainty or belief factors with rules, allowing the system to weigh evidence and make probabilistic decisions . Other methods include fuzzy logic, Bayesian networks, or Dempster-Shafer theory to process vague information effectively . These approaches enable expert systems to operate in real-world conditions where data may not always be clear-cut or exhaustive, thus maintaining the ability to provide useful outputs amidst uncertainty.
The user interface of an expert system significantly contributes to its effectiveness and usability by providing a seamless interaction between the user and the system . A user-friendly interface allows users to input data easily and understand the outputs, enhancing user satisfaction and encouraging frequent use . The interface facilitates communication of complex information in a manner that is accessible to non-experts, thereby expanding the applicability and effectiveness of the expert system across diverse user groups . It is critical for ensuring that the functionalities of the expert system are fully utilized and understood, making the user interface a pivotal component in the system's overall success.
A knowledge engineer plays a crucial role in the development of an expert system; they are responsible for extracting and formalizing the knowledge of domain experts, designing the expert system, and executing test runs to ensure the system's accuracy . They employ various knowledge collection methods and determine how to represent and handle facts and rules within the system . Knowledge engineers collaborate closely with domain experts to acquire the necessary information and with programmers to implement the system using suitable programming languages and development tools . Their collaboration with users is also essential to ensure that the user interface is accessible and the system meets the practical needs of end-users.