outline inductive bias general-to specific ordering of hypotheses learning algorithms which use this...

38
Outline • Inductive bias • General-to specific ordering of hypotheses • Learning algorithms which use this ordering • Version spaces and candidate elimination algorithm

Upload: georgina-lindsey

Post on 04-Jan-2016

219 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Outline

• Inductive bias

• General-to specific ordering of hypotheses

• Learning algorithms which use this ordering

• Version spaces and candidate elimination algorithm

Page 2: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Learning

• Goal of learning: induce general function from specific examples – CENTRAL TO LEARNING

• Concept learning – search through hypothesis space for THE ”best fit” hypothesis

• Inductive Learning Hypothesis:• Any hypothesis found to approximate the

target function well over the training examples, will also approximate the target function well over the unobserved examples.

Page 3: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Training Examples for Concept Enjoy Sport

Sky Temp Humid Wind Water Fore-cast

Enjoy Sport

Sunny

Sunny

Rainy

Sunny

Warm

Warm

Cold

Warm

Normal

High

High

High

Strong

Strong

Strong

Strong

Warm

Warm

Warm

Cool

Same

Same

Change

Change

Yes

Yes

No

Yes

Concept: ”days on which my friend Aldo enjoys his favourite water sports”Task: predict the value of ”Enjoy Sport” for an arbitrary day based on the values of the other attributes

Page 4: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Representing Hypothesis

• Hypothesis h is a conjunction of constraints on attributes

• Each constraint can be:– A specific value : e.g. Water=Warm– A don’t care value : e.g. Water=?– No value allowed (null hypothesis): e.g. Water=Ø

• Example: hypothesis h Sky Temp Humid Wind Water Forecast< Sunny ? ? Strong ? Same >

Page 5: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Prototypical Concept Learning Task

Given:• Instances X : Possible days decribed by the attributes Sky,

Temp, Humidity, Wind, Water, Forecast• Target function c: EnjoySport X {0,1}• Hypotheses H: conjunction of literals e.g. < Sunny ? ? Strong ? Same >• Training examples D : positive and negative examples of the

target function: <x1,c(x1)>,…, <xn,c(xn)>Determine:• A hypothesis h in H such that h(x)=c(x) for all x in D.

Page 6: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Inductive Learning Hypothesis

• Any hypothesis found to approximate the target function well over the training examples, will also approximate the target function well over the unobserved examples.

Page 7: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Number of Instances, Concepts, Hypotheses

• Sky: Sunny, Cloudy, Rainy

• AirTemp: Warm, Cold

• Humidity: Normal, High

• Wind: Strong, Weak

• Water: Warm, Cold

• Forecast: Same, Change

#distinct instances : 3*2*2*2*2*2 = 96

#distinct concepts : 296

#syntactically distinct hypotheses : 5*4*4*4*4*4=5120

#semantically distinct hypotheses : 1+4*3*3*3*3*3=973

Page 8: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

General to Specific Order

• Consider two hypotheses:– h1=< Sunny,?,?,Strong,?,?> – h2=< Sunny,?,?,?,?,?>

• Set of instances covered by h1 and h2:

h2 imposes fewer constraints than h1 and therefore classifies more instances x as positive h(x)=1.

Definition: Let hj and hk be boolean-valued functions defined over X. Then hj is more general than or equal to hk (written hj hk) if and only if

x X : [ (hk(x) = 1) (hj(x) = 1)]• The relation imposes a partial order over the hypothesis space H that is

utilized by many concept learning methods.

Page 9: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Instance, Hypotheses and ”more general”

x1=< Sunny,Warm,High,Strong,Cool,Same>

x2=< Sunny,Warm,High,Light,Warm,Same>

h1=< Sunny,?,?,Strong,?,?>

h2=< Sunny,?,?,?,?,?>

h3=< Sunny,?,?,?,Cool,?>

Instances

x2

x1

Hypotheses

h2

h3h1

h2 h1

h2 h3

specific

general

Page 10: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Find-S Algorithm

1. Initialize h to the most specific hypothesis in H

