Case based reasoning

40
Case Based Reasoning PKB - Antonie

Transcript of Case based reasoning

Page 1: Case based reasoning

Case Based Reasoning

PKB - Antonie

Page 2: Case based reasoning

Faced this situation before?

• Oops the car stopped. – What could have gone wrong?

• Aah.. Last time it happened, there was no petrol. – Is there petrol?

• Yes.

– Oh but wait I remember the tyre was punctured (ban bocor)

• This is the normal thought process of a human when faced with a problem which is similar to a problem he/she had faced before.

Page 3: Case based reasoning

How do we solve problems?

• By knowing the steps to apply – from symptoms/gejala to a plausible diagnosis

• But not always applying causal knowledge

– sebab - akibat

• How does an expert solve problems?– uses same “book learning” as a novice– but quickly selects the right knowledge to apply

• Heuristic knowledge (“rules of thumb”)– “I don’t know why this works but it does and so I’ll use it again!”

– difficult to elicit

Page 4: Case based reasoning

So what?

• Reuse the solution experience when faced with a similar problem.

• This is Case Based Reasoning (CBR)!– memory-based problem-solving– re-using past experiences

• Experts often find it easier to relate stories about past cases than to formulate rules

Page 5: Case based reasoning

What’s CBR?

• To solve a new problem by remembering a previous similar situation and by reusing information and knowledge of that situation

• Ex: Medicine– doctor remembers previous patients especially for rare

combinations of symptoms

• Ex: Law– English/US law depends on precedence– case histories are consulted

• Ex: Management– decisions are often based on past rulings

• Ex: Financial– performance is predicted by past results

Page 6: Case based reasoning

Definitions of CBR

• Case-based reasoning is […] reasoning by remembering - Leake, 1996

• A case-based reasoner solves new problems by adapting solutions that were used to solve old problems - Riesbeck & Schank, 1989

• Case-based reasoning is a recent approach to problem solving and learning […] - Aamodt & Plaza, 1994

Page 7: Case based reasoning

History

• Roots of CBR is found in the works of Roger Shank on dynamic memory.

• Other trails into the CBR field has come from– Analogical reasoning

– Problem solving and experimental learning within philosophy and psychology

• The first CBR system, CYRUS developed by Janet Kolodner at Yale university.

Page 8: Case based reasoning

The Limitations of Rules

• The success of rule-based expert systems is due to several factors:– They can mimic some human problem-solving

strategies– Rules are a part of everyday life, so people can relate

to them

• However, a significant limitation is the knowledge elicitation bottleneck– Experts may be unable to articulate their expertise

• Heuristic knowledge is particularly difficult

– Experts may be too busy…

Page 9: Case based reasoning

CBR Cycle

Page 10: Case based reasoning

R4 Cycle

REUSEREUSEpropose solutions from retrieved cases

REVISEREVISEadapt and repair

proposed solution

CBRCBR

RETAINRETAINintegrate in

case-base

RETRIEVERETRIEVEfind similar problems

Page 11: Case based reasoning

CBR System 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)

Page 12: Case based reasoning

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

• (e.g., it helps to remember how you found a parking space near that restaurant)

Page 13: Case based reasoning

Two big tasks of CBR

• 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

Page 14: Case based reasoning

Technical Diagnosis of Car Faults

Page 15: Case based reasoning

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

Page 16: Case based reasoning

Problem to be solved

Page 17: Case based reasoning

How CBR solves problems

• New problem can be solved by– retrieving similar problems– adapting retrieved solutions

• Similar problems have similar solutions

?

SSS

SS S

SS S

PP

PPPP

P

PP

X

Page 18: Case based reasoning

CBR Knowledge Containers• Cases

– lesson to be learned– context in which lesson applies

• Description Language– features and values of problem/solution

• Retrieval Knowledge– features used to index cases– relative importance of features used for similarity

• Adaptation Knowledge– circumstances when adaptation is needed– alteration to apply

Page 19: Case based reasoning

Corporate Memory• Cases from database, archive, . . .

• Issues– case bias? coverage?– description language e.g. agreement on terms

• Case-base cannot contain all formulations– good coverage– prototypical and exceptional cases

• Opportunity for multiple sources– shared knowledge across companies

Page 20: Case based reasoning

New Car Diagnosis Problem

• A new problem is a case without a solution part

• Not all problem features must be known– same for cases– Problem

• Symptom: brakelight does not work• Car: Ford Fiesta

• Year: 1997

• Battery: 9.2v

• Headlights: undamaged• HeadlightSwitch: ?

Feature Value

New

Page 21: Case based reasoning

• Compare new problem to each case• Select most similar

• Similarity is most important concept in CBR– When are two cases similar?– How are cases ranked according to similarity?

• Similarity of cases – Similarity for each feature

• Depends on feature values

Retrieving A Car Diagnosis Case

New Problem Case

Ca

se

Case

Ca

se

Case

Ca

se

Case

Ca

se 1Similar?

Page 22: Case based reasoning

Similarity Computation for case 1

Figure Credit: R. Bergmann, University of Kaiserslautern

Page 23: Case based reasoning

Similarity Computation for case 2

Figure Credit: R. Bergmann, University of Kaiserslautern

Page 24: Case based reasoning

Similarity Measurement

