400 likes | 585 Views
NO SIGNAL. YES SIGNAL. Designing Backward-Chaining Rule-Based Systems. 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
E N D
NO SIGNAL YES SIGNAL
Designing Backward-Chaining Rule-Based Systems 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
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
General Design Methodology for BC Systems Phase 1 Assessment • A highly iterative process • Major tasks in developing: • Define the problem • Define the goals • Define the goal rules • Expand the system • Refine the system • Design the interface • Evaluate the system Requirements Phase 2 Knowledge Acquisition Exploration Knowledge Phase 3 Design Refinements Structure Phase 4 Test Evaluation
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.
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!
Define the problem Task 1
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: Preferred, Blue Chip, Common • BONDS: Treasury, Corporate, Municipal • MUTUAL FUNDS: Income, Bonds, Stock • SAVINGS: CD, Money Market, Saving Account • COMMODITIES: Agricultural, Prec. Metal, Oil • REAL ESTATE: Commercial, Residential, Land
Task 1: Defining the task • Problem Solving Approach: Mixture Advice Vehicle Advice Design Suggestion: 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. Client Wants Advice On How To Invest Expert Suggests Mixture Of Investment Vehicles Expert Suggests Specific Investment Vehicles
Define the goals Task 2
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 discussedand 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.
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 backward system. • Can write 4 different goal, or 1 variable goal. Design Suggestion: Focus the design of the initial system on a small but representative part of the overall problem.
Designing the Goal Rules Task 3
Task3: Designing the Goal Rules • Sample Dialogue:
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 Precondition1AND Precondition2AND ...THENPortfolioi • Each goal in the system must have a least one rule that can conclude it.
Designing the Goal Rules (cont’d) • Find out decision factors (principal issues to be considered): • Client’s Personal States (Conservative or Aggressive) • Client’s Financial States (Conservative or Aggressive) • Amount to Invest (Small or Large) • A technique to show relationship between factors and recommendations: • Decision Table • Easy to fill out • Easy to find gaps
Designing the Goal Rules (cont’d) • Decision Table as the result of the conversation
Designing the Goal Rules (cont’d) • Writing the acquired knowledge (using the tables) as rules gives: • IF Client‘s investment amount < 10000THENPortfolio advice IS 100% investment in savings • IF Client's personal state suggests a conservative positionAND Client's financial state suggests a conservative positionTHENPortfolio advice IS 100% investment in saving. • IF Client's personal state suggests a conservative positionAND Client's financial state suggests an aggressive positionTHENPortfolio advice IS 60% stocks, 30% bonds and 10% savings • IF Client's personal state suggests an aggressive positionAND Client's financial state suggests a conservative positionTHENPortfolio advice IS 20% stocks, 40% bonds and 40% savings • IF Client's personal state suggests an aggressive positionAND Client's financial state suggests an aggressive positionTHENPortfolio advice IS 100% investment in stocks
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).
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 ofexpansion of system • The use of inference network or AND-OR graph allows easy identification of concepts that can/need to be deepened.
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 BELIEF60% stocks, 30% bonds, 10% saving 90%100% investment in stocks 85%20% stock, 40% bonds, 40% savings 70%100% investment in savings 60%
Expanding the System Task 4
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.
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 ....
Expanding the System (cont’d) • Expanding Personal Issue after another discussion with Expert: • IF Client IS oldORClient's job IS not steady THENClient's personal state suggests a conservative position • IF Client IS youngAND Client's job is steadyAND Client's has childrenTHEN Client's personal state suggests a conservative position. What is Steady? Who is Young? 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.
Expanding the System (cont’d) • Expanding Age to have a clear definition of Young and Old: • IF Client_age< 40THEN Client IS youngELSE Client IS old • And later if one decide to add a middle-age concept then problem will arises. • IF Client_age< 50AND Client_age>= 40THEN Client IS middle-age Design Suggestion: Avoid Else statements whenever possible!
Expanding the System (cont’d) • The resultant personal state and financial state network may look like:
Refining the System Task 5
Task5: Refining the System • we now have a fully functional system that meets our initial objectives! • Now it’s time for optimizationsbefore advancing: • Using variables for numbers (just like const is C language!) e.g. • Initialize OLD_AGE=40 • Rule: • IFClient_age< OLD_AGETHEN Client IS young...
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.
Interface Design Task 6
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.
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!
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.
System Evaluation Task 7
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.
Future Direction No More Tasks!
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 Client‘s investment amount < 10000THENPortfolio advice IS 100% investment in savingsANDInvestment category IS savingsANDSaving_percentage = 100
Any Thank You?! Even most rigid topics can become lovable, if lectured in a fancy way! --RH.