Case Representation Cont’d

29
Case Representation Cont’d Sources: Chapter 3 www.iiia.csic.es/People/enric/AICom.html www.ai-cbr.org

description

Case Representation Cont’d. Sources: Chapter 3 www.iiia.csic.es/People/enric/AICom.html www.ai-cbr.org. Attribute-Value Case Representation. Case: a collection of attribute-value pairs Example: Each row in the wait-restaurant table is a case. Examples in the IDT context correspond to cases. - PowerPoint PPT Presentation

Transcript of Case Representation Cont’d

Page 1: Case Representation Cont’d

Case Representation Cont’d

Sources:–Chapter 3–www.iiia.csic.es/People/enric/AICom.html–www.ai-cbr.org

Page 2: Case Representation Cont’d

Attribute-Value Case Representation• Case: a collection of attribute-value pairs

• Example: Each row in the wait-restaurant table is a case

• Examples in the IDT context correspond to cases

• Each attribute is from a certain type. For example:Integer: all integers or an intervalReal: all numbers or an intervalSymbol: finite set of alternatives (e.g., Thai, Italian,…)Hypertext: HTML

• Attributes can be the same for all cases or vary from case to case

Page 3: Case Representation Cont’d

Formalization• Attributes: A1, A2, .., An

• Types: T1, T2, …, Tn

• Values a1 in T1, a2 in T2, …, an in Tn• A case is defined as follows:

If all cases have the same number of attributes, a case is a vector: (a1, …, an) in T1 {unknown} … Tn {unknown}

If cases have a varying number of attributes, a case is a set: {Ap = ap, …, Ak = ak} (attributes that are not in the set are considered unknown)

Unknown values is the main difference between a case and an example in the sense of IDT

Page 4: Case Representation Cont’d

Selection of Attributes• Situation description:

Independence: Attributes should represent independent features whenever possible

Completeness: the attributes should be sufficient to determine if the case can be reused in a new situation

Minimalist: The only attributes that should be included in a case are those used in to compute similarity

(ex: type of restaurant versus week day)(not always possible: patrons and day of the week are related)

(ex: Not including Patrons may make it impossible to learn a hypothesis function)

(ex: name of the waitress is not a relevant attribute)

Page 5: Case Representation Cont’d

Selection of the Types• Selection of the types is defined by the elements needed to

compute similarity• Symbols:

Ideal for a small number of alternatives (e.g., type of restaurant)

• Integer/Real

Ideal for measures and other numeric valuesComputation of similarity

• Text:

Ideal for unstructured informationComputation of similarity can be very difficult

Page 6: Case Representation Cont’d

ExampleCase 1

• Front-light = doesn’t work• Car-type = Golf II, 1.6• Year = 1993• Batteries = 13.6V• …

Symptoms:

Solution:• Diagnosis: Front-lights-safeguard = broken• Help measures: “Replace front lights safeguard”

Symbol: work,doesn’t work

Symbol: Golf, Mercedes,…

Symbol: 1960, …, 2002

Real: 1V … 30V

Text

Symbol: ok, broken

Page 7: Case Representation Cont’d

Assignment (I): Monday, October 9th 1. Select a machine that you feel particularly familiar with it (e.g.,

your PC, the graphic card of your pc). Obtain at least 10 attributes and their types that you feel are relevant to make a diagnosis of a failure for that machine

2. Proof that Vertex-cover is NP-complete (formulate decision problem; proof that is in NP; reduce Clique into Vertex-Cover)

(CSE 435)

(CSE 335/435)

Page 8: Case Representation Cont’d

Vertex-Cover

A

CB

D

F

G

E

H10 20

16

46

8 24

20

69

13

12

Given a graph G, a vertex cover V is a collection of nodes in G such that for every arc (w,v) either w is in V or v is in V or both

Vertex-Cover Problem: Given a graph, find the vertex-cover containing the minimum number of nodes

Page 9: Case Representation Cont’d

Contents of a Case• Generally a case contains specific knowledge about a

previous problem solving experience• Typically a case contains the following information:

Problem/SituationSolutionAdequacy

• Scope of the information:Complete solution/partial solution Detail or abstracted solution

• Representation formalism:Attribute-value pairsStructured representation: objects, trees High-order: predicate logic, plans

(example: help-desk systems)

(example: planning)

Annotations about situations where reusing the case didn’t help or was very helpful

Page 10: Case Representation Cont’d

Object-Oriented Representation

• Objects are described as a fixed collection of attributes

• A case consists of a collection of objects

• There are relations between objects in a case

Each object belongs to a class of objects

• Classes of objects are ordered in a inheritance hierarchy

Subclasses inherit properties of the superclass

(example in OOP: instance vs classes)

(example in OOP: “this” or “self” and “super”)

Page 11: Case Representation Cont’d

Tree Representation

Structured representations are needed when there are multiple relations between elements of the problem

Page 12: Case Representation Cont’d

Objects and Classes

• An object class describes the structure of an object through a (finite) collection of attributes and their types

• An instance (or an object) of an object class assigns values of the corresponding type for each attribute in the class

Page 13: Case Representation Cont’d

Example (Objects and Classes)

• Front-light = doesn’t work• Car-type = Golf II, 1.6• Year = 1993• Batteries = 13.6V• …

Instance: Entry # 314• Front-light: symbol• Car-type : symbol• Year: Symbol• Batteries: Real• …

Class: Symptoms

Page 14: Case Representation Cont’d

Relations Between Objects

• Relations between objects are important

• Typical kinds of relations:

Taxonomical relations: “is-a-kind-of” indicates abstraction/refinement relations between objects

Compositional relations: “is-a-part-of” indicates that objects are parts of other objects

(example: car is a kind of transportation means)

(example: motor is a part of a car)

