1 Concept-Learning
1 Concept-Learning
Tian-Li Yu
This work is licensed by the entiy(ies) for the use of NTU MOOCs ONLY.
The copyright belongs to Yu, Tian-Li.
2 Hypothesis
3 Find-S
4 Version space
5 Candidate Elimination
6 Inductive bias
Given:
Instances X : Possible days, each described by the attributes Sky ,
AirTemp, Humidity , Wind, Water , Forecast.
Target function c: EnjoySport : X → {0, 1}
Hypotheses H: Conjunctions of literals. E.g. h?, Cold, High, ?, ?, ?i.
Training examples D: Positive and negative examples of the target
function hx1 , c(x1 )i, . . . , hxm , c(xm )i
Determine:
A hypothesis h in H such that h(x) = c(x) for all x in D?
A hypothesis h in H such that h(x) = c(x) for all x in X ?
Hypothesis
Instances 𝑋 Hypotheses 𝐻
Specific
𝑥1 ℎ1 ℎ3
ℎ2
𝑥2
General
𝑥1 = < Sunny, Warm, Normal, Strong, Cool, Same > ℎ1 = < Sunny, ?, ?, Strong, ?, ? >
h1 = hSunny , ?, ℎℎ?,
𝑥2 = < Sunny, Warm, High, Light, Warm, Same > 2 = < Sunny, ?, ?, ?, ?, ? >
Strong , ?, ?i
3 = < Sunny, ?, ?, ?, Cool, ? >
h2 = hSunny , ?, ?, ?, ?, ?i
h3 = hSunny , ?, ?, ?, Cool, ?i
Tian-Li Yu (NTUEE) Concept Learning 6 / 25
Hypothesis
Definitions
h1 <g h2 iff m(h1 ) ⊂ m(h2 ).
h1 ≤g h2 iff m(h1 ) ⊆ m(h2 ).
Find-S Algorithm
Find-S
1 Initialize h to the most specific hypothesis in H.
2 for each positive training instance x
3 for each attribute constraint ai in h
4 If ai in h is NOT satisfied by x, replace ai in h by the next
5 more general constraint that is satisfied by x.
6 Output hypothesis h.
Instances 𝑋 Hypotheses 𝐻
ℎ0
𝑥3 Specific
- ℎ1
ℎ2,3
𝑥1 +
+𝑥
2
+ ℎ4
𝑥4
General
h0 = hφ, φ, φ, φ, φ, φi
h1 = hSunny , Warm, Normal, Strong , Warm, Samei
h2 = hSunny , Warm, ?, Strong , Warm, Samei
h3 = hSunny , Warm, ?, Strong , Warm, Samei
h4 = hSunny , Warm, ?, Strong , ?, ?i
Properties of Find-S
Definition: Consistency
A hypothesis h is consistent with a set of training examples D of
target concept c if and only if h(x) = c(x) for all hx, c(x)i in D.
List-Then-Eliminate Algorithm
List-Then-Eliminate
1 VS = a set containing every hypothesis in H.
2 for each training example hx, c(x)i ∈ D
3 Remove from VS any hypothesis h for which h(x) 6= c(x).
4 Output the list of hypotheses in VS.
Candidate-Elimination Algorithm
1 G = set of maximally general hypotheses in H.
2 S = set of maximally specific hypotheses in H.
3 For each training example d, do
If d is positive,
Remove from G any hypothesis inconsistent with d.
For each s ∈ S inconsistent with d
Remove s from S.
Add to S all minimal generalization h of s s.t. h is consistent with
d and some member of G is more general than h.
Remove from S any hypothesis that is more general than another
hypothesis in S.
If d is negative,
Remove from S any hypothesis inconsistent with d.
For each g ∈ G inconsistent with d
Remove g from G .
Add to G all minimal specification h of g s.t. h is consistent with
d and some member of S is more specific than h.
Remove from G any hypothesis that is more specific than another
hypothesis in G .
Tian-Li Yu (NTUEE) Concept Learning 15 / 25
Candidate Elimination
Training examples
hSunny , Warm, Normal, Strong , Warm, Samei : +
hSunny , Warm, High, Strong , Warm, Samei : +
hRainy , Cold, High, Strong , Warm, Changei : −
hSunny , Warm, High, Strong , Cool, Changei : +
Initially,
S0 = hφ, φ, φ, φ, φ, φ, φi
G0 = h?, ?, ?, ?, ?, ?, ?i
𝑺𝟎 : { < ∅, ∅, ∅, ∅, ∅, ∅ > }
𝑮𝟎 , 𝑮𝟏 , 𝑮𝟐 : { < ?, ?, ?, ?, ?, ? > }
Training Examples:
1. < Sunny, Warm, Normal, Strong, Warm, Same > , EnjoySport = Yes
2. < Sunny, Warm, High, Strong, Warm, Same > , EnjoySport = Yes
𝑮𝟐 : { < ?, ?, ?, ?, ?, ? > }
Training Example:
3. < Rainy, Cold, High, Strong, Warm, Change > , EnjoySport = No
Training Example:
4. < Sunny, Warm, High, Strong, Cool, Change > , EnjoySport = Yes
Inductive Bias
We talked about the difficulty where the target concept is not in the
hypothesis space.
Why not using a hypothesis space which includes every possible
hypothesis?
How does |H| affect the generalization of the learner?
How does |H| affect required number of training examples?
Summary
References
Page Copy-
Image Source/Author
number right
Instances 𝑋 Hypotheses 𝐻
Specific
This work is licensed by the entiy(ies) for the use of “NTU MOOCs” ONLY.
6 𝑥1 ℎ1 ℎ3
𝑥2
ℎ2 The copyright belongs to Shao-Heng Ko.
General
This work is licensed by the entiy(ies) for the use of “NTU MOOCs” ONLY.
14 < Sunny, ?, ?, Strong, ?, ? >
< Sunny, Warm, ?, ?, ?, ? >
< ?, Warm, ?, Strong, ?, ? >
𝑺𝟎 : { < ∅, ∅, ∅, ∅, ∅, ∅ > }
This work is licensed by the entiy(ies) for the use of “NTU MOOCs” ONLY.
17 𝑺𝟐 : { < Sunny, Warm, ?, Strong, Warm, Same > }
𝑮𝟎 , 𝑮𝟏 , 𝑮𝟐 : { < ?, ?, ?, ?, ?, ? > }
The copyright belongs to Shao-Heng Ko.
Training Examples:
1. < Sunny, Warm, Normal, Strong, Warm, Same > , EnjoySport = Yes
2. < Sunny, Warm, High, Strong, Warm, Same > , EnjoySport = Yes