0% found this document useful (0 votes)
8 views41 pages

Expert System

The document provides a comprehensive overview of Expert Systems (ES), including their definitions, components, architecture, and applications across various fields. It discusses the basic concepts necessary for understanding ES, such as knowledge, data, and reasoning, as well as the benefits and limitations of using ES compared to human experts. Additionally, it highlights the importance of user interfaces, knowledge bases, and inference engines as key components of ES architecture.

Uploaded by

spiritdivine777
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)
8 views41 pages

Expert System

The document provides a comprehensive overview of Expert Systems (ES), including their definitions, components, architecture, and applications across various fields. It discusses the basic concepts necessary for understanding ES, such as knowledge, data, and reasoning, as well as the benefits and limitations of using ES compared to human experts. Additionally, it highlights the importance of user interfaces, knowledge bases, and inference engines as key components of ES architecture.

Uploaded by

spiritdivine777
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

1

COS 458 Expert Systems Lecture Note

Course outline

The meaning of expert system (ES)


Basic concepts in building ES
Architecture of ES;
Construction of ES
Reasoning about reasoning
Tools for building ES
Evaluation of ES
Language of tools of knowledge engineering
Chapter 1

Basic Concepts in Building Expert Systems (ES)

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

- An ES is a computer software not hardware


2
3

- 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.

1.2 Examples of Expert Systems

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

1.3 The Need for Expert Systems

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.

1.6 Characteristics of Expert System


- ES solve complex, intelligent problems that are otherwise difficult for humans to solve. This
means that it should provide solutions using conflicting and/or incomplete knowledge
- They respond and adapt to changes in their knowledge base
- ES work with existing expert information
- ES are highly interactive and user friendly
- They act in logical manner, that is, they follow rules applying elements of logic to arrive at a
conclusion. To do this, they must represent knowledge and reason effectively based on logical
inference
- Must possess a feasible inference engine (that is, inference engine that can be implemented)
- It should possess an explanation facility that will tell how it reached a conclusion based on the
facts it has or why it did not reach a solution or made a particular prediction. Also it should say
why it needs a particular piece of information
4
5

- Should be applied in a particular domain


1.7 Differences between an expert system and conventional programs
The under-listed are some of the differences between expert system and other algorithmic programs
- Conventional programs do not imitate human activities such as in decision making, diagnosis, etc
while Expert systems do
- Conventional programs employ algorithms and do not exhibit intelligence, rather they follow
defined step by step instructions, while ES use the knowledge base and inference engine to
exhibit intelligence. Fig 1 below shows the difference

Methods for solving


problems (inference
Algorithm engine)

Knowledge

Data
Data

(a) Conventional programs (b) Expert systems

Fig 1 Differences between Conventional Programs and Expert Systems

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.

1.8 Application Areas of Expert systems

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

(1) Give 8 definitions of expert systems and cite your sources


(2) List 5 applications of expert system and a sample system in each area
(3) Distinguish between an ES and conventional programs
(4) Why do you think that expert systems are important?

Chapter 2: Expert System Architecture and Human Factors

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.

(ii) Inference Engine


The inference uses the facts in the database, matches it with the rules or statements to come with a
conclusion or to arrive at the solution of a problem under consideration. It controls the steps taken
to solve a problem.
Types of Inference Engines
There are two main types of inference engines – deterministic and probabilistic inference engines
Deterministic: This type of inference engine involves some elements of certainty, that is, its conclusion is
known to be. For instance, if two elements of hydrogen are combined with one element of oxygen, the result
is water (H20).
Probabilistic: This type of inference engine is associated with uncertainty, that is, the outcome or result is not
certain. For instance, if there are 10 lecturers in Computer Science department, how many will be Professor
in 5 years. The number can only be determined with some elements of probability.
2.2 Architecture of Expert System
Architecture of an expert system is used to refer to the various components and their relationships to one
another. The functional division between the expert knowledge and the problem-solving strategies is reflected,
as far as the architecture is concerned, in two main modules: the knowledge base and the inference engine

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

