310 likes | 465 Views
CS26110 AI Toolbox. Case-based reasoning. A scenario. You can’t get a computer game to install on your PC What do you do?. P. P. P. P. P. P. P. P. P. S. S. S. S. S. S. S. S. S. How CBR solves problems. New problem can be solved by Retrieving similar problems
E N D
CS26110AI Toolbox Case-based reasoning
A scenario... • You can’t get a computer game to install on your PC • What do you do?
P P P P P P P P P S S S S S S S S S How CBR solves problems • New problem can be solved by • Retrieving similar problems • Adapting retrieved solutions • Similar problems have similar solutions ? X
Databases • Database technology would seem ideally suited to the task of retrieving known solutions to problems • Databases are excellent at finding exact matches… but are poor at near or ‘fuzzy’ matches
CBR assumption(s) • The main assumption is that: • Similar problems have similar solutions: • e.g., an aspirin can be taken for any mild pain • Two other assumptions: • The world is a regular place: what holds true today will probably hold true tomorrow • (e.g., if you have a headache, you take aspirin, because it has always helped) • Situations repeat: if they do not, there is no point in remembering them
Problems we solve this way • Medicine • Doctors remember previous patients, especially for rare combinations of symptoms • Law • English/US law depends on precedence • Case histories are consulted • Management • Decisions are often based on past rulings • Financial • Performance is predicted by past results
What CBR can do • Classification tasks (good for CBR) • Diagnosis - what type of fault is this? • Prediction / estimation - what happened when we saw this pattern before? • Synthesis tasks (harder for CBR) • Engineering Design • Planning • Scheduling
New case CBR Cycle Retrieve Matched cases Matched cases matching Matched cases Learn Case base Knowledge and Adaptation rules Retain Reuse no Adapt? yes Closest case Revise Suggest solution
CBR components • Case-base • Database of previous cases (experience) • Retrieval of relevant cases • Index for cases in library • Matching most similar case(s) • Retrieving the solution(s) from these case(s) • Adaptation of solution • Alter the retrieved solution(s) to reflect differences between new case and retrieved case(s)
Case representation • Flat feature-value list • Object Oriented representation • Graph representation • The choice of representation is • Dependent on requirements of domain and task • Structure of already available case data
New case CBR Cycle Retrieve Matched cases Matched cases matching Matched cases Learn Case base Knowledge and Adaptation rules Retain Reuse no Adapt? yes Closest case Revise Suggest solution
Retrieval • Similarity measurement • Purpose: To select the most relevant case • Distances between values of individual features • Problem and case have values p and c for feature f • Distance for numeric features • E.g., d(problem,case) = |p - c|/(max difference) • Distance for symbolic features • d(problem,case) = 0 if p = c = 1 otherwise
What to index? Client Ref #: 64 Client Name: John Smith Address: 39 Union Street Tel: 01224 665544 Photo: Age: 37 Occupation: IT Analyst Income: £ 20000 … • Case Features are: • Indexed • Unindexed Unindexed features Indexed features
CBR example: Property pricing Test instance
Matching • Comparing test instance • distance(5,1) = 3 • distance(5,2) = 3 • distance(5,3) = 4 • distance(5,4) = 5 • Estimate price of case 5 is £25,000
New case CBR Cycle Retrieve Matched cases Matched cases matching Matched cases Learn Case base Knowledge and Adaptation rules Retain Reuse no Adapt? yes Closest case Revise Suggest solution
Reusing retrieved solutions • Single retrieved solution • Reuse this solution • Multiple retrieved solutions • Vote/average of retrieved solutions • Weighted according to: ranking, similarity...
How to revise the solution • Adaptation alters proposed solution: • Manual or interactive adaptation • User adapts the retrieved solution (adapting is easier than solving?) • Automated adaptation • CBR system is able to adapt the retrieved solution • Adaptation knowledge required
Automated adaptation methods • Substitution • Change some part(s) of the retrieved solution • Simplest and most common form of adaptation • Transformation • Alters the structure of the solution
Examples of adaptation • CHEF: CBR system to plan Szechuan recipes • Substitution adaptation • Substitute ingredients in the retrieved recipe to match the menu • Retrieved recipe contains beef and broccoli • New menu requires chicken and snowpeas • Replace chicken for beef, snowpeas for broccoli • Transformation adaptation • Add, change or remove steps in the recipe • Skinning step added for chicken, not done for beef
CBR example: Property pricing Test instance
How adaption rules are generated • There is no unique way of doing it. Here is one possibility: • Examine cases and look for ones that are almost identical • case 1 and case 2 • Rule 1: If recep-rooms changes from 2 to 1 then reduce price by £5,000 • case 3 and case 4 • Rule 2: If Type changes from semi to terraced then reduce price by £7,000
Adapting • Reverse Rule 2 • If type changes from terraced to semi then increase price by £7,000 • Apply reversed Rule 2 • New estimate of price of property 5 is £32,000
New case CBR Cycle Retrieve Matched cases Matched cases matching Matched cases Learn Case base Knowledge and Adaptation rules Retain Reuse no Adapt? yes Closest case Revise Suggest solution
Retention • What can be learned • New experience to be retained as new case • Representing the new case • Contents of new case • Indexing of new case • Forgetting cases • For efficiency or because out of date • Deleting an old case • Old is not necessarily bad • Does it leave a gap?
CBR example: Property pricing Test instance
Learning • So far we have a new case and an estimated price • Nothing is added yet to the case base • If later we find house sold for £35,000 then the case would be added • Could add a new rule • If location changes from 8 to 7 increase price by £3,000
Impact on business at Microsoft • Within 9 months of introducing a CBR system at Microsoft’s call centre in Glasgow, Microsoft reported: • 10% increase in customer satisfaction rating • 28% increase in “first-time-fix” success rate • A significant reduction in the time required to train new agents • More consistent responses delivered by agents, regardless of the problem
Issues for CBR • How should cases be represented? • How should cases be indexed for fast retrieval? • How can good adaptation heuristics be developed? • When should old cases be removed?
Pros and cons • Advantages • Solutions are quickly proposed - derivation from scratch is avoided • Knowledge is in a form understandable to humans • Domains do not need to be completely understood • Cases useful for open-ended/ill-defined concepts • Disadvantages • Old cases may be poor • Library may be biased • Most appropriate cases may not be retrieved • Retrieval/adaptation knowledge still needed
CBR for game AI • Imitating a RoboCup Soccer Player Using Case-Based Reasoning • http://www.youtube.com/watch?v=zNjyXLWVSWI • CBR for Game AI, Google Tech Talk • http://www.youtube.com/watch?v=s9G7DRTuB5s