0% found this document useful (0 votes)
34 views51 pages

AI-LEC-3-Expert Systems

The document discusses expert systems (ES), which are AI applications designed to solve complex problems in specific domains using human-like expertise. It outlines the structure of rule-based expert systems, including components like the knowledge base, inference engine, and user interface, as well as the methods of reasoning such as forward and backward chaining. Additionally, it addresses the capabilities, limitations, and characteristics of expert systems, emphasizing their reliance on domain-specific knowledge and the potential for errors.

Uploaded by

atishaliraza
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)
34 views51 pages

AI-LEC-3-Expert Systems

The document discusses expert systems (ES), which are AI applications designed to solve complex problems in specific domains using human-like expertise. It outlines the structure of rule-based expert systems, including components like the knowledge base, inference engine, and user interface, as well as the methods of reasoning such as forward and backward chaining. Additionally, it addresses the capabilities, limitations, and characteristics of expert systems, emphasizing their reliance on domain-specific knowledge and the potential for errors.

Uploaded by

atishaliraza
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
You are on page 1/ 51

Artificial Intelligence

Lecture No. 3
Expert Systems
• ES perform tasks for specific domains that require
human expertise
– Medical diagnosis, fault diagnosis, status monitoring, data
interpretation, computer configuration, etc.
• ES solve problems using domain-specific knowledge
• Domain knowledge is acquired by interviewing human
experts
• ES cannot operate in situations requiring common sense
• The expert systems are the computer applications
developed to solve complex problems in a particular
domain, at the level of extra-ordinary human
intelligence and expertise.
Structure of a rule-based expert system

■ The production model is based on the idea that


humans solve problems by applying their knowledge
(expressed as rules) to a given problem represented
by problem-specific information.
■ The production rules are stored in the long-term
memory and the problem-specific information or
facts in the short-term memory.
■ It is introduced by the researchers at Stanford
University
Production system model
Components of Expert Systems
• Knowledge Base
• Inference Engine
• User Interface
Basic structure of a rule-based expert system
Knowledge base
■ The knowledge base contains the domain
knowledge useful for problem solving.
■ In a rule- based expert system, the knowledge is
represented as a set of rules. Each rule specifies a
relation, recommendation, directive, strategy or
heuristic and has the IF (condition) THEN (action)
structure.
■ When the condition part of a rule is satisfied, the
rule is said to fire and the action part is executed.
knowledge base
• The knowledge base is formed by readings
from various experts, scholars, and the
Knowledge Engineers. The knowledge
engineer is a person with the qualities of
empathy, quick learning, and case analyzing
skills
Knowledge
• The data is collection of facts. The information is
organized as data and facts about the task domain.
Data, information, and past experience combined
together are termed as knowledge.

• Factual − It is the information widely accepted by


the Knowledge Engineers and scholars in the task
domain.
• Heuristic − It is about practice, accurate judgement,
one’s ability of evaluation, and guessing
Knowledge representation:IF-THEN-ELSE rules
Database
• The database includes a set of facts used to
match against the IF (condition) parts of rules
stored in the knowledge base.
Inference engine
■ The inference engine carries out the reasoning whereby the
expert system reaches a solution. (often called as brain)
■ It links the rules given in the knowledge base with the facts
provided in the database.
■ Applies rules repeatedly to the facts, which are obtained from
earlier rule application.
■ Adds new knowledge into the knowledge base if required.
■ Resolves rules conflict when multiple rules are applicable to a
particular case.
the Inference Engine uses the following strategies:
• Forward Chaining
• Backward Chaining
Explanation facilities
■ The explanation facilities enable the user to
ask the expert system how a particular
conclusion is reached and why a specific fact
is needed.
■ An expert system must be able to explain its
reasoning and justify its advice, analysis or
conclusion.
User interface
■ The user interface is the means of
communication between a user seeking a
solution to the problem and an expert system.

■ Natural language displayed on screen.


■ Listing of rule numbers displayed on the
screen.
Complete structure of a rule-based expert system
Expert Systems Shells
• The E.S shell simplifies the process of creating a
knowledge base.
• It is the shell that actually processes the information
entered by a user relates it to the concepts contained
in the knowledge base and provides an assessment or
solution for a particular problem.
• Thus E.S shell provides a layer between the user
interface and the computer O.S to manage the input
and output of the data.
• It also manipulates the information provided by the
user in conjunction with the knowledge base to arrive
at a particular conclusion.
• When an expert system shell is used, a
knowledge engineer or an expert simply
enters rules in the knowledge base. Each new
rule adds some new knowledge and makes the
expert system smarter.
• A shell is nothing but an expert system
without knowledge base
Characteristics of an expert system
• An expert system is built to perform at a human
expert level in a narrow, specialized domain.
• Thus, the most important characteristic of an
expert system is its high-quality performance. No
matter how fast the system can solve a problem,
the user will not be satisfied if the result is wrong.
Characteristics of an expert system

• In expert systems, knowledge is separated from its


processing (the knowledge base and the inference
engine are split up).
• A conventional program is a mixture of knowledge
and the control structure to process this knowledge.
• This mixing leads to difficulties in understanding and
reviewing the program code, as any change to the
code affects both the knowledge and its processing.
Characteristics of an expert system