User Interface Knowledge base


(stores knowledge which
User dialog and is facts and rules)
User Facts reading in data

Explanation facility Inference Engine


(control system which
Expertise Knowledge acquisition part derives new knowledge
that enables the expert from existing knowledge)
enter and modify data

Fig 2: Architecture of an Expert System

2.3 Key Players in Expert Systems


The creation of an expert system based on the architecture requires the services of a number of people working
as a team. These are: project manager, Domain Expert, Knowledge Engineer, Programmer and the User.
Project Manager:
A project manager is a person that leads the development team. He/she has the responsibility of managing
both human and material resources involved in the development of a system. He interacts with other members
of the team and ensures all deliverables and objectives are met.
Domain Expert
A Domain Expert is a professional in a specific problem area. The domain expert acquires the knowledge
from study or experience in a particular domain. The expert relies on experience and heuristics (or rules of
thumb) to solve a problem successfully. The Domain Expert makes available his expert knowledge to the
Knowledge Engineer but in some instances, the Domain Expert can double as a Knowledge Engineer. The
human mental process and ability is too complex to be represented completely as algorithms. The much that
can be done is to express the knowledge in form or rules for problem solving. For instance, an expert can tell

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

IF “temperature” less than 270 c

THEN switch on the heater

IF ‘temperature” is equal to 370 c

THEN relax on a sofa

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

Knowledge Engineer Programmer

Fig 4: Expert System Components and Human Interfaces

Chapter 3: Expert System Development Processes and Knowledge Representation

3.1 Steps in Developing Expert Systems

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

3.2 Knowledge Representation


There are a number of ways that knowledge can be represented in an expert system. Some of these are
Semantic Networks. A semantic network is a classical representation of hierarchical relational knowledge
in ES. It is basically a graph where the nodes are labelled by atomic formulas, and arcs represent relations
between them. The nodes of this graph then represent entities and classes of entities. These classes then may
be hierarchically ordered to represent the knowledge. This leads to two basic relations between the node, that
is: subclass, entity of. They were first developed as a method of representing human knowledge. Though the
basic feature of semantic networks that are employed in many very large ES.

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

Chapter 4 Reasoning about Reasoning

4.1. Reasoning in Rule Based Systems

4.1.1 Theory of Rule Based Systems


Rule–based systems also called production systems are programs that instead of using conventional algorithms
use sets of IF–THEN rules (production rules). Unlike algorithms, the order in which these rules should be
used is not specified. It is decided by the program itself with respect to a problem state. The rule-based system
uses a simple technique. It starts with a rule-base which contains all of the appropriate knowledge encoded in
IF – THEN rules, and a working memory which may or may not initially contain any data, assertions or
initially known information. The system examines all the rule conditions (IF part) and determines a subset,
the conflict set, of the rules whose conditions are satisfied based on data in the working memory. Of this
conflict set, one of those rules is triggered (fired). Which one is chosen is based on a conflict resolution
strategy. When the rule is fired, any actions specified in its THEN clause are carried out. These actions can
modify the working memory, the rule-base itself, or do just about anything else the system programmer
decides to include. This loop of firing rules and performing actions continues until one of the two conditions
are met or there are no more rules whose conditions are satisfied or a rule is fired whose action specifies the
program should terminate.
Which rule is chosen to fire is a function of the conflict resolution strategy. Which strategy is chosen can be
determined by the problem or it may be a matter of preference. In any case, it is vital as it controls which of
the applicable rules are fired and thus how the entire system behaves. There are several different strategies
but here are a few that are most common.

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.

4.2 Data Representation


In rule-based systems, the rules are used to reference data. The data representation can be simple or
complex, depending on the problem. There four levels representations as shown in fig. 3.1.
1. Attribute-value Pair
Eg. color-white
2. Object-Attribute-value Pairs
Eg. arm-chair-width-3

14
15

