Concept Learning

borrowed from : http://www.userwebs.pomona.edu/~jbm04747/courses/spring2003/cs151/lectures/VersionSpaces/VersionSpaces.html

Examples:


A Concept Learning Task

Represent days (i.e., instances) using a set of attributes: Represent hypothesis as a conjunction of constraints on attribute values.

Possible attribute constraints:

Example:

        < Sky=Sunny, Temp=?, Humidity=High, Wind=?, Water=?, Forecast=? >

or just

        < Sunny, ?, High, ?, ?, ? >

This is equivalent to a (restricted) logical expression:

        Sky(Sunny) ^ Humidity(High)
 

Most general hypothesis:   < ?, ?, ?, ?, ?, ? >

Most specific hypothesis:   < Ø, Ø, Ø, Ø, Ø, Ø >


Positive and negative training examples for the concept EnjoySport:
 

Example Sky Temp Humidity Wind Water Forecast EnjoySport
1 Sunny Warm Normal Strong Warm Same Yes
2 Sunny Warm High Strong Warm Same Yes
3 Rainy Cold High Strong Warm Change No
4 Sunny Warm High Strong Cool Change Yes

Task is to search hypothesis space for a hypothesis consistent with examples.
 

Inductive learning hypothesis:
    Any hypothesis found to approximate the target function well over
    a sufficiently large set of training examples will also approximate
    the target function well over other unobserved examples.
 

In this case, space is very small:

    1  +  ( 4 · 3 · 3 · 3 · 3 · 3 )  =  973

    Ø  + ( {Sunny, Cold, Rainy, ?} · { Warm, Cold, ? } ·  . . .  )
 

Need a way of searching very large or infinite hypothesis spaces efficiently.


General-to-Specific Ordering

Hypothesis space H has a natural structure.

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

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

h2  >  h1   ("more general than or equal to")

> relation defines a partial-order on H.

We can use this structure to search for a hypothesis consistent with the examples.
 


FIND-S Algorithm

Finds a maximally specific hypothesis.
 
    h  <-- most specific hypothesis in H
    for each positive training example x  {
        for each attribute constraint a in h  {
            if constraint a is not satisfied by x  {
                replace a by next more general constraint that is satisfied by x
           }
        }
    }
    output hypothesis h

This method works, provided that:

Problems with FIND-S


Current-Best-Hypothesis Search

Example:
 
Sky Temp Humidity Wind Water Forecast EnjoySport
Sunny Warm Normal Strong Cool Change Yes
Cloudy Warm Normal Strong Cool Change Yes
Rainy Warm Normal Strong Cool Change No

Not possible to find a consistent hypothesis using FIND-S.

FIND-S:   < ?, Warm, Normal, Strong, Cool, Change >  won't work

CBH:  (Sky(Sunny) v Sky(Cloudy)) ^ Temp(Warm) ^ . . . ^ Forecast(Change)
 


Version Spaces


Idea:  output the set of all hypotheses consistent with training data, rather than just one (of possibly many).

No need to explicitly enumerate all consistent hypotheses.

Take advantage of partial ordering of H.


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



How to represent a version space?

One approach:  Just list all the members.

List-Then-Eliminate Algorithm

    VS  <--  a list of all hypotheses in H
    for each training example <x, f(x)> {
        remove from VS any hypothesis h such that h(x) != f(x)
    }
    output hypotheses in VS
 

Only works if H is finite and small (usually an unrealistic assumption).

Better representation for version spaces:  Use 2 boundary sets:

VS is the interval from S-set to G-set.


Version-Space Learning Algorithm



G <-- set of maximally general hypotheses in H (e.g., {<?,?,?,?,?,?>})
S <-- set of maximally specific hypotheses in H (e.g., {<Ø,Ø,Ø,Ø,Ø,Ø>})
for each training example e {
    if e is a positive example {
        remove from G any hypotheses inconsistent with e
        for each hypothesis s in S not consistent with e {
            1. remove s from S
            2. add to S all minimal generalizations h of s such that
                h is consistent with e, and some member of G is more general than h
            3. remove from S any hypothesis that is more general than another
                hypothesis in S
        }
    }
    if e is a negative example {
        remove from S any hypotheses inconsistent with e
        for each hypothesis g in G not consistent with e {
            1. remove g from G
            2. add to G all minimal specializations h of g such that
                h is consistent with e, and some member of S is more specific than h
            3. remove from G any hypothesis that is less general than another
                hypothesis in G
        }
    }
}


Example trace




























Behavior of Version-Space Learning

How can Experiment-Generator module use current VS to suggest new problems to try?

Partially-learned concepts (VS with > 1 hypothesis) can still be useful

Example:
 

New instance Sky Temp Humidity Wind Water Forecast EnjoySport
A Sunny Warm Normal Strong Cool Change ?
B Rainy Cold Normal Light Warm Same ?
C Sunny Warm Normal Light Warm Same ?
D Sunny Cold Normal Strong Warm Same ?

VS from earlier example says: