7 Expert Systems
Expert systems are computer based systems used to solve problems such as providing a
diagnosis of something
They make use of the knowledge of a number of human experts within a specific field to
help create a knowledge base
They use reasoning to produce possible solutions
Data referred to as database of facts is stored within the computer and represents the
knowledge part of a knowledge base
The system uses a set of rules which represents the reasoning
7.1 Components of expert systems
The shell consists of the explanation system, inference engine, knowledge base editor
and user interface
The knowledge base consists of database of facts and rules base
User Interface
User interface is how the computer interacts with the user and the user with the expert
system
It displays questions, opinions, results and information on a screen
It enables the user to type in answers to the questions and data
It usually consists of a keyboard and mouse together with a monitor
Validation checks are carried out to ensure the minimum number of invalid responses
are entered by the user
Inference Engine
It performs the reasoning of an expert system
It uses a series of IF…THEN statements within the rules base and interrogates the
database of facts in the knowledge base
It uses inputs from the user to try and match them with the contents of the database of
facts
It processes the rules to try and reach possible solutions
Can also generate questions via the user interface based on the inputs it has received so
that is can use the answers to narrow down the number of possible solutions
The method used by inference engine involves the use of forward chaining, backward
chaining or a combination of both
Knowledge Base (as a database of facts and rules base)
The knowledge base consists of database of facts and rules base
The database of facts is built up by the engineer on information and knowledge of the
subject specialists (experts), it may also be built up from existing databases for the topic
Rules base is a set of rules which are usually in the form IF…THEN
Explanation System
It explains the logical reasoning that the expert system has used to come to its
conclusions to the user
It also explains why a specific fact was needed or not and justify its recommendation for
the reasoning
Knowledge Base Editor
It is a software that allows the knowledge engineer to edit the rules and facts within the
knowledge base to bring them up to date
Explain the role of the knowledge engineer:
The knowledge engineer is responsible for maintaining the system
The knowledge engineer edits and adds the facts in the knowledge base
The knowledge engineer edits and adds the rules in the rules base part if the knowledge
base
The knowledge engineer deletes unused rules from the rules base
Describe how the knowledge base is used to interact with the other
components when an expert system is used to solve a problem:
Knowledge base consists of a database of facts and a rules base
Inference engine uses the rules base to reason through the symptoms
Inference engine uses the data or facts in the knowledge base to reason through the
symptoms
Inference engine compares the symptoms to those in the knowledge base
Inference engine uses the rules base of IF…THEN rules
Knowledge base editor enable the knowledge engineer to edit rules and facts within the
knowledge base
7.2 Different scenarios where expert systems are used
Mineral Prospecting
Expert systems are used to help in making decision on where to drill for a specific
mineral
The geologist enters data about the types of rocks and geological structure as well as
the minerals to be found at the site under consideration
The expert systems knowledge base will store models of successful drilling sites and
their associated minerals together with a rule base
The inference engine then compares this data with the models in the knowledge base
using the IF…THEN rules in the rules base
The system may ask the geologist further questions through the user interface
The resulting percentage probabilities of finding the mineral at this site are produced
It will as well as produce a conclusion about the existence of a particular ore deposit,
providing explanation regarding their conclusion
Investment Analysis
The user interface will ask questions about the investor to the financial investor such as
the amount the client wishes to invest, level of risk investor is willing to take, desired
rate of return, duration the investor is willing to make the investment for.
Depending on the answers to the questions, the system may ask further questions
through the user interface
The database of facts will consist of all the information the bank has gathered over the
years about the performance and stability of different companies
The rules in the rules base will be created by an expert investor
The expert system will allow the financial advisor to add rules to the rules base as they
see fit based on their experience dealing with the investor
The inferences engine will then produce recommendations for purchasing stocks or
share in a company together with the reasons for recommending these particular stocks
and share.
The financial advisor will make the final decision based on the expert system’s
recommendation
Financial Planning
Expert systems involve the client completing a detailed questionnaire regarding their
personal and economic situation, including income, taxes paid or due, investments,
employee benefits, marital status, number of dependents as well as any obligations
such as retirement plans or children’s university education
The results of the questionnaire are entered using the user interface.
The inference engine analyses this information using the database of facts and a very
large number of rules in the system
The database uses the results of books and articles which have been published to
personal financial planning as well as information gathered from interviews with experts
like professional financial advisors
A report would then be produced by the financial advisor as to the clients
recommended financial plans
The repot would be based on a combination of a human expert’s insights and the use of
the results of the expert system
The report would serve as financial action checklist for the client in order to achieve
their financial plans
Insurance Planning
Details of the individual would be entered into the user interface such as the applicant’s
age, gender, whether they smoke and general health
The user interface will ask questions of user to the consultant
The inference engine will compare the responses with the facts in the knowledge base
using the IF…THEN rules
The inference engine will produce a recommendation for how much the applicant will
pay each month for their policy or recommend whether the application is rejected
It may inform them of the details of the policy
The recommendation is output through the user interface
The consultant will use the expert system’s recommendation to make a final decision
Car Engine Fault Diagnosis
questions regarding the problems with car are asked and the mechanic types in the
symptoms using the user interface
the expert system would supply a list of possible causes of the problem and the
mechanic would decide which of the suggestions are most likely
the expert systems inform the mechanic of a range of readings from sensors
these readings are also used by an inference engine after comparison with those in the
knowledge base to produce a list of possible faults
the mechanic makes the final decision based on the expert systems conclusions
Medical Diagnosis
the creation of a medical diagnosis expert system starts with the production of the shell
followed by the knowledge base
the knowledge base is created by the knowledge engineer who interviews a number of
expert doctors and then shapes the knowledge into a form that can be easily accessed
by the system
the components of an expert system are used to produce a list of possible diagnoses
the user interface allows the patient or doctor to enter symptoms and at the end of the
process, displays the output
the knowledge base provides the database of existing illnesses as well as the rules from
the rules base often IF…THEN rules
the IF part is the symptoms part and the THEN part is the illness or disease that is
suggested
the inference engine searches the knowledge base for similar symptoms to those
entered by comparing those typed in with those in the knowledge base
this is the reasoning part of the system
the knowledge base editor allows for the knowledge base to be increased by adding
further rules and data
the explanation system clarifies how the expert has produced its possible diagnoses
Route Scheduling for Delivery Vehicles
An expert system would store the locations of each distribution point, the type of
vehicle being used and the working hours
The scheduler would type in the destinations and quantity of the parcels for the day
The expert system would match those against the locations and the available types of
vehicles
The expert system would suggest how many drivers would be needed and the kind of
vehicle for each driver
The expert system suggest the allocation of orders to each vehicle and suggest a list of
goods in reverse order so that each vehicle had the first order loaded on to the vehicle
last
The system would take account of the fuel, time, traffic and road conditions then output
the most efficient route
Plant and Animal Identification
The inference would use a series of IF…THEN rules
Plants are divided into woody or herbaceous
If they are woody, the system through the user interface could ask another question
such as whether they have a single trunk which would lead in turn to other questions
based on the shape/type of leaf and so on
The possibilities would be output through the user interface
The database of facts, which would be interrogated by the inference engine would
include the data regarding all knowledge about as many species as possible
This type of system would ask questions rather than inviting the expert to type in details
about the plant
Animal classification or identification follows a similar pattern
7.3 Chaining
When an inference engine interrogates the knowledge base, it imitates the way human
would use reasoning
It uses what is known as chaining
The reasoning that the inference engine uses consists of backward or forward chaining
or a combination of both
Backward Chaining
Backward chaining starts with a list of goals or hypothesis and tries to find support for
their hypothesis
It works backwards from the goal
An inference engine would search the inference rules until it find on which has a THEN
part that matches the goal or hypothesis
If the IF part of that rule is known to be true, then it is added to the list of goals
Because the list of goals determines which rules are selected used, this method is called
as goal-driven
Forward Chaining
Forward chaining starts with the available the data and uses inference rules to extract
more data until a goal is reached
An inference engine using forward chaining searches the inference rules until it finds on
where the IF statement is known to be true
When such a rule is found, the inference engine uses the ‘THEN’ part to cause the
addition of new facts
The inference engine will repeat this process until a goal is reached
The data entered determines which rules are selected and used and so this method is
called data-driven
Compare the Use of Forward and Backward Chaining [6 marks]:
Both are method used by an inference engine
Both use a rule base to attempt to solve problems
Both involve the output of one rule activating another rule
Forward chaining is bottom up reasoning/backward chaining is top-down reasoning
Forward chaining starts with a set of known facts and applies rules to generate new
facts
Forward chaining continues until it reaches a predetermined goal
Forward chaining checks the facts against a predetermined goal
Forward chaining is data driven rather than goal driven
With forward changing data determines which rules are used in a rules base
With backward chaining goals determine which rules are used in a rules base
Backward chaining starts with a goal or hypothesis and looks for rules to support the
hypothesis
Backward chaining can either support or reject an hypothesis
7.4 Applications of forward and backward chaining
Forward chaining are commonly use to solve more open ended problems of a design or
planning nature such as establishing the configuration of a computer system
Backward chaining is used if there are very few possible goals or conclusions and well
defined
Diagnoses
A rule base is a set of rules which an inference engine uses
The inference engine finds possible diagnoses by using a form of reasoning
The inference engine uses the data or facts in the knowledge base to reason through the
symptoms
The reasoning involves forward chaining, backward chaining or a combination of both
User interface asks questions about the illness and the answer and data would be
entered by the doctor or patient
Inference engine compares symptoms to those in the knowledge base
Inference engine uses the rules base of IF…THEN rules/comparison
Knowledge base editor enables the knowledge engineer to edit rules and ad facts within
the knowledge base
Description of forward chaining: (Searches through inference rules to find one where the
IF statement is known to be true. If answer not found, further questions are asked. When
such a rule is found, the inference engine uses the ‘THEN’ part to find the illness)
Description of backward chaining
The system produces a probabilities of diagnoses/possible diagnosis
Explanation system produces reasons for suggestions which are output using the user
interface
The doctor chooses the most appropriate diagnosis and use it or reject all
Gaming
NPC Games (forward chaining)
When setting up the system the knowledge engineer would have gathered from the
game expert known facts such as individual weapon characteristics and their range as
well as which weapon is best for achieving the goal of eliminating the target
The input variable may be the distance to the target, the type of weapon and the range
of the weapon
The system will need to output the type of weapon, why it was chosen as well as the
characteristics of the weapon
As the contents of the frame are constantly chaining, the NPC will constantly have to re-
evaluate the situation much like a human player
Creation of an expert system will improve game play and provide a challenge with the
NPC making its own decision of weapon selection
The inference engine uses forward chaining
This method uses the data or facts which are input to the system and uses rules to
determine a goal
Using the forward chaining method, a series of IF statements are executed that sort
through the data to THEN find a goal
The goal in this case is an appropriate weapon
These IF questions could be based on whether the target is a missile of some sort or
another player
The THEN part will be the recommended type of weapon
Chess (backward chaining)
In chess there are a fixed number of moves to reach a winning position
To computer all the possible ways of reaching a winning position, the system chains
backwards and builds up a list of possible ways together to the winning position
Backward chaining involves using all the possible premises which lead to getting a
‘checkmate’ conclusion
Backward chaining is used in gaming that have fewer rules
Artificial Intelligence
Artificial intelligence (AI) can be thought of as a piece of software that simulates or
mimics the behavior and judgment of a human being.
It involves the system being able to learn reason and assess its own actions.
In AI, forward chaining can be used to solve logic problems using rules and previous
learning to find solutions to problems.
An AI might use forward chaining to look at the available information, answer a question
or solve a problem.
Forward chaining works through the logic of a problem from beginning to end.
There are countless applications of AI: in the healthcare industry for dosing drugs (calculating
the dose of drugs to be given to a patient) and suggesting different treatment for patients; in
surgical procedures in operating theatres in hospitals; in computers that play chess and in self-
driving cars. Each of these machines must be able to consider each action it takes, as each
action will have an impact on the end result. In chess, its goal is to get its opponent in
checkmate; in self-driving cars, its goal is to get from A to B without crashing. AI can also be
used in the financial sector, where it can alert fraud departments to unusual spending patterns
on a bank card or large amounts of money being deposited in bank accounts.
Another example of AI is in the field of robotics where basic expert systems are incorporated.
These tend to use forward chaining where there is a clearly defined goal, such as moving from
one spot to another, although the variables and obstacles may be numerous. Natural language
processing (NLP) is another application of AI. The goal is for people to be able to converse with
computers and computers being able to understand. Such systems tend to use a mixture of
forward and backward chaining.