Straight-chair-width-2
3. Records
Eg. Chairs
Object width colour type
Chair#1 3 Orange Easy
Chair#2 2 Brown Straight

4. Frames eg. Mammal


Skin legs
Fur Default 4
Monkey
Tail size legs
Curly medium 2
Elephant
Size tusks type

Large Default 2 Constraint


Indian or
African
Fig 3.1: Levels of Data Representation

4.3 Inference Rules


An understanding of inference rules is important to understand expert systems. An inference rule is a statement
that has two parts: an IF clause and a THEN clause. The rules are what give expert systems the ability to find
solutions to problems. The IF part is called the antecedent or premise or condition while the THEN part is
called the consequent or conclusion or action. A rule can have multiple antecedents or conditions joined by a
conjunction or disjunction operators AND or OR.
An example of an inference rule is:

IF

The restaurant location is in Igboland and the occasion is romantic

THEN

The choice wine is palm wine

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

Basic Structure of Rule based systems

As aforementioned, in a rule-based system, knowledge is represented as rules. The figure below shows the
basic structure

Knowledge base Database of facts


(containing facts about
(containing IF THEN rules) current context)

Inference Engine

Explanation facility

User Interface

User

Fig 4.1 Basic Structure of Rule based Expert System


Source: Negnevitsky, Pearson Education, 2002

4.5 Construction of Inference Engine


Inference engine can be constructed in three major ways – Backward chaining, forward chaining and Rule
value. Only the first two will be discussed in this course. The rule value inference is an improvement of
backward chaining but it is difficult to implement. Moreover, its knowledgebase construction is difficult
because it requires value quantifier in addition to standard object attributes. Therefore, we are going to focus
on backward and forward chaining. Before then, let us look at how we can construct inference chain.
Construction of Inference Chain
Ways of constructing inference engine is referred to as ‘chaining’ because one part of the rule is connected or
linked to or chained to another in a logical manner. Example,
Rule 1: IF Y is true
AND D is true
THEN Z is true
Rule 2: IF X is true
AND B is true
AND E is true
THEN Y is true
17
18

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

(b) Backward Chaining

Here we work from Z to A. As an exercise represent the above diagram using backward chaining

Goal-driven Reasoning or Backward Chaining


Goal-driven Reasoning or Backward Chaining is an efficient way to solve problems that can be modelled as
structured selection problems. That is, where the aim of the system is to pick the best choice from many
enumerated possibilities. It is an inference technique which uses IF THEN rules to repetitively break a goal
into smaller sub-goals that can be proved easily. For instance, an identification problem falls into this category.
Diagnostic systems also fit into this model, since the aim of the system is to pick the correct diagnosis. The
knowledge is structured in rules which describe how each of the possibilities might be selected. This rule
breaks the problem into sub-problems.
Example 1:
Assuming we have three animal objects and their attributes and we intend to classify an animal based on the
attributes as shown below,

Object: Dog Object: Goat Object: Hippo


Attributes Attributes Attributes
Is a mammal Is a mammal Is a mammal
Lives on land Lives on land Lives in water
Is domestic Is domestic Not domestic

18
19

Can bark Cannot bark Cannot bark

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

With the following rules in the knowledge base


R1: if (nasal congestion)
(bleeding)
THEN diagnose (Ebola)
Exit
R2: if (running nose)
THEN assert (nasal congestion)
R3: if (body-ache)
THEN assert (archiness)
R4: if (temperature >100)
THEN assert (fever)
R5: if (headache)
THEN assert (archiness)
R6: if (fever)
(archiness)
(cough)
THEN assert (bleeding)

Analysis of the solution


Step 1: R1 fires since the goal, diagnose (Ebola) matches the conclusion
of that rule. New goals are created: (nasal congestion) and (bleeding) and backward chaining is
recursively called with these new goals.
Step 2: R2 fires, matching the goal (nasal congestion). New goal is created
(running nose). Back-chaining is recursively called. Since (running

20
21

nose) is in working memory), it returns true.


