Lecture 9
Lecture 9
Access to knowledge
Separate, identifiable task specific knowledge
allows direct access to that knowledge
Main issues
Representing knowledge
Structuring knowledge to make problems easier to solve
Components of a PDIS
Knowledge base
Set of structures called pattern-directed
modules (PDMs)
Working memory
One or more data structures in which
PDIS dynamic memory is stored
Interpreter
Executive program which controls the
selection and activation of PDMs
Chunks of Knowledge
PDMs are structurally independent
Each module has some intrinsic meaning to
the domain expert, i.e., is a chunk of
knowledge
PDMs are activated by patterns of data in
working memory
Why chunk knowledge
Facilitate incremental expansion of the knowledge
base
Permit system to trace and explain its behavior in
a simple and effective way
Facilitate isolation of effective problem solving
knowledge
Chunks of Knowledge
Having knowledge modules helps the
programmer understand what the system knows
Knowledge can be added in small meaningful chunks
Chunks of Knowledge
To find the source of a systems problem solving
power
Perform experiments in which various PDMs are
Modified, deleted, traced
Debugging
Find the rule where the error occurred
Determine whether error occurred because
A rule fired when not supposed to
Modify the antecedent
Data examination
Comparing the patterns in the antecedent with the
elements in working memory
Antecedent patterns can be
Simple strings, complex graphs
Arbitrary pieces of code which can inspect WMEs
Matching
Searching selected rules and comparing their
antecedent patterns against selected data
Very time consuming
Careful selection can improve overall efficiency and
knowledge base organization
Execution
Fire the rule chosen by the scheduler
Execute the action specified in the consequent
Selection
All rules and data elements applicable at all times
Sample Run
Add the data element barometric pressure is
falling to wm from some external source and start
the interpreter
The interpreter notices that the condition of Rule
#1 is satisfied
barometric pressure is falling is present in wm
Sample Run
Interpreter notices that condition of Rule #2
is satisfied
it is going to rain today is in wm
Automatically Generated
Explanation
Suppose we allow commands of the form
HOW <string>
A Modified Interpreter
Basic mode of operation is to prove a
given premise
Premise is represented by some string
Premise is true if element is in wm
A Modified Interpreter
Given some initial premise to prove, the
interpreter will perform the following actions:
Check to see if premise is already in wm
If so, say premise is true and return
A Modified Interpreter
If no rules satisfy requirement then:
If the premise is the original premise, then tell the user that
the premise is false and return
Else, ask the user:
If the user answers true, then add element to wm
If the user answers false, dont
Return
Else, for the rule being pointed to, call the interpreter
recursively on each pattern in the antecedent
Each pattern in the antecedent is passed to the interpreter as
a premise to be proved in order of appearance
If all premises have been determined to be true
Fire the rule
If the element added to wm as a result of the rule firing is the
original premise, then inform the user that the premise is proven
Return
Else, try to find the next relevant rule and repeat the process
Sample Run
Start with an empty wm
Give the premise you should take a rain
coat to work to the interpreter to be proved
Recursion Level 0:
Interpreter checks to see if the element is
already in wm and notices that it is not
Places the rule pointer at Rule #1
Starting with Rule #1 it checks to see which
rule can conclude the given premise
Sample Run
Discovers that Rule #2 can conclude the
given premise and moves the poniter there
Interpreter called recursively with the
premise it is going to rain today
Recursion Level 1:
Interpreter checks to see if element it is
going to rain today is already in wm and
notices that it is not
Places pointer at Rule #1
Starting with Rule #1 checks to see which
rule can conclude the given premise
Sample Run
Discovers that Rule #1 can conclude the
given premise and leaves the pointer there
Interpreter called recursively with the
premise barometric pressure is falling
Recursion Level 2
Interpreter checks to see if element
barometric pressure is falling is already
in wm and notices that it is not
Places pointer at Rule #1
Starting with Rule #1 checks to see which
rule can conclude the given premise
Sample Run
Discovers that no rule can conclude the given premise
Since premise is not original (i.e., recursion level is not
0), interpreter asks the user:
Is it true that barometric pressure is falling?
Sample Run
Recursion Level 0
Since it is going to rain is found to be true,
fires Rule #2
you should take a rain coat to work is added to
wm
Model a system
If the system is observed to do B when A occurs,
this is modeled by the rule if A then B