28
Case Based Reasoning Lecture 2: CBR Case Retrieval

Lecture 2: CBR Retrieval

Embed Size (px)

Citation preview

Page 1: Lecture 2: CBR Retrieval

Case Based Reasoning

Lecture 2: CBR Case Retrieval

Page 2: Lecture 2: CBR Retrieval

Outline

Case Representation Nearest Neighbour Retrieval

Calculating similarity Similarity in CBR-Works Reading

Page 3: Lecture 2: CBR Retrieval

R4 Cycle

REUSEpropose solutions from retrieved cases

REVISEadapt and repair

proposed solution

CBR

RETAINintegrate in

case-base

RETRIEVEfind similar problems

Page 4: Lecture 2: CBR Retrieval

CBR Assumption

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

Similar problems have similar solutions

?

SSS

SS S

SS S

PP

PPPPP

PP

X

Page 5: Lecture 2: CBR Retrieval

Car Diagnosis Example

Symptoms are observed Engine does not start Battery voltage = 7v

Goal Cause of failure: flat battery Repair strategy: charge battery

Page 6: Lecture 2: CBR Retrieval

Case-Based Diagnosis Case describes diagnostic situation

Description of symptoms Description of fault Description of repair strategy

Case-base stores a collection of cases CBR

finds case in case-base similar to new symptoms Re-uses

diagnosis of fault repair strategy

Page 7: Lecture 2: CBR Retrieval

Car Diagnosis Case Each case describes one diagnostic situation

Described by a list of features Contains a list of feature values

Problem Symptom: headlight does not work Car: Ford Mondeo Year: 2001

Solution Diagnosis: headlight fuse blown Repair: replace headlight fuse

This is not a rule - why not?

Battery: 10.4v Headlights: undamaged HeadlightSwitch: on

Feature Value

Case

1

Page 8: Lecture 2: CBR Retrieval

Case

2Ca

se 1

Car Diagnosis Case-Base A collection of independent cases

Problem Symptom: headlight does not work Car: Ford Mondeo Year: 2001

Solution Diagnosis: headlight fuse blown Repair: replace headlight fuse

Problem Symptom: headlight does not work Car: Ford Ka Year: 2003

Solution Diagnosis: defective bulb Repair: replace headlight

Battery: 10.4v Headlights: undamaged HeadlightSwitch: on

Battery: 9.5v Headlights: surface damage HeadlightSwitch: on

Page 9: Lecture 2: CBR Retrieval

Case Representation

Depends on problem domain Flat structure

A list of feature values (car diagnosis example) Easy to store and retrieve

Specialised representations Graphs - nodes and arcs Plans - partially ordered set of actions Object-oriented - objects (instances of classes)

More difficult to store and retrieve

Page 10: Lecture 2: CBR Retrieval

Case Representation

Object-oriented representation: A case is a set of objects An object is described by a set of features

Classes are arranged in a hierarchy Relations between objects

(e.g. part-of) Combine similarities of parts

Car

Brakes EngineTransmission

Ignition SystemFuel Injection

Coil Spark PlugColour: dark greyGap: 1.2mm

Page 11: Lecture 2: CBR Retrieval

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 12: Lecture 2: CBR Retrieval

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 1

Similar?

Page 13: Lecture 2: CBR Retrieval

Nearest Neighbour Retrieval

Retrieve most similar k-nearest neighbour (k-NN)

like scoring in bowls or curling Example

1-NN 5-NN …

Page 14: Lecture 2: CBR Retrieval

Calculating Case Similarity Similarity(problem,case) = weighted sum of

Similarityf(problem,case) for all features f

High importance features have large weight symptom, battery, headlights

weight = 6 Low importance features have low weight

car, year weight = 1

Case similarity = si is similarity of ith feature wi is weight of ith feature

w1*s1 + w2 * s2 + …… + wn*sn

w1 + w2 + …… + wn

Page 15: Lecture 2: CBR Retrieval

New Problem and Case 1

New Problem Symptom: brakelight does not

work Car: Ford Fiesta Year: 1997 Battery: 9.2v Headlights: undamaged HeadlightSwitch: ?

weight = 6 1

Problem Symptom: headlight does not