Step 3: R6 fires, matching goal bleeding. Back-chaining recursion with new
goals (fever) and (archiness) and (cough)
Step 4: R4 fires, adding goal (temperature >100), since temperature in
working memory is 101.7, it returns true
Step 5: R3 fires, adding goal (body aches). On recursion, there is no
information in working memory, nor rules that match this goal. Therefore, it returns false and the
next matching rule is chosen. That rule is R5 which fires, adding goal (headache)
Step 6: Since (headache) is in working memory, it return true
Step 7: Goal (cough) is in working memory so it returns true also.
Step 8: Now, all recursive procedures have returned true, the system then
exits, returning true. This hypothesis was correct: the conclusion is that this Patient has Ebola

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.

The process of backward chaining is summarized as follows


1. Select rules with conclusions matching the goal.
2. Replace the goal by the rule's premises. These become sub-goals.
3. Work backwards till all sub-goals are known to be true -
either they are facts (in WM) or the user provides the information.
It can be summarized in the diagram above

Example 5: Typhoid Diagnosis


Typhoid
• poor appetite;
• abdominal pain and peritonitis;
• headaches;
• generalized aches and pains and weakness;
• high fever, often up to 104 F;
• lethargy (lack of energy);
• intestinal bleeding
• cough

21
22

Rules to be Used to Diagnose Typhoid Fever


R1: IF (Intestinal bleeding)
(Lethargy)
THEN diagnose Typhoid
Exit
R2: IF (poor appetite
THEN (intestinal bleeding)
R3: IF (pains)
THEN
Abdominal pains
Peritonitis
R4: IF dizziness
THEN headache

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.

But if we were to ask the question


Is there anyone who is going to become an Engineer?
The system would try to answer it. It would begin by searching either for a fact that give the answer directly
or for a rule by which the answer could be inferred. To find such a rule, it searches the entire knowledge base
for rules whose conclusions, if made true, will answer the question.
In this example, there are no facts giving the answer directly; but there is one rule whose conclusion, if true
would supply the answer; and that is R3.
The system next checks the rule’s conditions. Is there anyone who needs a job? As with the original question,
we look either for a fact that answers directly, or for a rule. There are no facts, but rule R1 is relevant.
So, we now check its conditions. Is there someone in final year Computer Science?

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.

Rule Examine working Memory and goals to see if


base goals are “known” true in knowledge base Working
Memory
Go

Do goals
Return true match fact in

Return False to recursive procedure


Yes

For each rule condition, recursively No


Determine next possible rules to fire by
backchain with conditions as goal checking conditions and goals

Conflict Set
Rule to fire found?

Fire rules Conflict


resolution

All
recursion

Exi
t

23
24

No rule
found

No rule
found

No One or more goals failed, check next matching rule

Yes Goals found to be true, exit returning true or no solution

Fig. 4.2: How a Back Chaining Procedure Works

Data-Driven Reasoning or Forward Chaining


For many problems, it is not possible to enumerate all the possible answers beforehand and have the system
selects the correct one. For example, configuration problems fall into this category. These systems might put
components in a computer, design circuit boards, or lay out office space. Since the inputs vary and can be
combined in an almost infinite number of ways, the goal driven approach will not work.
The data-driven approach or forward chaining uses rules similar to those used for backward chaining.
However, the inference process is different. The system keeps track of the current state of problem solution
and looks for rules which will move that state closer to a final solution. A system to layout living room
furniture would begin with a problem state consisting of a number of unplaced pieces of furniture. Various
rules would be responsible for placing the furniture in the room, then changing the problem state. When all
the furniture have been placed, then the system would be finished, and the output would be the final state.
Here is a rule from such a system which places the television opposite a sofa.

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

With the following rules in the knowledge base


R1: if (nasal congestion)
(dizziness)
THEN diagnose (typhoid)
Exit
R2: if (running nose)
THEN assert (nasal congestion)
R3: if (body-ache)
THEN assert (archiness)
R4: if (temperature >100)
THEN assert (fever)
R5: if (headache)
THEN assert (archiness)
R6: if (fever)
(archiness)
(cough)
THEN assert (dizziness)

25
26

Question: Can we establish that the patient having the symptoms can be diagnosed with typhoid?

Execution of the Forward Chaining process


Step 1: R2 fires, adding (nasal congestion) to working memory
Step 2: R4 fires, adding (fever) to working memory
Step 3: R5 fires, adding (archiness) to working memory
Step 4: R6 fires, adding (dizziness) to working memory
Step 5: R1 fires, diagnosing the disease as (typhoid) and exits, returning the diagnosis

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)

