Designing Backward-Chaining Rule

advertisement
YES
NO SIGNAL
Hossein Kaffash Bokharaei
Aideen NasiriShargh
26/09/1386
Dr. John Durkin
Outline
 Introduction (to Design, BC and what is named Designing BCRBS)
 General Design Methodology for BC Systems
 Financial Planning Domain
 Task 1: Defining the Problem
 Task 2: Defining the Goals
 Task 3: Designing the Goal Rules
 Task 4: Expanding The System
 Task 5: Refining The System
 Task 6: Interface Design
 Task 7: System Evaluation
 Future Directions
3
Introduction
 Backward Chaining
 A known method of inference, introduced by Miss
Noori a few minutes ago.
 Chapter 8 of the Book
 Introducing a real ES design!

In the very detailed way (even coding and interface!)
 BC is just a short reason, it’s more about the Design
 Gives good sight, altogether
4
General Design Methodology for BC Systems
 A highly iterative process
 Major tasks in developing:
1. Define the problem
2. Define the goals
3. Define the goal rules
4. Expand the system
5. Refine the system
6. Design the interface
7. Evaluate the system
Phase 1
Assessment
Requirements
Phase 2
Knowledge
Acquisition
Exploration
Knowledge
Phase 3
Design
Refinements
Phase 4
Test
Evaluation
Structure
5
Example: Financial Planning Domain
 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.
6
Financial Planning Domain (cont’d)
 Backward Chaining is widely used in this area:
 Solutions of these problems fit into a finite number of
independent sets
 Though, large amount of information that the expert
considers, there are only a few possible decisions that are
made.
 Small set of hypotheses to be proven → nature of BC!
7
Task 1
8
Task1: Defining the Problem
 Source for starting the project:
 reports, documents and books.
 Identify an expert e.g. an investment advisor at a local firm.
 Listen to the expert how he/she do her job.
 Example
 Classification of investment vehicles:






STOCKS:
BONDS:
MUTUAL FUNDS:
SAVINGS:
COMMODITIES:
REAL ESTATE:
Preferred, Blue Chip, Common
Treasury, Corporate, Municipal
Income, Bonds, Stock
CD, Money Market, Saving Account
Agricultural, Prec. Metal, Oil
Commercial, Residential, Land
9
Task 1: Defining the task
 Problem Solving Approach:
Mixture Advice
User Data
Client Wants Advice
On How To Invest
Portfolio
Mixture
Vehicle Advice
Specific
Vehicles
Design Suggestion: During the problem
definition
stage of a project, do not
Expert Suggests Mixture
Expert Suggests Specific
interrupt
the expert
for problem
details.
Of Investment
Vehicles
Investment
Vehicles
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.
10
Task 2
11
Task 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 and the second
one could be managed in a future revision of the
system.
 Portfolio: a distribution of the investment money into
one or more of the general investment categories.
12
Task 2: Defining the Goals (Cont’d)
 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
 We have 4 different goal, one for each portfolio, for the
Design Suggestion: Focus the
backward system.
design of the initial system on a
 Can write 4 different goal, small
or 1 variable
goal. part of
but representative
the overall problem.
13
Task 3
14
Task3: Designing the Goal Rules
 Sample Dialogue:
15
Designing the Goal Rules (cont’d)
 Talk to domain expert about the process. Find out the
factors that the expert use to make decision.
 Make Rules like:
IF
Precondition1
AND Precondition2
AND ...
THEN Portfolioi
 Each goal in the system must have a least one rule that
can conclude it.
16
Designing the Goal Rules (cont’d)
 Find out decision factors (principal issues to be
considered):
Client’s Personal States (Conservative or Aggressive)
2. Client’s Financial States (Conservative or Aggressive)
3. Amount to Invest (Small or Large)
1.
 A technique to show relationship between factors and
recommendations:
 Decision Table


Easy to fill out
Easy to find gaps
17
Designing the Goal Rules (cont’d)
 Decision Table as the result of the conversation
INVESTMENT
AMOUNT
PERSONAL
STATE
FINANCIAL
STATE
Small
ADVICE
Portfolio 1
Conservative
Conservative
Portfolio 1
Conservative
Aggressive
Porfolio 2
Aggressive
Conservative
Portfolio 3
Aggressive
Aggressive
Portfolio 4
18
Designing the Goal Rules (cont’d)
 Writing the acquired knowledge (using the tables) as rules gives:

IF
THEN
Client‘s investment amount < 10000
Portfolio advice IS 100% investment in savings

IF
AND
THEN
Client's personal state suggests a conservative position
Client's financial state suggests a conservative position
Portfolio advice IS 100% investment in saving.

IF
AND
THEN
Client's personal state suggests a conservative position
Client's financial state suggests an aggressive position
Portfolio advice IS 60% stocks, 30% bonds and 10% savings

IF
AND
THEN
Client's personal state suggests an aggressive position
Client's financial state suggests a conservative position
Portfolio advice IS 20% stocks, 40% bonds and 40% savings

