Knowledge Representation
and
Expert Systems
by
Sujan Pakala Stephen Brown
What are they?
Diagnose a problems in a given domain
Capable of justifying its actions and
conclusions
Applications:
Medical diagnosis applications
Locating equipment failures
Interpreting measurement data
Structure of Expert System
User
Shell
User
Interface
Major Components:
• Knowledge Base
Inference • Inference Engine
Engine
• User Interface
The Shell contains the inference
Knowledge engine and the user interface.
Base
Expert System Features
Goal driven reasoning or backward
chaining
Data driven reasoning or forward chaining
Coping with uncertainty
Data representation
User interface
Generating Explanations
If – then Rules
Most popular formalism for knowledge representation
Additional features
- modularity
- incrementability
- modifiability
- transparency
categorical vs. probabilistic knowledge
knowledge elicitation
Example – refer figure.
Knowledge base as an Inference Network
Kitchen_dry
Leak_in_bathroom
Hall_wet
Problem_in_kitchen
Bathroom_dry
Leak_in_kitchen
Window_closed
No_water_from_outside
No_rain
Backward chaining
Follow a chain of rules backwards
Stating rules into knowledgebase:
- as straightforward prolog rules –
hall_wet.
bathroom_dry.
leak_in_bathroom :-
hall_wet, kitchen_dry.
Contd..
Disadvantage
- not suited for normal user
- hence, not syntactically distinct
Better way:
- use ‘if’, ‘then’ etc. as operators-
:-op(800, fx, if)
- and write the rules as-
if hall_wet and kitchen_dry then leak_in_bathroom.
Major disadvantage:
- user has to state all relevant info.
Forward chaining
Generating Explanations
Has the ability to explain its results.
Two types of explanations:
how the system reached a given
conclusion
why the system is asking a question
Coping with Uncertainty
Much of the time, the final answer is not
known with complete certainty.
We can model uncertainty by assigning some
qualification or measure of belief factor.
In our knowledge base, we can add a
certainty factor to our conclusions:
if
hall_wet and bathroom_dry
then
problem_in_kitchen : 0.9.
Example:
User specifies certainty estimates:
given(hall_wet, 1). % Hall is wet
given(bathroom_dry, 1). % Bathroom is dry
given(kitchen_dry, 0). % Kitchen is not dry
given(no_rain, 0.8). % Probably no rain, but not
sure
given(window_closed, 0). % Window not closed
Continue Example:
An interpreter for rules with certainties:
certainty(P, Cert) :-
given(P, Cert).
certainty(Cond1 and Cond2, Cert) :-
certainty(Cond1, Cert1),
certainty(Cond2, Cert2), ?- certainty( leak_in_kitchen, C).
minimum(Cert1, Cert2, Cert). C = 0.8
certainty(Cond1 or Cond2, Cert) :-
certainty(Cond1, Cert1),
Obtained:
certainty(Cond2, Cert2), hall is wet & bathroom is dry
maximum(Cert1, Cert2, Cert). problem in the kitchen : 0.9
certainty(P, Cert) :-
Possibility of some rain
if Cond then P : C1,
no water from outside : 0.8
certainty(Cond, C2),
Cert is C1 * C2. Leak in kitchen is min(.8, .9) = 0.8
Demo
http://www.visual-prolog.com/vipexamples/geni/pdcindex.htm
Questions?
Summary
Expert System’s typical functions:
• Solving problem in a given domain
• Explaining the problem-solving process
• Handling uncertainty and incomplete information