Fig. 4.3: How Forward Chaining Procedure Works

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.)

How to Determine the Method to Use


Of the two methods, that is, backward or forward chaining, the one to use is determined by the type of
problem under consideration. A comparison of the conditions and actions in the rule base can help determine
which method is preferred.
Forward chaining is preferred if all relevant facts are already known and the purpose of the system is to find
where that information leads. If on the other hand few or no facts are known and the goal is to find if one of
many possible conclusions is true, then backward chaining should be used.
Fig. 6 below shows the differences between the two methods
Forward Chaining

Data Rules Conclusion


a=1 IF a=1 and b=2 THEN c=3 IF c=3 THEN d=4 d=4
b=2

Backward Chaining

Subgoals Rules Goal


a=1 IF a=1 and b=2 THEN c=3 IF c=3 THEN d=4 d=4
b=2

Fig. 4.4 Differences Between Forward and 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.

How to Resolve Uncertainty


Often times in structured selection problems, the final answer is not known, with complete certainty. The
expert’s rules might be vague, and the user might be unsure of answers to questions. This can easily be seen
in medical diagnostic system where the expert is not able to be definite about diagnosis or in automobile fault
finding situations.
For expert systems to work in the real world, they must also be able to deal with uncertainty. For instance, to
diagnose HIV AIDS, symptoms - sporty skin and fatigue are associated with AIDS patient. But we cannot say
with certainty that a person with sporty skin and fatigue is HIV positive. One of the simplest schemes to
resolve this is to associate a numeric value with each piece of information in the system. The numeric value
represents the certainty with which the information is known. For instance, “I am 70% sure that this patient
has HIV”. Using this 0.7 confidence level resolves the conflict with a defined level of certainty. There are
numerous ways in which these numbers can be defined, and how they are combined during the inference
process.
Example of Conflict Condition
R1: IF “traffic light” is green
THEN the action is go
R2: IF “traffic light” is red
THEN the action is stop
R3: IF “traffic light” is red
THEN the action is go
We see that R2 and R3 have the same IF part. This condition is called conflict condition. And the method for
resolving the conflict that is, determining which action to take is called conflict resolution.
In forward chaining, these two rules will fire, but R2 will fire first because it is at the top, and its THEN part
will result in value stop. R3 will also fire because it has the IF part traffic light as red also but the action part
will be go.
However, not all systems involve uncertainty. For instance, in crime management system a suspect can be
proved either guilty or innocent based on facts and defined rules.

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

Fig. 5.1: Structure of Semantic network


In the semantic network, Zoom is a feline, a feline is a mammal, a mammal is an animal. Zoom chases a
mouse, a mouse is a mammal, a mammal is an animal. Zoom eats fish, fish is an animal. The relations are
written on the lines (links): is a, is an, eats, chases.
29
30

Example 2: Hierarchical representation using is a vocabulary

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

is part of is part of is part of


Football Basket ball Tennis

Computer- plays plays ESUT Dodgers


Science-Club UNN Team ESUT Team

Team Team

Answer: They are all part of NUGA Games

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

Fig 5.3: Semantic Tree

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

Decision Alternative State of Nature (Outcomes)


Low Demand (LD) Medium Demand (MD) High Demand (HD)
Manufacture -N20,000 N40,000 N100,000
Purchase N10,000 N45,000 N70,000

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

EPM= Expected Payoff for Manufacture