• Expert systems apply heuristics to guide the


reasoning and thus reduce the search area for a
solution.
• A unique feature of an expert system is its
explanation capability. It enables the expert
system to review its own reasoning and explain its
decisions.
• On the other hand, the speed of reaching a
solution is very important.
Capabilities of Expert Systems
• Advising
• Instructing and assisting human in decision making
• Demonstrating
• Deriving a solution
• Diagnosing
• Explaining
• Interpreting input
• Predicting results
• Justifying the conclusion
• Suggesting alternative options to a problem
Capablity
• Substituting human decision makers
• Possessing human capabilities
• Producing accurate output for inadequate
knowledge base
• Refining their own knowledge
Can expert systems make mistakes?
• Even a brilliant expert is only a human and thus can
make mistakes.
• This suggests that an expert system built to perform
at a human expert level also should be allowed to
make mistakes. But we still trust experts, even we
recognize that their judgments are sometimes
wrong.
• Likewise, at least in most cases, we can rely on
solutions provided by expert systems, but mistakes
are possible and we should be aware of this.
Limitations
• Limitations of the technology
• Difficult knowledge acquisition
• ES are difficult to maintain
• High development costs
Comparison of expert systems with conventional
systems and human experts
Comparison of expert systems with conventional
systems and human experts (Continued)
Forward chaining and backward chaining
■ In a rule-based expert system, the domain
knowledge is represented by a set of IF-THEN
production rules and data is represented by a set of
facts about the current situation.
■ The inference engine compares each rule stored in
the knowledge base with facts contained in the
database.
■ When the IF (condition) part of the rule matches a
fact, the rule is fired and its THEN (action) part is
executed.
Forward chaining and backward chaining

• The matching of the rule IF parts to the facts


produces inference chains.
• The inference chain indicates how an expert
system applies the rules to reach a conclusion.
Inference engine cycles via a match-fire procedure
Expert Systems at a Glance
• ES are one of AI's early showpieces
• ES use rule-based systems along with additional
capabilities
• Components of an ES include:
– Evidence gathering
– Control of inference
– Uncertainty reasoning
– Explanation generation and tutoring
– User interface
– Validation
– Social issues
Some Famous Early Expert Systems
• Dendral (Stanford, Ed Feigenbaum, 1965) - organic chemical
analysis
• Macsyma (MIT, 1965) - symbolic math problems
• Mycin (Stanford, 1972) - diagnose blood diseases
• Prospector (SRI, 1972) - mineral exploration
• Caduceus (1975) - internal medicine
• Xcon and R1 (1980, 1982) - computer system configuration
(for DEC)
• Harpy - document retrieval
• Hearsay - Speech understanding
• Max (Nynex, 1992) - telephone network troubleshooting
bacterial infection diagnosis
Forward Chaining and Backward Chaining
There are two main types of control schemes that are applied to rule-based
systems.

Z1 If ?x has hair
Then ?x is a mammal
Z2 If ?x gives milk Database
Then ?x is a mammal ------------
Z3 If ?x has feathers
Then ?x is a bird F1) Stretch has hair
Z6 If ?x is a mammal F2) Stretch chews cud
?x has pointed teeth F3) Stretch has long legs
?x has claws F4) Stretch has a long neck
?x has forward-pointing eyes F5) Stretch has tawny color
Then ?x is a carnivore F6) Stretch has dark spots
Z8 If ?x is a mammal
?x chews cud
Then ?x is an ungulate
Z11 If ?x is an ungulate
?x has long legs
?x has long neck
?x has tawny color
?x has dark spots
Forward Chaining
• Reason FORWARD from facts/rules to (hopefully) a needed goal
• generate new facts
• Rule antecedents are compared with facts from database
• If match, add consequents to database
• Repeat as long as needed
• Forward chaining is “data driven”
• It is a strategy of an expert system to answer the question, “What’s next?

Match Z1 & F1 Match Z11/1 & F8 (?x Stretch)


Add: Stretch is a mammal Match Z11/2 & F3
Match Z11/3 & F4
Match Z8/1 & F7 (?x Stretch) Match Z11/4 & F5
Match Z8/2 & F2 Match Z11/5 & F6
Add: Stretch is an ungulate Add: Stretch is a giraffe

Note: Z5/1, Z6/1, Z7/1 would be


