Expert System Design
Expert System Design
6.1 INTRODUCTION
In the previous chapters, we have discussed the general concepts and theory of
expert systems and other intelligent decision making-systems. A number of papers
have attempted to summarize the properties of intelligent systems. There are many
pros and cons for each type (Begley 03). This chapter presents general guidelines
for building practical expert systems designed for real-world applications, not re-
search prototypes. A software engineering methodology is described so that an
expert system can be a quality product developed in a cost-effective and timely
manner.
Many books, papers, and software tools have been devoted to the design of
expert systems, covering all aspects in great detail. So this one chapter will not
make you an instant expert. (You'll have to read the chapter first). However by
understanding the principles that explain why expert systems are designed the
way they are, you'll be better able to take advantage of sophisticated tools and
methodologies. In fact the design of expert systems is part of a more general
field called Knowledge Management (KM) which deals with al the knowledge
assets available to an organization (Becerra-Fernandez 03).
KM is connected to the Information Management (IM) which is connected
to the Information Processing (IP) which is connected to the Information Sys
tems (IS) which is connected to the Information Techuology (IT). (On second
thought, if you can say KM, IM, IP, IT, three times in a row without mispro-
nouncing, you are an Instant Expert!) KM is a major problem considering all
the different types of resources for many different types of audiences such as of-
fice, web, FAQs, Help Desk (human and automated), email, fax, phone, product,
program, developer, manager, end-user, and publicity.
Large companies have their own very detailed methods, documents, books,
and software
they developed to create, manage, maintain, and sell knowledge
assets because it is such a profitable field (Conway 02). This is especially true
353
of Expert Systems
354 Chapter 6: Design
PROBLEM
6.2 SELECTING THE APPROPRIATE
and resources by which you can build a knowlede. -based
There are many ways
There are even móre ways you can waste time and.
your d money
expert system.
or
to the Starving Authors and Copyeditors Fund af
(for example, donating for
Wisdom states that hefo.
the Fourth Law of before
profit organization). However,
should know your destination.
you set out on a journey, you
Before you build an expert system, you should select an appropriate Droh
software project, there are a number
lem, discussed in Section 1.6. Like any
as
of general considerations that should be made before a large commitment of
pert will also guarantee trouble. Even the President only sees one
a
ulole
time, so it's not a matter of cost. Trying to model the expertise or l
6.2 Selecting the Appropriate Problem 355
Management Tasks
co 6.1 Project
Project Management
Activity Management
Product Configuration
Resource Management
Management
Analysis Forecast
Scheduling Acquire Resource
Resourcees
Needs
Chronicling Product Change
Planning
Management Management Minimize Assigning
Resource Resource
Bottlenecks Responsibilities
experts in one system is a bad idea. However, modeling the expertise of multiple
experts in multiple systems using a blackboard architecture to reach at léast a
majority opinion is good. This does bring up what the fuzzy term good means.
If nine out of ten doctors say the patient will die, the
patient will inevitably
choose the doctor that offers a treatment for life (unless the patient is really
cheap and the treatment costs money). Trying to decide how to rank multiple ex-
pert opinions is a daunting task, usually more formidable than building a single
expert system for a single expert. So we'll stick with the single-system-single-
expert approach in this chapter and leave the multiple-experts-multiple-systems
as a class project.
Payoff
What is the payoff?
This question is related to the first question. However, this question is more
pragmatic by asking for a specific return on investment of people, resources.
time, and money. The payoff may be in money, increased efticiency, or any of
the other advantages of expert systems described in Chapter 1. It is also impor-
tant to remember that if no one uses the system, there will be no payoff. Because
expert systems is different from conventional programming it is more ditticult
to answer this question.
Tools
What tools are available to build the system?
There are many expert systems tools available today with advantages and disad-
vantages as discussed in Appendix G. However, this should be taken only as a
guide since software tools develop so rapidly. Generally, you can count onan
enhancement every couple years in each t0ol and a major revision every five
356 Chapter 6: Design of Expert Systems
We know
m
collection agency, phone calls ("ArC home
hon
you're home because
at y
email, bad credit, low you're not at work"), huge increzasc pam
credit,
due, taxes plus interest on no
credit, "we can finance taxes
company. sufrer"E
6.2 Selecting the Appropriate Problem 357
Semantic lists are often associated with other signs. The field of semiotics
studies signs and their meanings. An example that is familiar to everyone is
learning your "A, B, Cs as a child. You should still remember the melody that
ooes along with children singing the "A, B, Cs" because there is a semiotic rela-
fionship between the song, i.e., lyrics and music. Semiotic relationships are used
all the tinme by advertisers in famous TV jingles. Some jingle creators are so
good at this art that you can't get a jingle out of your head for days; it just keeps
repeating over and Over in a loop.
When you are mterviewing an expert, it's essential to also create a written
transcript of the interview. By reading the transcript you can spot the semantic
relationships between terms. That is what is important. Knowledge terms are not
isolated words; they fom semantic clusters that link to form the entire semantic
net of knowledge in the expert's mind. The mind is a good example of an asso-
ciative semiotic menmory in which one word, smell, touch, sight, or sound may
elicit all kinds of other memories.
The classic tool for eliciting knowledge the standard interview and much
work has been done on this (Novak 98). In fact the interview technique is usu-
ally augmented by drawing diagrams to make sure the concepts and relation-
ships. Visual metaphors are useful because the developers and experts can both
see the relationships and meanings at the same time and agree on what is to be
represented and how. Software tools are also available that can represent the en-
tire ontology. Recall from Chapter 1 that an ontology is the complete descrip-
tion of a domain represented in a formal way.
One tool which has been used very successfully is Protégé, an ontology edi-
tor and knowledge-base editor. This is a very sophisticated tool is available free
from Stanford University and well-supported on their website with tutorials on cre-
ating your first ontology and many other topics. Protégé is used with TixClips,
an
essential when
integrated development environment for CLIPS. Ontologies are
building very large systems having thousands of rules.
Cost
How much will it cost?
This is like asking how much a divorce will cost. It's not the up-tront costs that
you can see in email spam for do-it-yourself-divorce or do-your-own-brain-sur-
and up. The cost of
gery kits. It's the costs that come later which keep adding up
and time devoted to
building an expert system depends on the people, resources,
ts construction. Also, just like any other piece of software or hardware, you
have to figure in the cost of maintenance. This brings us to
the First Law of
of gas, it's a
Wisdom: If you've bought a car and are not worried about the cost
Zero Law of Wisdom: It's better
g00d idea to own your own oil well. And the
to use someone else's car and gas. Maitenance of an expert system is also much
Project Management
Standard project management techniques and software tools are expected to pro-
vide the following.
Activity Management
planning
- define activities
change management
manage change proposals and impact evaluations
assign personnel to make changes
install new product versions
Resoure Management
forecast needs for resources
acquire resources
identify expert or knowledge base
arrange your schedule for convenience of expert
assign responsibilities for optimum use of resources
provide critical resources to minimize bottlenecks
In particular, note that in the acquisition of resourees, the point is made that you
should adjust your schedule to that of the expert and not vice versa. Unless you
are paying the expert full-time, there will be other duties and their time is very
valuable.
Figure 6.2 shows the ideal high-level view of the activities required to pro-
duce a system in terms of the stages that a system goes through.
to show
Paper or comparison study
Feasibility Study project is feasible
In the ideal view, the product is not deployed for end users until all the H
are worked out. In the case of military products, this is a really good idea since bugs
it S not that easy to recall a nuclear missile once it's been launched.
In contrast to government contracts, things are ditterent in the commercial
World since there are no guaranteed contracts that pay money on a regular basic
and cost overruns if the project is latc. The commercial paradigm followed to
for the product every quarter until i
day is to spenda lot of money on publicity
1s released several years later. This has two purposes. First, private develonera
pers
who want to use your product in their products are willing to pay money for
pre
release versions even with known bugs. So this provides a continuing source of
revenue as the product is being developed instead of your company having to
for several years. A secondary benefit is that vou
fund all the development costs
don't need to do much (if any) in-house testing.
crashes, it asks the user if it
Simply make sure that every time the product
clicks OK, the message will he
can send an automatic bug report. When the user
with
sent information as to where the fault occurred
diagnostic
automatically
will store the bug report in a
An automated email program at your company
database. Standard data mining tools will then look for patterns to notify your
for a particular aspect of the product. Dif.
particular developer team responsible
levels will be set up so that only when the number of bugs has ex-
ferent trigger
notification be sent to the teams. Some
will
ceeds their particular trigger level a
introduced with Pascal in the 1970s so that it could run on any microcomputer.
This same approach was used by Java.
Although CLIPS does not generate bytecodes, it is designed to produce a
standardC version of the finished expert system. This can then be compiled us
ing a standard C compiler for the specific hardware platform and the executable
deployed for that particular platform. No "CLIPS Virtual Machine" is required.
One of the original design goals of CLIPS was to produce an expert system
tnat
could easily be deployed on any new hardware that may arise. If this is not ade-
quate, other versions of CLIPS such as Jess have been developed as mentioned
in the Preface. Jess is written in Java and althougth it does not support multiple
inheritance, it has all of the advantages of Java in being easily deployed to dif-
ferent hardware.
In many cases the expert system must be integrated with other existing pro-
grams. Consideration should be given to the communication and coordination
of the expert system input/output with these programs. It may also be desirable
to call the expert system as a procedure from a conventional programming lan-
guage, and the system should support this. CLIPS is designed so that it can be
called from a host language such as a C++ program, do its function, and then
return control to the host program. Such a hybrid system was also one of the
main design considerations of CLIPS since the performance of an expert systemn
can decrease quickly depending on how many rules are in the system and how
much pattern matching must be done. While the Rete Algorithm is good, an ex-
pert system is still not as fast as compiled code.
Although you could use CLIPS to simulate a calculator, spreadsheet, or even
a word processor, its performance would be not as good as a program writen in
a third generation language such as C, C++, or C#. For example, you could
create an intelligent data mining tool by calling CLIPS from a standard database
such as Oracle or MySql and return recommendations to the database user. In
is designed to let other applications use data and then return
Oracle, the cursor
control to Oracle. CLIPS follows this same principle of being a good host ora
good guest. Another alternative is to use/modify the CLIPS source code and in-
tegrate it into your application, then compile the result into a new application
for deployment.
Expert's Errors. The expert is the expertise source of the expert systenl
expert's knowledge is erroneous, the results may be propagated througn t
ire development process. As mentioned in Chapter 1, a side benetit of b u s
ex
an expert system is the potential detection of erroneous knowledge when tne not
pert's knowledge is made explicit. Just because someone is an expert u
mean they will never make a mistake. It is just that they are far less nA
ertorm
Errors in the
Expert expert's knowledge, such as incorrect and
incomplete knowledge
Vs
6.5 SOFTWARE ENGINEERING AND EXPERT SYSTEMS
In the previous sections we have discussed the
general considerations in using
the expert systems paradigm. Now let's examine the stages of expert systems de-
velopment from the more technical perspective of the knowledge engineer who
actually builds the system.
Since expert systems have moved out of the research stage, there is a real
need to deliver quality software up to the standards of conventional software.
The accepted methodology for developing quality software for commercial, in-
dustrial, and governmental standards is software engineering.
It is important to follow good standards in the development ofa product or
the product will probably not be of good quality. Expert systems are products
just as any other software product such as a word processor, payroll program, or
computer game.
However, there is a significant difference of mission between expert systems
and typical consumer products such as word processors and video games. The term
mission refers to the overall purpose of a project or a technology. Expert systems
technology generally has a serious mission of supplying expertise in high-
performance and possibly hazardous situations where human life and property
are at stake. These are the mission-critical applications mentioned in the previ-
ous section. Knowledge-based systems do not have to meet such high standards.
Mission-critical applications are very different from the more relaxed mis-
sion of word processors and video games, which are developed to increase effi-
ciency and provide recreation. Human life is not jeopardized by a bug in a word
processor or a video game (or at least it shouldn't).
Expert systems are high-performance systems that must be of high quality
or they will be prone to bugs. Software engineering provides methodologies for
building quality software, as illustrated in Figure 6.4
Quality is a difficult term to describe in a general sense because it means dif-
ferent things to different people. One way of defining quality is as the required
or desirable attributes of an object determined on some scale. The term object is
used here to mean any software or hardware, such as a software product. The at-
tributes and their values are calléd metrics because they are used as measures of
an object. For example, the measured reliability of a disk drive is a metric of its
quality. One measure of this attribute is the mean time between failures
(MTBF) of the drive. A reliable drive might have an MTBF of 50,000 hours of
use between crashes, while a cheap drive might have a MTBF of 10,000 hours.
In the 20th century, people might use their computers a few hours at work or at
home. Now it's customary to leave the computer on 24x7x52 and the hours do
368 Chapter 6: Design of Expert Systems
Methodology
Engineering
Figure 6.4 The Software
PROBLEMS
SOFTWARE ENGINEERING
Software
Plans. Schedules Life
Documentation Requirements, Reports
Cycle
and Design
PRODUCT
add up. Of course you can set your operating system to power down the drve
justlike the monitor screen. However these on and off a dozen times a
turning
day may introduce new risks.
What's important is not just the time, but the error rate in writing. Suppose
disk drive has a quoted error of one bit in every billion writes. In the 1990swnen
common disk drives were 20 Megabytes, that meant you could fill yourdnve
Limes over without a single write error. Now with drives in the 200 Gigaoyi
range, one write error in a billion means there may be 200 errors on your ha
drive, assuming the same error rate.
If
the error occurs in writing a compressed image such as a jpg it willpe
ably not be noticed. But if thie error occurs in a line of code, a sins
terror
could turn a program statement like X=A to X=8, with potentially very Daudisk
sults. Modern drives have a built-in sensor that ntinuously monitors
lech-
health through feature called Self-Monitoring, Analysis, and Reporting
a
as Norton prognive
System Uilities when the Disk Doctor Utility is run. Tn can
Maintenance Costs
For successful conventional software that keeps getting modified and enhanced
every few years, maintenance can easily be ten times the initial development
costs when the product was first released and grows with every new version.
Even though this may seem a lot, as mentioned earlier there's a lot of money to
be made in maintenance. However the Minus Three Law of Wisdom states: If
you don't love to journey, then love what you've got. So if you keep coming out
with bug fixes of your product, don't change the name to something entirely
new. Stick with a variation of the old name, but don't say "Doors BugYix
No.10," say "Duors 2010."
on
Expert systems tend to be more knowledge based these days than based
human expertise. There are significant exceptions such as intelligent trainers tor
special personnel such as doctors or pilots. Expert systems are used very suc
cessfully as training systems to reduce the amount of time experts spend teaei
ing introductory material. However if enough time and resources are devo
the expert system, it can teach a student to be ready for the real thing
As technology changes, there is less demand to preserve a retiring pe bused
knowledge. Expert systems require more maintenance because they do a
on much knowledge that is heuristic and experiential. Expert systens i e
lot of inference under uncertainty are even more susceptible to n g mam
itg
e
the systems. However the systems also tend to become larger, just IKC
ware, so it's always a running battle.
Waterfall Model
ventional
A number of different life cycle models have been developed for co And is
software. The classic waterfall model was the original life cycle mo
illustrated in Figure 6.5.
6.6 The Expert System Life Cycle 371
System
Feasibility
Validation
Software Plans
and Require-
ments
Validation
Product
Design
Verification
Detailed
Design
Verification
Code
Unit Test
Integration
Product
Verification
Implementation
System Test
Operations and
Maintenance
Revalidation
Incremental Model
The ineremental waterfall model is a refinement of the waterfall and ot
Standard top-down approach. The basic idea of ineremental development istto
develop software in increments of functional capability. The incrementa The model
oiral
Figure 6.6 A Spire Model of Expert System Development
Delivered System
Time
Spiral Model
One way of visualizing the incremental model is an adaptation of the Barry
Boem's standard spiral model for software engineering, as shown in Figure 6.6.
Each circuit of the spiral adds some functional capability to the system. The
ending point label "Delivered System" is actually not the end of the spiral. In-
stead, a new spiral begins with maintenance and evolution of the system. The
spiral can be further refined to specify more precisely the general stages of
Knowledge Acquisition, Coding, Evaluation, and Planning.
Figure 6.7 The Linear Model of Expert System Development Life Cycle
the development of the system to some point at which its functional capabili
ties will be evaluated. After this, the life cycle repeats this same sequence from
Planning to System Evaluation until the system is delivered for routine use.
The life cycle is then used for subsequent maintenance and evolution of the
system. Although not explicitly shown, verification and validation proceed in
parallel with the stages. Rather than just fixing up some bugs, it is important
1o follow through with the same sequence of stages to maintain the quality ot
the expert system. Skipping stages, even to fix one little bug, impairs the en
tire quality.
This life cycle shown may be considered one circuit of the spiral model.
Each stage consists of tasks. Not all tasks may be necessary for a stage, espe
cially once the system goes into maintenance and evolution. Instead, the tasks
are meant o serve as a composite of all tasks for the entire lite eycle, trom in
tial concept to software retirement. The tasks will also depend on the exact
of application being built and so should be considered only as a guide, ran
be
than absolute requirements that must be performed for each stage o
completed.
This life cyclemodel will be discussed in detail to illustrate the manyfac
I re
should be considered for a large quality
tors
that expert system. Forsma "even
search-type prototypes that are not intended for general use, not all tasks or c
stages are necessary. However, it is amazing how much software that is de
oped for personal or research use gets released to associates and then ntogen
eral use.
Planning
the
ex
The purpose of the Planning Stage is to produce a formal work plan
to ed used
pert system development. The work plan is a set of documents that wil
to guide and evaluate development. Table 6.2 illustrates the tasks in thisstage
>
6.7 A Detailed Life Cycle Model 375
Task Objective
Feasibility assessment
Determine if it is
worthwhile
whether expert
to build the system and if so.
Resource management Assess systems technology should be used.
resources of
ware
people, time. money. software, and hard-
required. Acquire and manage the
Task phasing Specify tasks and their order in the required resources.
the
Schedules Specify the stages.
Preliminary functional layout starting and delivery dates of
Define what the tasks in the stages.
system should accomplish by
of the system. This taskspecifying the
the
high-level functions
purpose of the system. specifies
High-level requirements Describe in high-level terms how the
functions of the system
will be accomplished.
availability.
Prioritized list of knowledge sources in order of importance
Source importance
to development.
List of knowledge sources ranked in order of availability.
Source availability
The Web, books and other documents are generally much
human experts.
more available than
Source selection Select the knowledge sources based on importance and
availability.
376 Chapter 6: Design of Expert Systems
tasks are described in1Ta
Table 6.4,
and extraction
Acquisition, analysis,
Extraction Tasks
Acquisition, Analysis, and
Table 6.4 Knowledge
Objective
Task
Specifyhow knowledge will be acquired by
Acquisition strategy for interviewing experts, reading document ethods
rule
induction, repertory grids, and so forth,
Knowledge element identification Pick out the specific knowledge from sources
will be useful in this iteration ofthe life cycle
Classify and organize the knowledge to aid in know.
Knowledge classification system edge verification and understanding by developers
Use hierarchical groups whenever possible.
naly
The main objective of the knowledge acquisition task, the knowledge
sis task, and the knowledge extraction task is to produce and verity tne
ined,
edge required by the system. By the time that the knowledge is baseil
should be correct and suitable for the next stage of knowledge design. l
tion to thecustomary method of interviewing experts, many software
s are may
pro
pro
be used to perform automated knowledge acquisition. Often these neer t
vided by the tool vendor.
Knowledge acquisition by a knowledge enginee
ing to elicit knowledge from an expert requires a great deal of skill au is dis
1 is dis-
cussed further in
(Grzymala-Busse 91).
Knowledge Design
design
The objective of the knowledge design stage is to tailed
Task Objective
Knowledge representation Specify how knowledge will be represented, such as rules,
frames, or logic. Dependent upon what the
tool will support. expert systems
Detailed control structure
Specify three general control structures: (1) if the system is
embedded in procedural code, how it will be called; (2)
control of related
groups of rules within an executing sys-
tem: (3) metalevel control structures for rules.
Internal fact structure Specify the internal structure of facts in a consistent manner
to aid in
Preliminary user interface
understanding and good style.
Specify a preliminary user interface. Get feedback from
users about the interface.
Initial test plan Specify how code will be tested. Define test data, test driv-
ers, and how test results will be analyzed.
The internal fact structures described in Table 6.5 are discussed in much more
detail in the chapters on CLIPS. The basic idea of specifying fact structures is to
adapt good style. For example, a fact such as "10" is not very meaningful by it-
self. What does the "10" represent? If additional information is included with the
fact such as "price 10" or, better still, "gold price 10:" then the gold price is mean-
ingful. Notice that this form of the fact is in conventional object-attribute-value
form and so is convenient for people to read and understand. CLIPS supports this
throughthe deftemplate construct for rules, and also objects.
In some expert systems languages the fields may have strong typing so that
not al-
onlycertain values are allowed. If a rule tries to specify a value that is
detailed design stage of
lowed, the inference engine flags this as an error. The
knowledge is shown in Table 6.6. document
The product of the detailed design stage is the baselined design
document undergoes a
from which coding can proceed. The baselined design
check before coding begins.
knowledge system design review as a final
Task Objective
in the
Specify how knowledge is logically organized
Design structure what is in the knowledge base.
knowledge base and
how the system is to be implemented.
Implementation strategy Specify user interface after receiving user
Detailed user interface Specify the detailed user interface design.
feedback from the preliminary
Document the design.
Design specifications and report the code will be tested and verified.
Detailed test plan Specify exactly how
Systems
378 Chapter 6: Design of Expert
Checkout Tasks
Table 6.7 Code and
Objective
Task
Implement coding.
Coding test data, test drivers, and test analysis
Test code using
Tests procedures.
documented source code.
Produce commented,
Source listings manual so experts and users
Produce working user's
can
User manual feedback on system.
provide
Document installation/operation
of system for users.
Installation/operations guide overall expert system functionality, limita-
System description document Document
tions, and problemns.
Knowledge Verification
of determining the cor
The knowledge verification stage has the objective
of the system. This stage is divided into
rectness, completeness, and consistency
two main tasks:
Formal tests
Test analysis
Table 6.8 describes the formal test task of the knowledge verification stagc
Task Objective
Test procedures Implement formal test procedures.
Test reports Document test results.
looksfor
The test analysis tasks are shown in Table 6.9. The test analysiS T
the following major problems:
incorrect answers
incomplete answers
inconsistent answers
6.8 Summary 379
Tasks
Table 6.9 Test Analysis
Task Objective
Results evaluations Analyze test results.
Recommendations Document recommendations and conclusions of tests.
System Evaluation
As described in Table 6.10, the final stage in the development life cycle is the
evaluation stage. The purpose of this stage is to summarize what has
system
been learned with recommendations for improvements and corrections.
Task Objective
Results evaluation Summarize the results of testing and verification.
Recommend any changes to the system.
Recommendations
Validate that the system is correct with respect to
user
Validation
needs and requirements.
If
Interim or final report If the system is complete, then issue final report. not,
issue an interim report. Ask for more money.
6.8 SUMMARY
construction
discussed a software engineering approach to the
In this chapter we interview with
of expert systems. Principles
were given about conducting good for
a
are widely used solving
an expert. Now that expert
systems technology
quality be products, especially since
real-world problems, expert
systems muSt
and by credit bureaus.
So many are used in
defense systems