work Car: Ford Mondeo Year: 2001 Battery: 10.4v Headlights: undamaged HeadlightSwitch: on

Solution Diagnosis: headlight fuse blown Repair: replace headlight fuse

0.8

0.6

1.00.90.6

Similarity(New, Case 1) =6*0.8 + 1*0.6 + 1*0.6 + 6*0.9 + 6*1

6 + 1 + 1 + 6 + 6= 17.4 / 20 = 0.87

Similarity Case 1

Page 16: Lecture 2: CBR Retrieval

New Problem and Case 2

New Problem Symptom: brakelight does not

work Car: Ford Fiesta Year: 1997 Battery: 9.2v Headlights: undamaged HeadlightSwitch: ?

weight = 6 1

Problem Symptom: headlight does not

work Car: Ford Ka Year: 2003 Battery: 9.5v Headlights: surface damage HeadlightSwitch: on

Solution Diagnosis: defective bulb Repair: replace headlight

0.8

0.8

0.00.9750.4

Similarity(New, Case 2) =6*0.8 + 1*0.8 + 1*0.4 + 6*0.975 + 6*0

6 + 1 + 1 + 6 + 6= 11.85 / 20 = 0.59

Case 2Similarity

Page 17: Lecture 2: CBR Retrieval

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 18: Lecture 2: CBR Retrieval

CBR-Works

Similarity Calculation in tool used in the Lab Unordered Symbols Ordered Symbols Numbers Intervals Strings Taxonomy

Page 19: Lecture 2: CBR Retrieval

Symbols (Unordered) Similarity defined by developer Similarity values stored in a decision table

Page 20: Lecture 2: CBR Retrieval

Symmetric vs Asymmetric Similarity

In symmetric similarity the result is independent of the role of the values being compared

Sim (amber, green) = 0.8 Sim (green, amber) = 0.8

In asymmetric similarity the role is important Sim (amber, green) = 0.3 Sim (green, amber) = 0.8

Page 21: Lecture 2: CBR Retrieval

Ordered Symbols

The symbols are mapped to a numeric range

Colour Brightness Light Medium Dark

Light 1.0 0.5 0.0

Medium 0.5 1.0 0.5

Dark 0.0 0.5 1.0

Page 22: Lecture 2: CBR Retrieval

Numbers

df(query,case) = |q - c|/range Similarityf(query,case) = 1 – d Example:

Query (New Problem): Mileage = 60,000 Case: Mileage = 50,000 Range (Mileage) = 0..100,000 dMileage(query,case) = |60,000 – 50,000|/10,0000

= 0.1 SimilarityMileage(query,case) = 1 – 0.1 = 0.9

Page 23: Lecture 2: CBR Retrieval

Intervals

if the intervals in query and case do not intersect the similarity is higher the closer the gap

if the intervals intersect the similarity is higher the closer the bounds

if the case completely covers the query the similarity is 1

if the query completely covers the case the similarity is higher the closer the bounds

Page 24: Lecture 2: CBR Retrieval

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 25: Lecture 2: CBR Retrieval

Taxonomy A classification

hierarchy defines similarity for concepts

Inner nodes of the tree are assigned similarity values

Leaves under a node will share the nodes similarity

Page 26: Lecture 2: CBR Retrieval

Example from CBR-Works

Page 27: Lecture 2: CBR Retrieval

Example from CBR-Works

dMileage(query,case1) = |60000 - 50000|/(100000) =0.1 SMileage(query,case1) = 1 – 0.1 = 0.9 dTowbar(query,case1) = 0 STowbar(query,case1) = 1 – 0 = 1 S(query,case1) = (0.9 + 1) / (1 + 1) = 0.95

Note that the missing values (?) do not contribute to the calculation

Page 28: Lecture 2: CBR Retrieval

Reading

Text D.B. Leake. Case-Based Reasoning:

Experiences, Lessons and Future Directions. MIT Press,1996.

Seminal Paper A. Aamodt & E. Plaza. Case-based

Reasoning: Foundational Issues, Methodological Variations, and System Approaches. AICOM 7(1):39-59, 1994.

ftp://ftp.ifi.ntnu.no/pub/Publikasjoner/vitenskaplige-artikler/aicom-94.pdf