2. For each positive training instance x

– For each attribute constraint ai in h

If the constraint ai in h is satisfied by x

then do nothing

else replace ai in h by the next more general constraint that is satisfied by x

3. Output hypothesis h

Page 11: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Hypothesis Space Search by Find-S

Instances Hypotheses

specific

general

h0

h0=< Ø, Ø, Ø, Ø, Ø, Ø,>

h1

x1=<Sunny,Warm,Normal,Strong,Warm,Same>+

x1

h1=< Sunny,Warm,Normal,Strong,Warm,Same>

x3=<Rainy,Cold,High,Strong,Warm,Change> -

x3

h2,3

x2=<Sunny,Warm,High,Strong,Warm,Same>+

x2

h2,3=< Sunny,Warm,?,Strong,Warm,Same>

h4

x4=<Sunny,Warm,High,Strong,Cool,Change> +

x4

h4=< Sunny,Warm,?,Strong,?,?>

Page 12: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Properties of Find-S

• Hypothesis space described by conjunctions of attributes

• Find-S will output the most specific hypothesis within H that is consistent with the positve training examples

• The output hypothesis will also be consistent with the negative examples, provided the target concept is contained in H.

Page 13: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Complaints about Find-S

• Can’t tell if the learner has converged to the target concept, in the sense that it is unable to determine whether it has found the only hypothesis consistent with the training examples.

• Can’t tell when training data is inconsistent, as it ignores negative training examples.

• Why prefer the most specific hypothesis?• What if there are multiple maximally specific

hypothesis?

Page 14: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Version Spaces

• A hypothesis h is consistent with a set of training examples D of target concept if and only if h(x)=c(x) for each training example <x,c(x)> in D.

Consistent(h,D) := <x,c(x)>D h(x)=c(x)

• The version space, VSH,D , with respect to hypothesis space H, and training set D, is the subset of hypotheses from H consistent with all training examples:

VSH,D = {h H | Consistent(h,D) }

Page 15: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

List-Then Eliminate Algorithm

1. VersionSpace a list containing every hypothesis in H

2. For each training example <x,c(x)>

remove from VersionSpace any hypothesis that is inconsistent with the training example h(x) c(x)

3. Output the list of hypotheses in VersionSpace

Page 16: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Example Version Space

{<Sunny,Warm,?,Strong,?,?>}S:

{<Sunny,?,?,?,?,?>, <?,Warm,?,?,?>, }G:

<Sunny,?,?,Strong,?,?> <Sunny,Warm,?,?,?,?><?,Warm,?,Strong,?,?>

x1 = <Sunny Warm Normal Strong Warm Same> +x2 = <Sunny Warm High Strong Warm Same> +x3 = <Rainy Cold High Strong Warm Change> -x4 = <Sunny Warm High Strong Cool Change> +

Page 17: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Representing Version Spaces

• The general boundary, G, of version space VSH,D is the set of maximally general members.

• The specific boundary, S, of version space VSH,D is the set of maximally specific members.

• Every member of the version space lies between these boundaries

