DesignExpert-
Designing Backward Chaining Systems
Major tasks when developing a backward chaining system:
Define the problem
Define the goals
Define the goal rules
Expand the system
Refine the system
Design the interface
Evaluate the system
Example (Financial Planning)
A popular areas of Expert System applications:
the system offers real payoffs
the task is well-defined
real expert exists
many successful expert systems exist in financial counseling.
Objective: to develop an expert system to assist a financial counselor with providing an investment recommendation for a client.
Task1: Defining the Problem
source for starting the project: reports, documents and books.
Identify an expert 0 e.g. an investment advisor at a local firm.
Listen to the expert how he/she do her job.
During the problem definition stage of a project, do not interrupt the expert for problem details. Here you are looking for a general understanding of the problem and how it is solved. Details can be obtained during later discussion with the expert.
2.Defining the Goals
The coding of any backward-chaining system begins with defining the system's goal.
From the discussion with experts, obtain two principal goal:
Determine portfolio mixture
Determine investment vehicles within each category.
Only the first goal will be discussed.
For simplicity, assume that we consider only 4 kinds of portfolio:
Portfolio 1: 100% investment in savings
Portfolio 2: 60% stocks, 30% bonds, 10% savings
Portfolio 3: 20% stocks, 40% bonds, 40% savings
Portfolio 4: 100% investment in stocks
[Note: should focus the design of the initial system on a small but representative part of the overall problem]
We have 4
different goal, one for each portfolio, for the backward system. Can
write 4 different goal, or 1 variable goal.
Task3: Designing the Goal Rules
Each goal in the system must have a least one rule that can conclude it.
Rule: IF
Precondition_1 AND Precondition_2 AND ...
THEN Portfolio_i
Talk to domain expert about the process. Find out the factors that the expert use to make decision.
Useful to construct a decision table (if possible).
INVESTMENT |
PERSONAL |
FINANCIAL |
ADVICE |
---|---|---|---|
Small |
|
|
Portfolio 1 |
|
Conservative |
Conservative |
Portfolio 1 |
|
Conservative |
Aggressive |
Porfolio 2 |
|
Aggressive |
Conservative |
Portfolio 3 |
|
Aggressive |
Aggressive |
Portfolio 4 |
Use this table
to write up some rules:
IF Client's_investment_amount
< 10000
THEN Portfolio advice IS 100% investment in savings
IF Client's
personal state suggests a conservative position
AND Client's
financial state suggests a conservative position
THEN Portfolio
advice IS 100% investment in saving.
IF Client's
personal state suggests a conservative position
AND Client's
financial state suggests an aggressive position
THEN Portfolio
advice IS 60% stocks, 30% bonds and 10% savings
IF Client's
personal state suggests an aggressive position
AND Client's
financial state suggests a conservative position
THEN Portfolio
advice IS 20% stocks, 40% bonds and 40% savings
IF Client's
personal state suggests an aggressive position
AND Client's
financial state suggests an aggressive position
THEN Portfolio
advice IS 100% investment in stocks
You can encode these new knowledge into an expert system, using a shell.
Following the encoding of any new knowledge into the epxert system, you should immediately test it, using information specific to the new knowledge. (particularly important during the early stage of the project).
It is also possible to draw the inference network (or the AND-OR graph) for the rules that has been develop for easy referencing.
Order of search is also important. Usually, the system will explore the rules in a specific order. We can re-arrange the rules to change the order of search to match with the DE.
You also need to consider exhaustive search vs. non-exhaustive search. Whether to stop when any one solution found, or continue to find all possible solution.
The latter is particularly important when the system use numerical certainty factor (or belief factor).
e.g. Each
conservativeness/aggressiveness can have a certainty factor between
0 and 1, and the result also characterized by a certainty
factor:
PORTFOLIO RECOMMENDATION BELIEF
60% stocks, 30%
bonds, 10% saving 90%
100% investment in stocks 85%
20%
stock, 40% bonds, 40% savings 70%
100% investment in
savings 60%
Task4: Expanding the System
You can broaden or deepen the system's knowledge.
Broadening 0 teach it about additional issues.
E.g. teaching it about additional portfolio mixtures.
Fairy easy and usually reserved for later in the project.
Deepening 0 teach it more about issues it already knows about.
E.g. teach the system how to determine the present premises in our goal rules.
During the entire development of an expert system, one should be looking for premises that can be expanded deeper.
Ask whether the user can effectively answer the question posed by the system. If no, then add knowledge to the system that forces it to seek more primitive and reliable information. (e.g. quantitative answers).
The system has 3 issues that can be further expanded:
Client's investment amount
Client's personal state
Client's financial state
Repeat the above procedure, i.e. talk to DE, derive rules, and deepening of premises ....
Expand one issue at a time. This permits the expert to focus on a single issue and avoid problems commonly encountered when the expert is asked to address multiple issues.
E.g.
IF Client IS
old
OR Client's job IS not steady
THEN Client's personal state
suggests a conservative position
IF Client IS
young
AND Client's job is steady
AND Client's has
children
THEN Client's personal state suggests a conservative
position.
Avoid
using ELSE in rules.
E.g. IF Client_age <
40
THEN Client IS young
ELSE Client IS old
and
later if one decide to add a middle-age concept:
IF Client_age
< 50
AND Client_age >= 40
THEN Client IS middle-age
then problem will arises.
The resultant personal state and financial state network may look like:
The use of inference network or AND-OR graph allows easy identification of concepts that can/need to be deepened.
Task5: Refining the System
we now have a fully functional system that meets our initial objectives.
Can use
variables for numbers to make modification simpler.
E.g. can use
the variable OLD_AGE to store the age which is considered
old.
Initialize OLD_AGE=40
Rule:
IF Client_age
< OLD_AGE
THEN Client IS young...
provide safety net for the system û a course of action that the system takes if it fails to reach a recommendation.
Can be as complex as loading in anther knowledge base that will try to correct the situation.
Or simply displaying a message that recommendation not found.
Or provide an "intelligent safety net", such as why recommendation not found.
Providing Milestones
worthwhile to keep the user informed of the important finding during consultation.
E.g. after finding the personal state of the user, display it.
Task6: Interface Design
Each system should have an introductory display
at least tell the user about the overall purpose of the system
can also tell
the user a little about how the primary task is accomplished.
E.g.
When asking users to answer a question, details should be provided as what is expected from the user, possibly with an example.
Better to provide multiple choice questions if possible.
Conclusion display (final recommendation if found).
Task 7: System Evaluation
ask experts for one of his past cases and compare the result with the recommendation of the system.
Test with more cases.
Future Direction
broadening
recommending additional portfolios
recommending investment vehicles.
Example Session:
SYSTEM: Welcome
to ....
Please press RETURN to begin our session
USER: RETURN
SYSTEM: How much money in dollars does the client want to invest? Please enter the dollar amount without commas, e.g. 10000.
USER: 50000
SYSTEM: What is client's age
USER: 30
SYSTEM: How many years has the client been with the present company?
USER: 5
SYSTEM: Layoffs
at the organization are:
Low
High
USER: Low
[The user may have trouble with this question. May need deepening]
SYSTEM: The
client has
children
No children
USER: children
SYSTEM: After
considering the client's personal issues, I would suggest a
conservative position. I will next look into the client's
financial issues.
Please press RETURN to continue the session.
USER: RETURN
...
SYSTEM: I
would recommend the client invest the money in
60% stocks,
30% bonds, 10% savings.
The major reasons why I recommend
this investment is that I found the client's personal state
suggests a conservative position and financial state
suggests an aggressive position.
Designing Forward-Chaining Systems
Major tasks in designing a forward chaining system:
Define the problem
Define input data
Define data-driven structure
Write initial code
Test the system
Design the interface
Expand the system
Evaluate the system
Example: (Automobile Diagnostics Domain)
problem is better understood than problems such as design or scheduling.
Provide tangible benefits.
Most diagnostic problem use backward chaining approach, as most of the problem addressed had a finite number of possible faults. Each fault treated as a goal.
However, in many diagnostic problems, the number of possible fault conditions can be very large.
E.g. in automobile diagnostics, there are hundreds of possible fault condition, impractical to treat each fault as a goal.
The expert usually begins by gathering some initial information, reasons with it to pursue other important information, and finally, identifies the faulted automobile part.
Inherently data-driven and is best managed with a forward-chaining expert system.
Task1: Define the problem
information is obtained from the repair manual.
The manual usually provide a table or decision-tree to aid in the isolation of the faulty subsystem.
E.g. the problem "engine does not start"
Section 1
Starting Problem
Test |
Results |
Proceed to |
---|---|---|
1.1 Turn on the ignition |
If engine turns slowly or not at all |
2.1 Ranking system problems |
|
If engine turns normally |
1.2 |
...
Task2: Define Input Data
every forward system needs to first obtain some initial data to get started.
Need to write a rule whose only task is to ask for some information about the problem û startup rules.
This rule is written to automatically fire when the system starts. When it fires, it asks fro problem information.
E.g.
Rule
1 Start Diagnosis
IF Task IS Begin
THEN ASK Car question.
Ask the user to
select from a list of car problems, such as
Car won't start
Car hesitates at high speeds
Car idles rough
Task3: Define Data-driven Structure
Modify the forward structure to include task information
e.g.
IF
Task is test battery condition
AND Lights don't
brighten
THEN Task is test battery
Using a rule of this form, the rule will only fire if the rule is relevant to the current task.
This is similar to grouping the rules.
Task4: Write Initial Code
the purpose is to determine if we have effectively captured the problem's knowledge in a good rule structure.
A good structure is one that not only provides correct results, but also a template to follow in the development of other rules. (e.g. the rules structure described above).
Example:
Rule
1 Start Diagnosis
IF Task IS begin
THEN ASK Car Problem
Rule 2 Car won't
start
IF Car problem IS won't start
THEN Task IS test cranking
system
Rule 3 Car
hesitates at high speed
IF Car problem IS hesitate at high
speeds
THEN Task IS test fuel system.
Rule 4 Step 1.1 -
test the cranking system
IF Task IS test cranking system
THEN ASK
Engine turns
...
Task5: Test the System
Assume that "Task IS begin" is initialized into the WM by the system.
A typical dialogue looks like:
SYSTEM: What is the
problem with the car?
- won't start
- hesitates at high speed
...
USER: won't start
SYSTEM: Please turn
on the ignition.
How does the engine turn?
- Slowly or not at
all
- normally
USER: not at all
...
Task6: Design the Interface
begin the development of the system's interface early in the project and develop it in parallel with the development of the system's knowledge base.
For example, use of graphical interface familiar to the user, say, one that is similar to the car front panel.
You should bear in mind that the system will most likely be used by someone not familiar with a computer.
Task7: Expand the System
include more faults into the system.
Task8: Evaluate the System
Work directly with the manual for initial testing
Work with expert
Finally, real test cases.