28
Case Based Reasoning Lecture 2: CBR Case Retrieval

Case Based Reasoning Lecture 2: CBR Case Retrieval

Embed Size (px)

Citation preview

Page 1: Case Based Reasoning Lecture 2: CBR Case Retrieval

Case Based Reasoning

Lecture 2: CBR Case Retrieval

Page 2: Case Based Reasoning Lecture 2: CBR Case Retrieval

Outline

Case Representation Nearest Neighbour Retrieval

Calculating similarity Similarity in CBR-Works Reading

Page 3: Case Based Reasoning Lecture 2: CBR Case Retrieval

R4 Cycle

REUSEpropose solutions from retrieved cases

REVISEadapt and repair

proposed solution

CBR

RETAINintegrate in

case-base

RETRIEVEfind similar problems

Page 4: Case Based Reasoning Lecture 2: CBR Case 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

PPPP

P

PP

X

Page 5: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case Retrieval

Case

2C

ase

1Car 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: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case 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

C

ase

C

ase

C

ase

C

ase

C

ase

C

ase

C

ase

1

Similar?

Page 13: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case Retrieval

CBR-Works

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

Page 19: Case Based Reasoning Lecture 2: CBR Case Retrieval

Symbols (Unordered)

Similarity defined by developer Similarity values stored in a decision table

Page 20: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case Retrieval

Example from CBR-Works

Page 27: Case Based Reasoning Lecture 2: CBR Case 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: Case Based Reasoning Lecture 2: CBR Case 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