IF
AND
THEN
Client's personal state suggests an aggressive position
Client's financial state suggests an aggressive position
Portfolio advice IS 100% investment in stocks
19
Designing the Goal Rules (cont’d)
 You can encode these new knowledge into an expert
system, using a shell.
 It is also possible to draw the inference network (or the
AND-OR graph) for the rules that has been develop for
easy referencing.
Design Suggestion: Following the
encoding of any new knowledge into the
expert system, you should immediately
test it, using information specific to the
new knowledge. (particularly important
during the early stage of the project).
20
Designing the Goal Rules (cont’d)
 Inference Network (AND-OR Graph)
 You can show it to
expert to confirm it
 Use it as a record of
expansion of system
 The use of inference
network or AND-OR
graph allows easy
identification of concepts
that can/need to be deepened.
21
Designing the Goal Rules (cont’d)
 Order of search is also important.
 Usually, the system will explore the rules in a specific order.
 We can re-arrange the order of search to match with the DE.
 Exhaustive (stopping) search vs. non-exhaustive search.
 Whether to stop when any one solution found, or continue to
find all possible solution.
 It is particularly important when the system use
numerical certainty factor (or belief factor).
 Multi-Valued Portfolio Advice
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%
22
Task 4
23
Task4: Expanding the System
 You can broaden or deepen the system's knowledge.
 Broadening: teach it about additional issues.
 e.g. teaching it about additional portfolio mixtures.
 Fairy easy and usually reserved for later in the project.
 Deepening: 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.
24
Expanding the System (cont’d)
 Why Expanding?
 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).
 SYSTEM: Does the client’s personal state suggest a
conservative position?
 The system has 3 issues that can be further expanded:



Client's investment amount (simple quantitative question, no need
to expand)
Client's personal state (?)
Client's financial state (?)
 Repeat the above procedure, i.e. talk to DE, derive rules,
and deepening of premises ....
25
Expanding the System (cont’d)
 Expanding Personal Issue after another discussion with Expert:

IF
OR
THEN
Client IS old
What
is IS not steady
Client's
job
Steady?
Client's
personal state suggests a conservative position

IF
AND
AND
THEN
Client IS young
Client's job is steadyYoung?
Client's has children
Client's personal state suggests a conservative position.
Who is
Design Suggestion: 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.
26
Expanding the System (cont’d)
 Expanding Age to have a clear definition of Young and Old:

IF
THEN
ELSE
Client_age < 40
Client IS young
Client IS old
Design Suggestion: Avoid Else
statements whenever possible!
 And later if one decide to add a middle-age concept then problem will arises.

IF
AND
THEN
Client_age < 50
Client_age >= 40
Client IS middle-age
27
Expanding the System (cont’d)
 The resultant personal state and financial state network may look like:
28
Task 5
29
Task5: Refining the System
 we now have a fully functional system that meets our
initial objectives!
 Now it’s time for optimizations before advancing:
 Using variables for numbers (just like const is C
language!) e.g.

Initialize OLD_AGE=40
 Rule:
 IF
THEN
Client_age < OLD_AGE
Client IS young...
30
Refining the System (cont’d)
 Optimizations (cont’d):
 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.
31
Task 6
32
Task 6: 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.
33
Interface Design (cont’d)
 Tailored Questions: When asking users to answer a
question, details should be provided as what is
expected from the user, possibly with an example.
 SYSTEM: Total_asset?

Real confusion! User would think ‘what does it mean?!’, ‘What
assets do I consider?’, ‘Do I enter the amount in dollars?’, ‘Do I
use commas when entering the number?’…
 SYSTEM: Please give the total dollar amount of assets
that the client owns include holdings in such items as
bank accounts, stocks, bonds, real estate, etc. Please
enter the dollar amount without commas, e.g., 150000.

Nice and clear!
34
Interface Design (cont’d)
 Better to provide multiple choice questions if possible.
 Conclusion display (final recommendation if found).
 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.
 Ending the session
 System: To exit the system press F10. If you would
like to restart the session press F3.
35
Task 7
36
Task 7: System Evaluation
 As number of combinations of the inputs grows,
testing all possible inputs are almost impossible!
 Ask experts for one of his past cases and compare the
result with the recommendation of the system.
 Test with more cases.
 Chapter 18 provides details on selecting test cases for
evaluating an ES.
37
No More Tasks!
38
Future Direction
 Broadening
 Recommending additional portfolios

New values (more detailed and closer) for known factors:
 Slightly conservative, Moderately conservative and Very
conservative provides a wider range of choices/combinations
 Recommending investment vehicles

IF
THEN
AND
AND
Client‘s investment
Portfolio advice IS
Investment category
Saving_percentage =
amount < 10000
100% investment in savings
IS savings
100
39
Even most rigid topics can become lovable, if lectured in a fancy way!
--RH.
40
Download