EPP= Expected Payoff for Purchase
EP= Expected Payoff

EPM (node 2) = (0.35x-20,000) + (0.35x40,000) + (0.3x100,000) = N37,000


EPP (node 3) = (0.35x 10,000) + (0.35x45,000) + (0.3x70,000) = N40,250

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.

EP (node 1) =max{EPM(node 2), EPP(node 2)}


= max{N37,000, N40,250}
= N40,250

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

Decision Alternative State of Nature (Outcomes)


Low patronage (LP) High patronage (HP)
In-house N200,000 N400,000
From Vendors N100,000 N450,000
Open Source N200,000 N750,000

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

Hint: Take the state-of-nature probabilities as P(LP) = 0.45, P(HP= 0.55)


Solution: Step 1: We start with the decision node and show the order of decision

33
34

LD N200,000
2
In-house MD N400,000

1 3

From vendors LD N100,000


MD4 N450,000

Open Source LP N200,000


HP N750,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

EPI= Expected Payoff for In-house


EPV= Expected Payoff for vendors
EPO= Expected Payoff for Open Source
EP= Expected Payoff

EPI (node 2) = (0.45x-200,000) + (0.55x400,000) = N310,000


EPV (node 3) = (0.45x 100,000) + (0.55x450,000) = N292,500
EPO (node 4) = (0.45x 2000,000) + (0.55x750,000) = N502,500

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

EP (node 1) =max{EPI(node 2), EPV(node 3), EPP(node 4}


= max{N310,000, N292,000, N655,000}
= N655,000

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

If the market is not favourable, she expects to loose


N30,000 from a large facility or
N20,000 from a small facility
Note: She may decide not to pursue her business idea
She estimates the probability of a successful market of 60%
Use a decision tree to give a recommendation to Mrs Asogwa

Using Decision tree to solve classification Problem

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

Fig. 5.4: Decision tree for classification of vertebrates

Chapter 6: Expert Systems Languages, Shells and Tools


There are several approaches to building expert systems in terms of the kind of tools to use. The tools fall into
two main classes: languages and environment or shells; but some tools may fall between the two classes.
Languages Used in Expert Systems Development
There are essentially two types of programming languages for the development of expert systems. These are:
algorithmic languages and symbolic languages. Algorithmic languages include, Pascal, C, PHP and other
older programming languages. They are commonly referred to as procedural languages. But implementing
logical inferences using these languages is difficult. As a result, specialized languages are used instead. Such
languages are called symbolic languages. Popular symbolic languages commonly used in developing expert
systems are LISP and PROLOG. The use of languages in the development of expert systems simplifies the
coding process. The major advantage of these languages as compared to conventional programming languages
is the simplicity of the addition, removal and substitution of new rules and memory management capabilities.
LISP
LISP is short for LISt processor. LISP supports symbolic manipulation. It executes interactive programming
using trial and error style. It has a set of primitive operators for carrying out deduction reasoning with
sentences containing words which represents predicates and their arguments. This helps in implementing
logical inferences. This feature is a major advantage it has over other procedural languages.
The major characteristic of LISP according to Janakiraman (2005) is that all its basic elements are treated as
symbols irrespective of whether they are numeric or alphanumeric. The basic data element of LISP is an
atom, a single word or number that stands for object or value. An atom has a very special property. It is
indivisible. LISP provides two basic types of atoms: numbers and symbols. Number stores numeric
values. Numeric values can be positive or negative integers or floats. Symbol represents alphanumeric
characters which represents alphabets and numbers. LISP provides arithmetic, Boolean and list manipulation
primitive functions. It also provides a facility of dynamic memory management by which memory can be
reclaimed.

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.

Criteria for Selecting Expert System Tool


The following criteria will help us to select the right kind of tool for design and development of expert system.
- Type of knowledge representation
- Inference and control

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

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.

Expert System Specification

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.

Functions of Evaluation of Expert systems

(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

Common questions

Powered by AI

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.

You might also like