310 likes | 581 Views
Outline. Case RepresentationNearest Neighbour RetrievalCalculating similaritySimilarity in CBR-WorksReading. R4 Cycle. . . . . REUSEpropose solutions from retrieved cases. REVISEadapt and repairproposed solution. CBR. RETAINintegrate incase-base. . . RETRIEVEfind similar problems. CBR As
E N D
1. Case Based Reasoning Lecture 2: CBR Case Retrieval
2. Outline Case Representation
Nearest Neighbour Retrieval
Calculating similarity
Similarity in CBR-Works
Reading
3. R4 Cycle
4. CBR Assumption New problem can be solved by
retrieving similar problems
adapting retrieved solutions
Similar problems have similar solutions
5. Car Diagnosis Example Symptoms are observed
Engine does not start
Battery voltage = 7v
Goal
Cause of failure: flat battery
Repair strategy: charge battery
6. 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
7. 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
8. 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
9. 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
10. 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
11. 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: ?
12. 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
13. Nearest Neighbour Retrieval Retrieve most similar
k-nearest neighbour (k-NN)
like scoring in bowls or curling
Example
14. 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
15. 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
16. 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
17. 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
18. 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
19. CBR-Works Similarity Calculation in tool used in the Lab
Unordered Symbols
Ordered Symbols
Numbers
Intervals
Strings
Taxonomy
20. Symbols (Unordered) Similarity defined by developer
Similarity values stored in a decision table
21. 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
22. Ordered Symbols The symbols are mapped to a numeric range
23. 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
24. 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
25. 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).
26. 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
27. Example from CBR-Works
28. 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
29. 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