• Purpose: To select the most relevant case• Basic Assumption: Similar problems have similar

solutions• Similarity value between 0 and 1 are assigned

for feature value pairs• E.g.: Feature: ProblemFront Light does not work

Break Light does not work .8

Front Light does not work

Engine doesn’t start.4

Page 25: Case based reasoning

Similarity Measurement

• Feature: Battery Voltage

• Different features have different importance

• Two kinds of Similarity Measures– Local Similarity – similarity on feature level– Global Similarity - similarity on case or object

level

12.6 13.6 12.6 6.7.9 .1

Page 26: Case based reasoning

Calculating Feature Similarity• Distances between values of individual features

– problem and case have values p and c for feature f

– Distance for Numeric features

• df(problem,case) = |p - c|/(max difference)

– Distance for Symbolic features

• df(problem,case) = 0 if p = c = 1 otherwise

• Similarityf(problem,case) = 1 - d

• Degree of similarity is between 0 and 1

Page 27: Case based reasoning

Reuse Solution from Case 1

New Problem• Symptom: brakelight does not work

• Car: Ford Fiesta• Year: 1997

• Battery: 9.2v

• Headlights: undamaged• HeadlightSwitch: ?

Problem• Symptom: headlight does not work• …

Solution

• Diagnosis: headlight fuse blown• Repair: replace headlight fuse

– Solution to New Problem• Diagnosis: headlight fuse blown• Repair: replace headlight fuse

– After Adaptation• Diagnosis: brakelight fuse blown• Repair: replace brakelight fuse

Case 1

Page 28: Case based reasoning

Matching strings

• exact match: two strings are similar if they are spelled the same way

• spelling check: compares the number of letters which are the same in two strings (Useful for strings consisting of one word only)

• word-count: counts the number of matching words of two cases. (Useful for strings consisting of several words).

Page 29: Case based reasoning

Indexing: Why do we want an index?

• Efficiency– if similarity matching

is computationally expensive

• Relevancy of cases for similarity matching

• Cases are pre-selected from case-base

High Low

200

0

100

300

Page 30: Case based reasoning

What to index?

Client Ref #: 64Client Name: John SmithAddress: 39 Union StreetTel: 01224 665544Photo:

Age: 37Occupation: IT AnalystIncome: £ 20000…

Unindexed features

Indexed features

Case Features are:- Indexed - Unindexed

Page 31: Case based reasoning

High Low

200

0

100

300

Decision Trees as an Index

Solubility?

Dose??

?

?

?

low high

<200 >200

Page 32: Case based reasoning

Re-Using Retrieved Solutions

• Single retrieved solution– Re-use this solution

• Multiple retrieved solutions– Vote/average of retrieved solutions

• Weighted according to– Ranking– Similarity

• Iterative retrieval– Solve components of the solution one at a

time

Page 33: Case based reasoning

How to Adapt the Solution

• Adaptation alters proposed solution:• Null adaptation - copy retrieved solution

– Used by CBR-Lite systems

• 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

Page 34: Case based reasoning

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

• Generative– replays the method of deriving the retrieved solution

on the new problem– most complex form of adaptation

Page 35: Case based reasoning

Examples of Adaptation

• CHEF – CBR system to plan Szechuan recipes

• Hammond (1990)

• 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

Page 36: Case based reasoning

Examples of Adaptation

• Car diagnosis example– Symptoms, faults and repairs for brake lights

are analogous to those for headlight– Substitution: brake light fuse

• Planning example– Train journeys and flights are analogous– Transformation: flights need check-in step

added

Page 37: Case based reasoning

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?

Page 38: Case based reasoning

Pros & Cons of CBR• Advantages

– solutions are quickly proposed• derivation from scratch is avoided

– domains do not need to be completely understood– cases useful for open-ended/ill-defined concepts– highlights important features

• Disadvantages– old cases may be poor– library may be biased– most appropriate cases may not be retrieved– retrieval/adaptation knowledge still needed

Page 39: Case based reasoning

CBR Tool

C4.5 Index

K Nearest NeighbourSimilarityMatching

prog

ress

of r

etrie

val

Database

Relevant Cases

Most SimilarCases

Vote

Tcl for adaptation

Gshadg hjshfdfhdjf hjkdhfs hjdshfl

hfdjsfhdjs hjdhfl hsdfhlhd hdjsh hjsdkh hfds hhfkfd shkGshadg hjshfd

fhdjf hjkdhfs hjdshflhfdjsfhdjs hjdhfl hsdfhl

hd hdjsh hjsdkh hfds hhfkfd shk

Page 40: Case based reasoning

CBR Resources

• Books– I. Watson. Applying Knowledge Management: Techniques For

Building Corporate Memories. Morgan Kaufmann, 2003.– I. Watson. Applying Case-Based Reasoning: Techniques for

Enterprise Systems. Morgan Kaufmann, 1997.• CBR on the web

– http://groups.yahoo.com/group/case-based-reasoning/ • CBR Commercial Solutions

– Orenge from www.empolis.com– Kaidara Adviser from (www.kaidara.com)– eGain (www.egain.com)

• Customer Service & Contact Centre Software

• CBR Tools in our School– CBR-Works from www.empolis.com– ReCall from www.isoft.fr– Weka from www.cs.waikato.ac.nz