Title: COSC 4355 and 5355 Expert Systems
1COSC 4355 and 5355Expert Systems
- Introduction to Expert Systems (Part 2)
- Dr. Lappoon R. Tang
2Overview
- Basic concepts in implementing an expert system
languages, shells, and tools - Diving another level down what elements do we
have in an expert system? - Treating an expert system as a production system
3Readings
- ESPP
- Section 1.8 to Section 1.10
4Some basic concerns in constructing an expert
system
- Since an expert system is a piece of software
(remember an expert was somehow turned into a
system?), what would be a good programming
language for implementing the system? - Are there tools that can facilitate development
of an expert system? - Are there tools that can be used to develop an
expert system?
5Expert system languages?
6Tools for making life easier in creating expert
systems?
- Tools here refer to utility programs that
facilitate development of an expert system (as
opposed to those that are actually used to
develop one) - Debugger
- Text and graphics editors
- File management systems
- In some cases, even code generator
7What about tools that are used to make expert
systems?
- Tools that are used directly to make an expert
system is called an expert system shell - A special tool that allows a knowledge engineer
to encode knowledge in a programming-language
like formalism - Notice
- Expert system shells are not general purpose
programming languages they are more like
language like tools for specifying knowledge - However, some programming languages do facilitate
creation of expert system shells (e.g. PROLOG) - Examples
- CLIPS
- Any expert system shell created by PROLOG
- EMYCIN
8Review Outline of an expert system (dont tell
me u forgot -p)
Knowledge Base
Someone who needs to solve a problem
Facts
Rules
Expertise (e.g. decisions, answers)
Inference Engine
BUT He doesnt have the knowledge!! ?
Expert System
9A much more in-depth outline of an expert system ?
10The Knowledge Base
- Contains production rules IF THEN rules
(A sample rule from MYCIN translated into
English) IF 1. the site of the culture is
blood 2. the identity of the organism is not
known with certainty 3. the stain of the
organism is gramneg 4. the morphology of the
organism is rod 5. the patient has been
seriously burned THEN Conclusion the identity
of the organism is pseudomonas (CF 0.4)
LHS Antecedents
RHS Consequence
- MYCIN has around 600 such rules ?
11Knowledge Acquisition
- The knowledge acquisition (KA) facility allows
the expert system to induce new rules from
observed data - An optional feature in an expert system (in fact
most expert systems dont have this capability) - Most KA facilities, if not all, are built on
(rule based) machine learning algorithms such as
ID3, C4.5 (latest version C5.1)
12The working memory
- This is where facts (related to the problem we
need to solve) are stored in the expert systems - Example Medical diagnosis
- Fact 1 the patient has a running nose
- Fact 2 the patient does not have a sore throat
- Fact 3 the patient keeps coughing
13The inference engine
- Using facts stored in the working memory, the
inference engine checks which rules have all
conditions (i.e. antecedents) satisfied - Rules with their antecedents satisfied (aka
activations) are stored in the agenda the rule
with the highest priority is used first - If an activation is applied, the RHS (i.e. the
consequence) becomes true or an action is taken
if the RHS is an action. Notice that new facts
are added back to the working memory. - Basically, in this case, the inference engine
engages in a recognize-act / situation-response
cycle until the problem is solved (e.g. a
diagnosis is found, a computer is configured) - Note an activation that has been applied is
removed from the agenda to avoid unnecessary
repetition - Generally, there are two ways to perform rule
based inference - Forward chaining use all the facts to find out
which rules have become activated, apply the rule
with highest priority, add new facts derived back
to working memory - Backward chaining start with the RHS of a rule,
see if the conditions on the LHS are all true (in
the working memory), if so, apply the rule and
add new facts derived back to the working memory
14Explanation facility
- This component of an expert systems allows a user
to - 1) find out how a conclusion is arrived (e.g. a
diagnosis) or a solution is produced by asking
why questions to the systems - 2) explore alternative ending (i.e. alternative
solution or diagnosis) by asking what if
questions (like what if we had this alternative
piece of evidence )
15The user interface
- It performs mainly two functions
- 1) Allows a user to control (at the top level)
how the expert system shell works by giving
commands (e.g. how inference should be performed,
backward chaining or forward chaining?) - 2) Displays information relevant for solving the
problem at hand - Example Warning messages
- Example Relevant information about the problem
itself (e.g. current status of CPU flags)
16Issues with ordering does ordering of rules
matter?
- It turns out the order of application of all
activations (i.e. rules that are applicable) does
matter
(Suppose say both rules are applicable) IF there
is a fire THEN leave IF my clothes are on fire
THEN put out the fire
- Suppose you and your friend are escaping a fire
but unfortunately your clothes catch on a fire in
the process. Both rules will apply but obviously
the 2nd rule has a much higher priority ?
17Solution 1 Markov Algorithm
- Markov (Andrey Andreyevich Markov Jr., 1903
1979) came up with the idea of giving priority to
rules so that all applicable production rules are
NOT un-ordered but rather order - Example
- 1) car wont start ? check gas
- 2) car wont start ? check battery
18Solution 1 Markov Algorithm
- Markov algorithm
- 1) If the rule with the highest priority applies,
apply it - 2) If not, apply the next rule with the highest
priority (i.e. the one with 2nd highest priority) - 3) Keep performing 1) and 2) until either
- a) the computer blows up (just a joke ?)
- b) no rule is applicable
- c) the problem is solved
19Solution 2 Rete Algorithm
- Unfortunately, the Markov algorithm requires one
to sequentially go through a list of rules to see
which one applies - What if the list of rules become huge?
- Answer we would rather check out a DVD instead
of waiting for the PC to blow up -p - Lesson Issue of efficiency matters!
20Solution 2 Rete Algorithm
- Basically, Charles L. Forgy at CMU recognized
this problem in the late 70s and came up with
the Rete algorithm to solve the problem of
efficiency associated with Markov algorithm - Rete algorithm is designed with two observations
in mind - Temporal redundancy application of a rule
usually changes only a few facts AND only a few
rules are affected by those new facts (or
deletion of old facts) - Structural similarity The same antecedent often
appears in the LHS of more than one rule - Idea use a B tree to organize the rules into a
data structure that support fast searching of
rules with matching antecedents AND look only for
changes in matches this results in tremendous
speed up
21Open problems
- Problem 1 Can one use machine learning to learn
priorities for a set of production rules if
they were initially unordered? - Problem 2 If we combine the same antecedent
(e.g. car wont start) that appears in different
production rules into a single node, we
essentially have a network structure. Can one
learn such a structure (i.e. essentially learning
the rules) via machine learning for knowledge
acquisition? - Hint learning network structure for neural
networks ?