VSH,D = {h H| ( s S) ( g G) (g h s)

where x y means x is more general or equal than y

Page 18: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Version Space

G

S

consistentgeneralizations

more general

more specific

+ examples move S up- examples move G down

Page 19: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Candidate Elimination Algorithm

G maximally general hypotheses in HS maximally specific hypotheses in HFor each training example d=<x,c(x)>If d is a positive example

Remove from G any hypothesis that is inconsistent with dFor each hypothesis s in S that is not consistent with d• remove s from S.• Add to S all minimal generalizations h of s such that

– h consistent with d– Some member of G is more general than h

• Remove from S any hypothesis that is more general than another hypothesis in S

Page 20: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Candidate Elimination Algorithm

If d is a negative example

Remove from S any hypothesis that is inconsistent with d

For each hypothesis g in G that is not consistent with d

• remove g from G.

• Add to G all minimal specializations h of g such that – h consistent with d

– Some member of S is more specific than h

• Remove from G any hypothesis that is less general than another hypothesis in G

Page 21: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

The most general model matches everything

Negative instances specialize general descriptions

Positive instances prune the general descriptions

Eventually, positive and negative samples may force the general and specific models to converge ona solution.

Negative instances prune the specific descriptions

Positive instances generalize specific descriptions

The most specific model matches only one sampleSPECIFIC

GENERAL

Version space

Page 22: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Example Candidate Elimination

{<, , , , , >}S:

{<?, ?, ?, ?, ?, ?>}G:

{< Sunny Warm Normal Strong Warm Same >}S:

{<?, ?, ?, ?, ?, ?>}G:

{< Sunny Warm ? Strong Warm Same >}S:

{<?, ?, ?, ?, ?, ?>}G:

x1 = <Sunny Warm Normal Strong Warm Same> +

x2 = <Sunny Warm High Strong Warm Same> +

Page 23: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Example Candidate Elimination

{< Sunny Warm ? Strong Warm Same >}S:

{<?, ?, ?, ?, ?, ?>}G:

{< Sunny Warm ? Strong Warm Same >}S:

{<Sunny,?,?,?,?,?>, <?,Warm,?,?,?>, <?,?,?,?,?,Same>}G:

{< Sunny Warm ? Strong ? ? >}S:

{<Sunny,?,?,?,?,?>, <?,Warm,?,?,?> }G:

x3 = <Rainy Cold High Strong Warm Change> -

x4 = <Sunny Warm High Strong Cool Change> +

Page 24: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Example Candidate Elimination

• Instance space: integer points in the x,y plane• hypothesis space : rectangles, that means hypotheses are of the form a x b , c y d.

Homework: Exercise 2.4

Page 25: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Classification of New Data

{<Sunny,Warm,?,Strong,?,?>}S:

{<Sunny,?,?,?,?,?>, <?,Warm,?,?,?>, }G:

<Sunny,?,?,Strong,?,?> <Sunny,Warm,?,?,?,?><?,Warm,?,Strong,?,?>

x5 = <Sunny Warm Normal Strong Cool Change> x6 = <Rainy Cold Normal Light Warm Same>x7 = <Sunny Warm Normal Light Warm Same> x8 = <Sunny Cold Normal Strong Warm Same>

+ 6/0- 0/6? 3/3? 2/4

Page 26: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Inductive Leap

+ <Sunny Warm Normal Strong Cool Change>

+ <Sunny Warm Normal Light Warm Same>

+ <Sunny Warm Normal Strong Warm Same>

• How can we justify to classify the new example as

Bias: We assume that the hypothesis space H contains the target concept c. In other words that c can be described by a conjunction of literals.

S : <Sunny Warm Normal ? ? ?>

Page 27: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Biased Hypothesis Space

• Our hypothesis space is unable to represent a simple disjunctive target concept : (Sky=Sunny) v (Sky=Cloudy)

x1 = <Sunny Warm Normal Strong Cool Change> +x2 = <Cloudy Warm Normal Strong Cool Change> +

S : { <?, Warm, Normal, Strong, Cool, Change> }

x3 = <Rainy Warm Normal Light Warm Same> -

S : {}

Page 28: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Unbiased Learner

• Idea: Choose H that expresses every teachable concept, that means H is the set of all possible subsets of X called the power set P(X)

• |X|=96, |P(X)|=296 ~ 1028 distinct concepts• H = disjunctions, conjunctions, negations

– e.g. <Sunny Warm Normal ? ? ?> v <? ? ? ? ? Change>

• H surely contains the target concept.

Page 29: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Unbiased Learner

What are S and G in this case?

Assume positive examples (x1, x2, x3) and negative examples (x4, x5)

S : { (x1 v x2 v x3) } G : { (x4 v x5) } The only examples that are classified are the training examples themselves. In other words in order to learn the target concept one would have to present every single instance in X as a training example.

Each unobserved instance will be classified positive byprecisely half the hypothesis in VS and negative by theother half.

Page 30: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Futility of Bias-Free Learning

• A learner that makes no prior assumptions regarding the identity of the target concept has no rational basis for classifying any unseen instances.

Page 31: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Inductive Bias

Consider:• Concept learning algorithm L• Instances X, target concept c• Training examples Dc={<x,c(x)>}• Let L(xi,Dc ) denote the classification assigned to instance xi by L

after training on Dc.Definition:The inductive bias of L is any minimal set of assertions B such that

for any target concept c and corresponding training data Dc

(xi X)[B Dc xi] |-- L(xi, Dc)

Where A |-- B means that A logically entails B.

Page 32: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Three Learners with Different Biases

• Rote learner: Store examples classify x if and only if it matches a previously observed example.– No inductive bias

• Version space candidate elimination algorithm.

– Bias: The hypothesis space contains the target concept.• Find-S

– Bias: The hypothesis space contains the target concept and all instances are negative instances unless the opposite is entailed by its other knowledge.

Page 33: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination
Page 34: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

Learning the concept of “Japanese Economy Car”

Features: Country of origin, Manufacturer, Color, Decade, Type

1. Positive example: <Japan, Honda, Blue, 1980, Economy>G: {<? ? ? ? ?>} S: {<Japan, Honda, Blue, 1980, Economy>}

2: Negative example: <Japan, Toyota, Green, 1970, Sports>G: {<? Honda, ? ? ?>, <? ? Blue ? ?>, <? ? ? 1980 ?>, <? ? ? ? Economy>}S: {<Japan, Honda, Blue, 1980, Economy>}

3. Positive example: <Japan, Toyota, Blue, 1980, Economy>

G: {<? ? Blue ? ?>, <? ? ? ? Economy>}S: {<Japan ? Blue ? Economy>}

4. Negative example: <USA Chyrsler Red 1980 Economy>G: {<? ? Blue ? ?>, <Japan ? ? ? Economy>}S: {<japan ? Blue ? Economy>}

5. Positive example: <Japan, Honda, White 1980 Economy>G: <Japan ? ? ? Economy>S: <Japan ? ? ? Economy> Version space

Page 35: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

? ? ? ? ?

? ? ? ? Economy

Japan ? ? ? Economy

Japan ? ? ? Economy

Japan ? Blue ? Economy

Japan Honda Blue 1980 Economy

Japanese Economy car - VS trace

Page 36: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

? (version-space example1)

Example: (+ (BIG RED CIRCLE))S= ((BIG RED CIRCLE))G= ((? ? ?))

Example: (- (SMALL RED SQUARE))S= ((BIG RED CIRCLE))G= ((? ? CIRCLE) (BIG ? ?))

Example: (+ (SMALL RED CIRCLE))S= ((? RED CIRCLE))G= ((? ? CIRCLE))

Example: (- (BIG BLUE CIRCLE))S= ((? RED CIRCLE))G= ((? RED CIRCLE))

Convergence. Concept must be: (? RED CIRCLE)

Page 37: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

? (version-space example2)

Example: (+ (BIG RED CIRCLE))S= ((BIG RED CIRCLE))G= ((? ? ?))

Example: (- (SMALL BLUE TRIANGLE))S= ((BIG RED CIRCLE))G= ((? ? CIRCLE) (? RED ?) (BIG ? ?))

Example: (+ (SMALL RED CIRCLE))S= ((? RED CIRCLE))G= ((? ? CIRCLE) (? RED ?))

Example: (- (MEDIUM GREEN SQUARE))S= ((? RED CIRCLE))G= ((? ? CIRCLE) (? RED ?))

Did not convergeS= ((? RED CIRCLE))G= ((? ? CIRCLE) (? RED ?))

Page 38: Outline Inductive bias General-to specific ordering of hypotheses Learning algorithms which use this ordering Version spaces and candidate elimination

? (version-space example5)

Example: (+ (BIG RED CIRCLE))S= ((BIG RED CIRCLE))G= ((? ? ?))

Example: (- (BIG BLUE CIRCLE))S= ((BIG RED CIRCLE))G= ((? RED ?))

Example: (+ (SMALL BLUE SQUARE))S= NILG= NILLangauage is insufficient to describe the concept