Artificial Intelligence
UNIT – V
Expert System and Applications: Introduction, phases in building expert systems, expert system
various traditional system, rule-based expert systems, blackboard systems, truth maintenance
systems, applications of expert systems, list of shells and tools.
------------------------------------------------------------------------------------------------------------------------
Introduction to Expert Systems (ES)
• An expert system is a computer program that is designed to solve complex problems and to
provide decision-making ability like a human expert.
• It performs this by extracting knowledge from its knowledge base using the reasoning and
inference rules according to the user queries.
• Expert systems also referred to as knowledge based expert systems
Ex: The system called MYCIN was developed using the expertise of best diagnosticians of bacterial
infections whose performance was found to be better than the average clinician.
Block diagram that represents the working of an expert system:
=======================================================================
Phases in Building Expert System
There are different interdependent and overlapping phases in building an expert system as follows:
● Identification Phase:
− Knowledge engineer finds out important features of the problem with the help of domain expert
(human).
− He tries to determine the type and scope of the problem, the kind of resources required, goal and
objective of the ES.
● Conceptualization Phase:
− In this phase, knowledge engineer and domain expert decide the concepts, relations and control
mechanism needed to describe a problem solving.
● Formalization Phase:
− It involves expressing the key concepts and relations in some framework supported by ES
building tools.
− Formalized knowledge consists of data structures, inference rules, control strategies and
languages for implementation.
Prepared by M. Kala Devi, Assistant Professor1
Artificial Intelligence
● Implementation Phase:
− During this phase, formalized knowledge is converted to working computer program initially
called prototype of the whole system.
● Testing Phase:
− It involves evaluating the performance and utility of prototype systems and revising it if need be.
Domain expert evaluates the prototype system and his feedback help knowledge engineer to revise
it.
=======================================================================
Components or Architecture of Expert Systems
Knowledge Base (KB)
• KB consists of knowledge about problem domain in the form of static and dynamic
databases.
• Static knowledge consists of
− rules and facts which is compiled as a part of the system and does not change during
execution of the system.
• Dynamic knowledge consists of facts related to a particular consultation of the system.
− At the beginning of the consultation, the dynamic knowledge base often called working
memory is empty.
− As a consultation progresses, dynamic knowledge base grows and is used along with static
knowledge in decision making.
• Working memory is deleted at the end of consultation of the system
Inference Engine
• It consists of inference mechanism and control strategy.
• Inference means search through knowledge base and derive new knowledge.
• It involve formal reasoning involving matching and unification similar to the one performed
by human expert to solve problems in a specific area of knowledge.
• Inference operates by using modus ponen rule.
• Control strategy determines the order in which rules are applied.
• There are mainly two types of control mechanism viz., forward chaining and
backwardchaining.
Prepared by M. Kala Devi, Assistant Professor2
Artificial Intelligence
Knowledge Acquisition
● Knowledge acquisition module allows system to acquire knowledge about the problem domain.
● Sources of Knowledge for ES
− text books, reports, case studies,
− empirical data and
− domain expert experience.
● Updation of Knowledge can be done using knowledge acquisition module of the system.
− insertion,
− deletion and
− updation of existing knowledge
Case History
● Case History stores the file created by inference engine using the dynamic database created at the
time of consultation.
● Useful for learning module to enrich its knowledge base.
● Different cases with solutions are stored in Case Base system.
● These cases are used for solving problem using Case Base Reasoning
(CBR)
Explanation module
● Most expert systems have explanation facilities that allow the user to ask the system why it asked
some question, and how it reached to conclusion.
● It contains 'How' and 'Why' modules attached to it.
− The sub-module ‘How’ tells the user about the process through which system has reached to a
particular solution
− ‘Why' sub-module tells that why is that particular solution offered.
● It explains user about the reasoning behind any particular problem solution.
● Questions are answered by referring to the system goals, the rules being used, and any existing
problem data.
Explanation Modules Responses
Prepared by M. Kala Devi, Assistant Professor3
Artificial Intelligence
User Interfaces
● Allows user to communicate with system in interactive mode and helps system to create working
knowledge for the problem to be solved.
Special interfaces
● It may be used for specialized activities such as handling uncertainty in knowledge.
● This is a major area of expert systems research that involves methods for reasoning with uncertain
data and uncertain knowledge Knowledge is generally incomplete and uncertain.
● To deal with uncertain knowledge, a rule may have associated with it a confidence factor or a
weight.
● The set of methods for using uncertain knowledge in combination with uncertain data in the
reasoning process is called reasoning with uncertainty
=======================================================================
Expert Systems verses Traditional Systems
Expert Systems Traditional Systems
Expert Systems manipulates Knowledge Traditional system manipulates data
All problem related expertise is encoded in data Problem expertise is encoded in program as well as
structures only and not in the programs in the form of data structures
In expert systems, small fragments of human Traditional computer programs perform tasks using
experience are collected into a knowledge base conventional decision making logic
which are used to reason through a problem
Expert systems are designed to behave like Conventional programs are designed to always
human experts and may sometimes produce produce correct answers
incorrect results
It permits inexact reasoning and but able to It uses inexact reasoning and also able to deal with
deal with incomplete, uncertain and fuzzy data. incomplete, uncertain and fuzzy information.
Expert system can be available wherever and at Traditional system can be available at a specific
any time. working day.
To solve any problem, expert system takes a To solve any problem, traditional system can take
very short interval of time. variable time
It can be replaceable. It is not replaceable.
Prepared by M. Kala Devi, Assistant Professor4
Artificial Intelligence
Characteristics of Expert Systems
• Expertise: an ES should exhibit expert performance, have high level of skill and possess
adequate robustness.
• Symbolic reasoning: Knowledge in an ES is represented symbolically which can be easily
reformulated and reasoned.
• Self-knowledge: a system should be able to explain and examine its own reasoning.
• Learning capability: a system should learn from its mistakes and mature as it grows
• Ability to provide training: every ES should be capable of providing training by explaining
the reasoning process behind solving a particular problem using relevant knowledge.
• Predictive modelling power: the system can explain how new situation led to the change,
which helps users to evaluate the effect of new facts and understand their relationship to the
solution.
Features of Expert Systems
Backward chaining – an inference technique which continuously break a goal into smaller
sub-goals which are easier to prove via IF THEN rules
Dealing with uncertainties – the system has the capability to handle and reason with
conditions that are uncertain and data which are not precisely known
Forward chaining – an inference technique which deduce a problem solution from initial
data via IF THEN rules
Data representation – the method where the specific problem data is stored and accessed in
the system
User interface – that portion of the code which creates an easy to use system;
Explanations – the ability of the system to explain the reasoning process that it used to
reach a recommendation.
Advantages and Disadvantages of Expert Systems
Advantages:
• Helps in preservating scarce expertise
• Provides consistent answers for repetitive decisions, processes and tasks
• Fastens the pace of human professional or semi-professional work.
• Holds and maintains significant levels of information
• Provides improved quality of decision making
• Domain experts are not always able to explain their logic and reasoning unlike ES
• Encourages organizations to clarify the logic of their decision making.
• Leads to major internal cost savings within companies
• Causes introduction of new products
• Never forgets to ask a question, unlike a human
Disadvantages:
• Unable to make creative responses as human experts would in unusual circumstances.
• Lacks common sense needed in some decision making
• May cause errors in the knowledge base and lead to wrong decisions
• Cannot adapt to changing environments, unless knowledge base is changed.
Languages for ES development
• LISP(LISt Processing) which is based on lambda calculus. It is simple, elegant and flexible
kanguage. AI programs are written in LISP
• Prolog (PROgramming in LOGic) based on first order predicate calculus
• Object oriented languages (C++,Java, etc) are used for developing ES.
=======================================================================
Prepared by M. Kala Devi, Assistant Professor5
Artificial Intelligence
Rule – Based Expert Systems
Rule-based systems are AI systems that employ a set of predefined rules to derive conclusions from
given data. These rules are typically represented in the form of IF-THEN statements, where:
• IF represents the conditions
• THEN represents the actions or conclusions.
Rule based systems can be either
1. Goal driven (using backward chaining to test whether a given hypothesis is true) or
2. Data driven (using forward chaining to draw new conclusions from existing data).
1. Expert System Shell in Prolog
PROGLOG provides backward chaining control strategy. The rules in this are defined using (:-op).
:-op means operator declaration
Syntax:
:-op(Prec, Type, Atom)
->Prec: unsigned integer in the
Range [1,1200]
->Type: {fx,fy,xfx,xfyyfxx,yfy}
-> Atom is a symbol of a name declared as an operator with precedence Prec and Type
Ex:
fx indicates non-associative (prefix) operators
fy denotes right-associative (prefix) operators,
xf implies non-associative (postfix) operators and
yf is used for left-associative (postfix) operators
The following is the simple ES shell in prolog that uses backward chaining inference
mechanism.
Prepared by M. Kala Devi, Assistant Professor6
Artificial Intelligence
The main top level Prolog predicate is consultation, this predicate collects information about the
user and calls the main predicate hypothesis, which uses backtracking to go through all the
members of a list of diseases to see whether each can be proved true by backward chaining
Once it satisfies all the symptoms of a disease in hand, then it crosses cut and displays an
appropriate message probably has that disease to the user.
Prepared by M. Kala Devi, Assistant Professor7
Artificial Intelligence
If it fails to satisfy a particular disease, it tries another disease till all the diseases are
exhausted.
If it fails for all diseases, then the system expresses regret by displaying Sorry, not able to
diagnose.
Finally all facts yes() and no() of symptoms collected by user and stored in database are
removed.
2. Problem-independent forward chaining
Forward chaining inference mechanism is a reasoning process that begins with known facts and
proceeds forward to find a successful goal.
For doing this, we code prolog rules as facts with two arguments
1. Head (left side) of the rule
2. Body (list of sub goals) at the right side of the rule.
Example: Let us represent a rule as a fact using a predicate named rule (if [subgoals] then G) and
facts by a predicate named fact. Here a, b, c, e and f represent atoms (predicated with arguments)
The above programsimulates forward chaining mechanism
Prepared by M. Kala Devi, Assistant Professor8
Artificial Intelligence
Let us run a forward-chaining program. The trace the query execution is shown below:
Query ?- forward
The status of rule_facts_file in the process of executing forward chining predicate is shown below
Prepared by M. Kala Devi, Assistant Professor9
Artificial Intelligence
MYCIN Expert System and Various Shells
MYCIN is one of the earliest and most well-known examples of an expert system,
particularly in the medical field, while shells are frameworks or tools that allow developers
to create expert systems without starting from scratch.
In MYCIN, the knowledge is represented as a set of it-then rules with certainty factors
The MYCIN was written in LISP language and its rules were formally represented as LISP
expressions
It was a goal directed system that used backward chaining strategy.
Prepared by M. Kala Devi, Assistant Professor10
Artificial Intelligence
MYCIN used various heuristics to control the search for a solution while proving some of
the hypotheses
MYCIN first looks at rules that have more certain conclusions and abandons a search once
the certainties involved become lower that some threshold, such as 0.2 in this case
MYCIN had three stages:
1. Initial data regarding the case was gathered to enable the system to come up with a very
broad diagnosis
2. The questions that were asked to test specific hypotheses were more direct in nature.
3. A diagnosis was proposed.
Example: if disease1 has subclasses disease2 and diseae3 and the system has established that
a patient has disease1 and subclasses disease2 and disease3 are differentiated by only a few
symptoms, then MYCIN would ask about differentiating symptoms to establish whether it
should proceed along disease2 path or disease3 path
Various Shells
EMYCIN was the first expert shell developed from MYCIN
An ES called PUFF was developed using EMYCIN in the new domain of hear disorders
DEOMYCIN was developed which takes them through various sample cases,
o check their diagnoses,
o determines whether their conclusions are right and
o explains where they went wrong
PROSPECTOR was developed to aid exploration geologists in their search for ore deposits.
OPS5 is a
o general-purpose system,
o rule based system
o uses forward chaining and
o possesses flexible control strategy and representations.
DENDRAL was used to infer a compound’s molecular structure from its mass spectral and
nuclear response.
=======================================================================
Reasoning Strategies used by Inference Engine
Forward Chaining and Backward Chaining, which are two fundamental methods for processing
information and solving problems in an expert system
1. Forward Chaining
This is a data-driven reasoning approach where the system starts with the available
facts and applies rules to infer new facts or conclusions. It’s typically used to predict
outcomes or determine what will happen next. An example given is predicting stock
market movements.
Prepared by M. Kala Devi, Assistant Professor11
Artificial Intelligence
2. Backward Chaining
This is a goal-driven reasoning approach where the system starts with a hypothesis
or a goal (something to prove) and works backward to determine which facts or
conditions would support that conclusion. It’s often used to diagnose issues by
determining the cause of an observed effect. The examples provided include
diagnosing medical conditions like stomach pain, blood cancer, or dengue.
=============================================================
Blackboard system
Blackboard systems were first developed in the 1970’s to solve complex, difficult, and ill-structured
problems in a wide range of application area.
Black board architecture is a way of representing and controlling the knowledge, Bases, using
independent groups of rules called knowledge sources (KSs) that communicate through at data
control database called a blackboard
Blackboard System Components
Modules of a blackboard systems. It consists of the following three main components
1. Knowledge sources
2. Blackboard and
3. control shell
Prepared by M. Kala Devi, Assistant Professor12
Artificial Intelligence
1. Knowledge sources
• Blackboard systems use a functional modularization of expertise knowledge in the form of
knowledge sources(KSs)
• These are independent computational modules that contain the expert knowledge needed to
solve a given problem
• A KS is independent of all other KSs in the blackboard system.
• It is possible to add additional KSs to the blackboard system and upgrade or even remove
existing KSs
• This knowledge in problem solving process is known as a triggering condition.
2. Blackboard
• Blackboard represents a global data repository and shared data structure available to all KSs
• It contains several important constituents such as
o Raw input data
o Partial solutions
o Alternatives and final solutions
o Control information
o Communication medium and buffer
o KS trigger mechanism
• Used in various phases in problem solving
• In case of the number of contributions placed on the blackboard becoming large, it
subdivides the blackboard into regions ie a particular kind of information.
Characteristics or Advantages of Blackboard
• To integrate contributions dynamically to specify relationships in advance
• It can retain the results of problems that have been solved earlier
• They allow a KS to efficiently inspect the blackboard to confirm if relevant information is
present.
3. Control Component
• The control component of a blackboard system helps in making runtime decisions regarding
the course of problem solving and the expenditure of problem solving resources.
• In a blackboard system, a separate control mechanism, called the control shell, directs the
problem solving process by allowing KSs to respond opportunistically to changes made to
the blackboard.
• In a blackboard system control approach, the currently executing KS activation (KSA)
generates events as it makes changes on the blackboard.
• The control shell uses these events to trigger and activate KSs. Out of all ranked KSAs the
best KSA is selected for execution
Prepared by M. Kala Devi, Assistant Professor13
Artificial Intelligence
Knowledge Source Execution Method
The steps involved in KS execution in a blackboard system are :
1. The control shell is notified of an event of interest to the KS.
2. This triggering information is used by the control shell to activate the KS in case such events
occur
3. LS uses the triggering context to determine the ranges of attribute values and searches the
blackboard to find blackboard objects possessing attributes within those ranges
4. The retrieved objects triggering context information are used by the KS to perform its
computations.
5. The results of this computation are written onto the blackboard.
Issues in Blackboard Systems for Problem Solving
Information can be represented on blackboard in two wars:
Specialized representation: In specialized representation, KSs may only operate on a few
classes of Blackboard objects.
Fully general representation: In fully general representations, all aspects of blackboard data
are understood by all KSs
Sharing of contributions among KSs involves the issue to which extend the details in the
contributions to be placed on the blackboard.
Issues may be handled in two different ways:
1. KSs may put the minimal amount of information on the blackboard
2. KSs may put a detailed representation of the relationship between inputs, partial solution,
the knowledge procedures etc
Blackboard systems do not allow direct interaction among modules as all communication is done
via blackboard through control shell
All interactions among KS activations is serial and unidirectional, beginning from earlier to later
executions.
Executing KSs must be able to detect and respond to alterations made to the blackboard during their
execution for supporting such indirect interaction.
In a blackboard application, integration of results involves three major activities:
1. Relationship management
2. Attribute merging
3. Value propagation
Prepared by M. Kala Devi, Assistant Professor14
Artificial Intelligence
Blackboard System versus Rule-Based System
Aspect Blackboard System Rule-Based System
Structure Shared workspace with collaborative Set of explicit if-then rules
agents
Knowledge Blackboard systems use a common Rule-based systems use fixed
knowledge base, called the knowledge, and are limited to narrow
"blackboard", that is updated by AI.
multiple knowledge sources.
Problem- Blackboard systems are effective at Rule-based systems are not well-suited
solving solving complex problems by to solving problems in complex
combining different perspectives and domains or across multiple different
areas of expertise domains.
Complexity Blackboard systems are designed to Rule-based systems can be difficult to
handle complex, ill-defined problems maintain, especially when adding rules
to a large knowledge base.
Response to Blackboard systems execute an entire Rule-based systems fire a rule in
events knowledge source (KS) in response to response to stimuli
an event
Control Opportunistic control Forward or backward chaining
Mechanism
Flexibility High, suited for dynamic, complex tasks Moderate, suited for well-defined
problems
Scalability Modular, easily scalable Limited scalability in complex domains
Application Real-time systems, robotics Medical diagnosis, troubleshooting
Example
=======================================================================
Truth Maintenance System (TMS)
● Truth maintenance system (TMS) works with inference engines for solving problems within large
search spaces. .
● The TMS and inference engine both put together can solve problems where algorithmic solutions
do not exist.
TMS maintains the beliefs for general problem solving systems
TMS can be used to implement monotonic or non-monotonic systems.
● In monotonic system, once a fact or piece of knowledge is stored in KB, it can not change.
− In monotonic reasoning, the world of axioms continually increases in size and keeps on
expending.
− Predicate logic is an example of monotonic form of reasoning. It is a deductive reasoning system
where new facts are derived from the known facts.
Prepared by M. Kala Devi, Assistant Professor15
Artificial Intelligence
● Non-monotonic system allows retraction of truths that are present in the system whenever
contradictions arise.
− So number of axioms can both increase and decrease and depending upon the changes in KB, it
can be updated.
Non-Monotonic TMS:
● TMS basically operates with two kinds of objects
− ‘Propositions’ declaring different beliefs and
− ‘Justifications’ related to individual propositions for backing up the belief or disbelief expressed
by the proposition.
● For every TMS, there are two kinds of justifications required namely ‘Support list’ and
‘Conditional proof’.
Prepared by M. Kala Devi, Assistant Professor16
Artificial Intelligence
Support list (SL):
● It is defined as “SL(IN-node)(OUT-node)”, where IN-node is a list of all INnodes (propositions)
that support the considered node as true.
− Here IN means that the belief is true.
− OUT-node is a list of all OUT nodes for the considered node to be true. OUT means that belief is
not true
=======================================================================
Application of Expert Systems
1. Diagnosis: the expert systems belonging to this class perform the task of inferring
malfunctioning of system from observations. Diagnosis can refer to inferring a possible disease
from a given set of symptoms in the field of medicine
2. Planning and scheduling: the expert systems of this class help in designing actions and plans
before actually solving a given problem.
ex:
• Airline scheduling of flights
• Manufacturing job-shop scheduling,
• Creating plan for applying series fo chemical reachtions
• Manufacturing process planning
• Creating air strike plan projected over sseveral days etc.
3. Design and manufacturing: Here a solution to a problem is configured by a given set of objects
under a set of constraints.
ex:
• Gene cloning
• Integrated circuits layouts designing,
• Creation of complex organic molecules,
• Modular home building,
• Manufacturing, etc
4. Prediction: the expert systems of this class perform the task of inferring the likely consequences
of a given situation
Ex:
Weather prediction for rains, storms and tornado
Prediction of crops
Share market, etc
5. Interpretation: it performs the task of interpreting and inferring situation description data of any
domain such as geological data, census data, medical data etc
• Interpreting data from ICU test equipment for further investigation or
monitoring
Prepared by M. Kala Devi, Assistant Professor17
Artificial Intelligence
• Interpreting intelligent sensors reports to perform situation assessment
• Interpreting radar images to classify ships, etc
6. Financial decision making: the financial service industry has been a prominent user of ES
techniques. Such systems asist insurance companies to assess the risk presented by the customer
and to determining a price for the insurance.
Applications are:
Foreign exchange trading
Formulating financial strategies
Giving advices etc
7. Process monitoring and control: it analyzes real time data from physical devices with the goal
by comparing observations to expected outcomes, predicting trends and controlling for both
optimality and failure correction
Ex:
Steel making and oil refining industries
Nuclear reactor(to detect accident conditions)
Patient monitoring system in hospitals
8. Instruction: An expert system ca offer tutorials and instructions to students by incorporating a
student’s behaviour and learning capability models and can also evaluate a students’ acquired skills
9. Debugging: the systems of this class prescribe remedies for malfunctioning devices. They may
Suggest the type of maintenance needed to correct faulty equipment
Help in debugging large computer programs to improve the performance etc
10. Knowledge Publishing: the function of ES is to deliver knowledge to user that is in context of
the user’s problem
Ex:
Advisors, which counsel a user on appropriate grammatical usage in a text
A tax advisor that accompanies a tax preparation program
Other Miscellaneous Applications
• Fraud detection, object identification and information retrieval system.
• Handling certain tedious and dangerous situations such as coal mining
• Judicial systems to solve new cases intelligently using past case history, advising on legal
issues, etc.
• In defense performing situation assessment from intelligence reports, analyzing radar signals
and images, predicting when and where armed conflict will occur next, simulation of war etc
• Household activities such as giving advice on cooking, shopping and so on are also potential
applications.
Benefits of Expert Systems
• Availability − They are easily available due to mass production of software.
• Less Production Cost − Production cost is reasonable. This makes them affordable.
• Speed − They offer great speed. They reduce the amount of work an individual puts in.
• Less Error Rate − Error rate is low as compared to human errors.
• Reducing Risk − They can work in the environment dangerous to humans.
• Steady response − They work steadily without getting motional, tensed or fatigued.
=======================================================================
List of Shells and Tools
1. ACQUIRE: it provides a complete development environment for the building and
maintenance of knowledge-based applications
Prepared by M. Kala Devi, Assistant Professor18
Artificial Intelligence
2. Arity: expert development package is an ES that was developed by Arity Corporation, MA
to perform the task of integrating rule based and frame-based representations of knowledge
with various types of certainty factors.
3. ART: it is called Automated reasoning tool that is an ES shell which is based on LISP. It
supports rule-based reasoning, hypothetical reasoning and case-based reasoning.
4. CLIPS:
• it is used to represent C Language Integrated Production System.
• it is a public domain software tool that is used for building expert systems
• It provides a cohesive tool for handling a wide variety of knowledge and provides
support to three different programming disciplines namely
o Rule-based
o Object-oriented and
o Procedural
5. FLEX:
• Flex is a hybrid ES which is implemented in Prolog.
• It supports
o interleaved forward and backward chaining
o Multiple inheritance and procedural attachment
o Automatic question and answer system
• Rules, frames and questions are described in an easily understandable knowledge
specification language (KSL)
6. Gensym’s G2:If offers a graphical, object-oriented environment for the creation of
intelligent applications that are able to
Monitor
Diagnose
Control dynamic events in various environments
7. GURU: it is an ES development environment and offers a wide variety of information
processing tools combined with knowledge-based capabilities such as
Forward chaining
Backward chaining
Mixed chaining
Multi value variables
Fuzzy reasoning
8. HUGIN SYSTEM: it is a software package for the construction of model based expert
systems. The Hugin System contains an easy to use
Probability based deduction system
Applicable to complex networks with cause effect casual relations subject to
uncertainty.
9. Knowledge Craft: it is a knowledge acquisition and visualization tool. It runs on windows,
DOS and UNIX workstations
10. MailBot: it is a personal e-mail agent that reads an e-mail message on standard input and
creates an email reply to be sent to the sender of the original message.It provides
filtering
Forwarding
Notification
Automatic question-answering capabilities
=======================================================================
Prepared by M. Kala Devi, Assistant Professor19
Artificial Intelligence
UNIT – V Question Bank
1. Compare and contrast expert systems Vs traditional systems.
2. Illustrate in detail about the various tools used in building an expert system
3. List and explain in detail about various features of expert system.
4. Discuss in detail about truth maintenance systems.
5. Illustrate in detail about the various phases of building an expert system
6. Describe the forward chaining and backward chaining inference strategies in expert system.
7. List and explain the components of expert system and how they work together.
8. With a neat sketch explain the architecture of expert system?
9. Explain the concept of rule-based reasoning and how is it used in expert systems?
10. How is an expert system different from a traditional program?
11. List the characteristics of expert systems. Classify various Expert System shells and tools.
Prepared by M. Kala Devi, Assistant Professor20