matched before Z8/1
Backward Chaining
• Reasons BACKWARD from goal through rules to facts
• Use modus ponens
– Start at goals
– Match goals to consequents or facts
– If match consequents, antecedents become new subgoals
• Repeat until
– All subgoals are proven or
– At least one subgoal cannot be proven
• Backward chaining is “goal driven”
• With this strategy, an expert system finds out the answer to the
question, “Why this happened?
Planning
• What is planning?
• Strategies required to achieve a goal or to
solve a particular problem
Need for Planning
• If our goal is to create an autonomous,
intelligent entity, we need to study planning.
• Logic, natural language, learning, vision, are all
useful, and they would make nice
human-driven tools.
• But what is the entity going to DO???
• It has to decide WHAT it wants to do, and
HOW to do it.
Environment Properties
• Fully observable vs. partially observable
• Deterministic vs. stochastic / strategic
• Episodic vs. sequential
• Static vs. dynamic
• Discrete vs. continuous
• Single agent vs. multiagent
Goal-Based Agents
• Goal reflects
desires of agents
• May project actions
to see if consistent
with goals
• Takes time, world
may change during
reasoning
Planning Search Space
• Suppose problem is “Get
a quart of milk and two
eggs (to make pancakes)
and a variable-speed
cordless drill (to fix
house when done)”.
– Search through a space
of states
– Try each possible action
– Thousands of actions,
millions of states
– The heuristic function
directs search, but
doesn't prune states
Planning Key 1
• In planning we will modify our representation of the
search space (states, goals, and actions) to allow more
efficient reasoning.
• Instead of search through states from initial state to
goal state, we can look for actions that seem relevant
and are accessible.
• If goal includes Have(Milk)
• and Buy(x) achieves Have(x)
• then agent should consider plan that includes
Buy(Milk).
• Do not consider Buy(WhippingCream) or GoToSleep.
Planning Key 2
• The planner can add actions to the plan
wherever they are needed, instead of always
at the end (or beginning) of the plan.
• Agent may want to Buy(Milk), but doesn't
know how to get there, how to buy it, what to
do after that.
• Make “obvious” or “important” decisions first.
Planning Key 3
• Parts of the world are independent from other
parts.
• We can solve one part of a conjunctive goal
with one plan, another part of the goal with
another plan.
Planning Representation
• States are represented as a conjunction of instantiated
literals (no functions)
– At(Home) ^ Have(Milk) ^ Have(Bananas) ^ Have(Drill) ^ …
– States can be incomplete - if don't specify, then negation is
assumed.
– If Have(Unicorn) is not included, assume -Have(Unicorn).
This is the Closed-World Assumption.
• Goals are described as conjunction of literals (possibly with
variables).
– At(Home) ^ Have(Milk) ^ Have(Bananas) ^ Have(Drill)
– At(x) ^ Sells(x, Milk) if goal is to be at store that sells milk.
• Variables must be existential (like theorem prover goal).
– Here, we are not seeing if database entails goal.
– We are trying to transform state to one that includes goal.
Planning Representation
• STRIPS Operators
– Precondition
• Conjunction of atoms (positive literals) that must be true to apply
operator
– Effect
• Conjunction of literals that describe how the situation changes
when operator is applied
• Example
– OP Go(?there)
– Precondition: At(?here) ^ Path(?here, ?there)
– Effect: At(?there) ^ -At(?here)
State Space Planner
• Operators can have variables - then we unify goals
with facts.
• We call this type of planner a situation space
planner, or state space planner, because nodes in
search space represent states or situations.
• This type of planner completely solves one goal,
then tacks on plan for next goal.
• “Progression planner” if search forward (A*) This
prunes options if high fan-in
• “Regression planner” if search backward (GPS)
This prunes options if high fan-out
Example State Space Planner
• General Problem Solver, GPS
• Uses Means-Ends Analysis

Limitations
Note what happens when we apply STRIPS planning to this
problem.
On(C,A)
On(A,Table) Operator PutOn(X,Y)
On(A,B)
On(B,Table) Prec: Clear(X)
On(B,C)
Clear(C) Y=Table v Clear(Y)
Clear(B) On(X,Y)
Add: On(X,Y)
Clear(Z) (if On(X,Z))
Delete: On(X,~)
Clear(Y)

Approach 1 Approach 2
1) ON(A,B) 1) ON(B,C)
1) Try PutOn(C,Table) to clear A 1) Try PutOn(B,C)
2) PutOn(A,B) to achieve first goal 2) ON(A,C)
2) ON(B,C) We are farther from this goal now than
To achieve this goal, B will be re-cleared, we were in the initial state!
undoing first goal!
Sussman’s Anomaly
A C

B
Sussman’s Anomaly
• This problem can be solved, but it cannot be
attacked by first applying all the operators to
achieve one goal, and then applying operators to
achieve another goal.
• The problem is that we have forced an ORDERING
on the operators. Sometimes steps for multiple
goals need to be interleaved.
• Partial-order planning is a type of plan generation
in which ordering is imposed on operators ONLY
when it has to be imposed in order to achieve the
goals.
Plan Space Planning
• Node (state space): world state
• Node (plan space): partial plan
• Operator (state space): next step in plan sequence
• Operator (plan space)
– Add a link from existing action to open condition (precondition
that is not yet fulfilled)
– Add a plan step to fulfill open condition
– Order a step in the sequence
• Gradually move from incomplete/vague plans to complete
plans.
We call planners that use this type of approach partial-order
planners
• Example: Have shoes on both feet.
Partially-Ordered Plans
• The initial plan has only two steps (Start and
Finish), 1 ordering (Start before Finish).
• A sock must be put on before a shoe.
Summery of Today’s Lecture
• Structure of a rule-based expert system
• Expert Systems Shells
• Characteristics of an expert system
• Comparison of expert systems with
conventional systems and human experts

You might also like