Page 15: Case Representation Cont’d

Compositional Relations

Car

Fuel system Motor Electrical system

Carburator

Exhaust …

• Compositional relations are described through relational attributes

• Relational Attributes are attributes whose values are objects

Page 16: Case Representation Cont’d

Example (Compositional Relation)

• Model: symbol• Make : symbol• Year: Symbol• Motor: MotorC• …

Class: CarC

• SerialN: int• Liter : real• Carburator: CarbC• …

Class: MotorC

• Model: Tercel• Make : Toyota• Year: 1991• Motor: • …

Instance: Toyota Tercel

• SerialN: 1263455233• Liter : 1.5• Carburator: …• …

Instance: …

Page 17: Case Representation Cont’d

Taxonomical Relations

Transportation Means

Air trans. Land trans. Sea trans

car

Sport utility…

• Taxonomical relations are explicitly represented

• The subclass inherits all the attributes of the superclass

Page 18: Case Representation Cont’d

Example (Taxonomical Relation)

• Model: symbol• Make : symbol• Year: Symbol• Price: int• …

Class: CarC

• Max speed: int• horseP: int• …

Class: Land Transport

• Max speed: 100 mph• horseP: …• …• Model: Tercel• Make : Toyota• Year: 1991• Price: $2000• …

instance: ToyotaTercel

Page 19: Case Representation Cont’d

Analysis of Object-Oriented Case Representations

• Advantages:

Structured and natural in many domainsRelations between objects are explicitly representedMore compact storage as with attribute-valuesStructured relations can be used to define similarity

• Disadvantages:

Similarity computation and retrieval can be time costlyTime order cannot be represented

Example domain: design and configuration

Example domain: planning

Page 20: Case Representation Cont’d

Predicate Logic Representation

Problem/Solution from a case can be represented through predicates:

• Front-light = doesn’t work• Car-type = Golf II, 1.6• Year = 1993• Batteries = 13.6V• …

Symptoms:

Solution:• Diagnosis: Front-lights-safeguard = broken• Help measures: “Replace front lights safeguard”

Case( symptoms(frontLight(dw), carType(GolfII_1.6), year(1993), batteries(13.6),…), diagnosis(broken(fls), measures(rfls)))

Case:termpredicate

Page 21: Case Representation Cont’d

Predicate Logic Representation (cont’d)

• Attribute-value pairs representation of cases can be represented as predicates (each attribute is represented as a term and a predicate “encapsulates” all terms)

Tree can also be represented as predicates(each node is a predicate and the links are terms)

Object representations can also be represented as predicates(terms represent the hierarchical relations)

Page 22: Case Representation Cont’d

Predicate Logic Representation (cont’d)

• Advantages:

As flexible as it gets (I am exaggerating)Complex structural relations can be representedCan take advantage of inference mechanism (i.e., prolog)

• Disadvantages:

Computing similarity can be very complicatedInference procedures are frequently very time costly CNF-SAT is NP-complete, thus, SAT is NP-complete.

(CSE 435 Homework – Attention: Due on Friday October 8!)

Page 23: Case Representation Cont’d

Formulas (SAT): Definition

Definition. A Boolean formula is defined recursively as follows:

• A Boolean variable is a Boolean formula • If 1 and 2, are Boolean formulas then:

(1 2) (1 2) (1 2)

are also Boolean formulas• If is a Boolean formula then ¬() is a Boolean formula• Assume that there are no redundancies in parenthesis

Definition. (SAT) Given a Boolean formula , is there an assignment of the variables in that makes the formula true?

Example: ((x y) ¬x) y

Page 24: Case Representation Cont’d

Graph Representation

Graph representations are useful in many domains:

• Data flow• Planning• Query answer

Mount Piece on the Lathe machine at position X, Y

Rotate machine at Z speed

Select drilling tool with M cm head diameter

Select trajectory for the tool

Can’t be represented as a tree

Page 25: Case Representation Cont’d

Analysis of Graph Representations

• Advantages:

Structured and natural in many domainsRelations between objects are explicitly representedStructured relations can be used to define similarity

• Disadvantages:

Similarity computation and retrieval can be time costlyGraph-Subgraph Isomorphism is NP-complete!

Page 26: Case Representation Cont’d

Graphs: Definition

G = (V, E)

Vertices (nodes)Edges (arcs)

Edges are a subset of V V

{(v,v’) : v and v’ are in V}

We also write v v’ instead of (v.v’)

Page 27: Case Representation Cont’d

SubgraphsGiven a graph G = (V, E) and a graph G’ = (V’, E’), G is a subgraph of G’ if:

• V V’• E E’

Every element in the left set is an element in the right set

Page 28: Case Representation Cont’d

Graph-Subgraph Isomorphism• Two graphs G1 = (V1,E1) and G2 = (V2,E2) are isomorphic

if a bijective function f: V1 V2 exists such that:– If (u,v) is in E1 then (f(u),f(v)) is in E2– If (u’,v’) is in E2 then (f(u’),f(v’)) is in E1

• Graph-Subgraph Isomorphism problem SAT: Given two graphs G1 and G2 is G1 isomorphic to a subgraph of G2?

Example of 2 isomorphic graphs:

Page 29: Case Representation Cont’d

CNF-SAT

Circuit-SAT

CLIQUE

SAT

(*)

Homework:• (*) Show that SAT is NP-complete (See Slide 23)• Find the isomorphism between the 2 graphs in Page 28 (Yes this

is part of the homework – I had indicated in class mistakenly that shouldn't be done)

• Show that the Graph Isomorphism problem is in NP• (**) Show that Graph-Subgraph Isomorphism is NP-hard

Assignment (CSE 435 – Attention: Due on Friday October 8!)

Graph-Subgraph SAT(**)