Candidate Elimination Algo
Candidate Elimination Algo
Consistent Hypothesis
Hypothesis h is consistent with a set of training examples D iff h(x) = c(x) for each
example in D.
Hypothesis Space
ℎ1 …………ℎ𝑛
All hypothesis
Algorithm to Obtain Version Space
The algorithm that is used to obtain version space is called list then eliminate algorithm.
Step 3: prepare a final list of all consistent hypothesis after considering all training data into account.
Hypothesis Space Version Space Training example D
H2 X1
H2
H1 H3 H1 H3 X2
H4 H4
X3
Let check for consistency for each hypothesis with all the training examples individually, i.e.,
If H1(X1)= C(X1)
H1(X2)= C(X2) Final Version Space
H1(X3)= C(X3)
X1
If H2(X1)= C(X1) If H4(X1)= C(X1) H1
H2(X2)≠ C(X2) H4(X2)= C(X2)
H1 X2
H2(X3)= C(X3) H4(X3)≠ C(X3)
H3
If H3(X1)= C(X1)
X3
H3(X2)= C(X2)
H3(X3)= C(X3)
Consider the following example to understand list then eliminate algorithm:
Here F1 & F2 are two attributes
F1 F2
A X
B Y
Instance Space: (A, X), (A, Y), (B, X), (B, Y) – 4 Examples
Hypothesis Space: (A, X), (A, Y), (A, ø), (A, ?), (B, X), (B, Y), (B, ø), (B, ?), (ø, X), (ø, Y), (ø, ø), (ø,
?), (?, X), (?, Y), (?, ø), (?, ?) – 16 Hypothesis
Semantically Distinct Hypothesis : (A, X), (A, Y), (A, ?), (B, X), (B, Y), (B, ?), (?, X), (?, Y (?, ?),
(ø, ø) – 10
Version Space: (A, X), (A, Y), (A, ?), (B, X), (B, Y), (B, ?), (?, X), (?, Y) (?, ?), (ø, ø)
F1 F2 TARGET
A X YES
A Y YES
• The candidate elimination algorithm incrementally builds the version space given a hypothesis
space H and a set E of examples.
• The examples are added one by one; each example possibly shrinks the version space by removing
the hypotheses that are inconsistent with the example.
• The candidate elimination algorithm does this by updating the general and specific boundary for
each new example.
Salient Features for Candidate Elimination Algorithm
• Actually, positive examples are used here as Find-S algorithm (Basically they are generalizing from
the specification). Specific to general
•Version Space: It is intermediate of general hypothesis and Specific hypothesis. It not only just
written one hypothesis but a set of all possible hypothesis based on training data-set.
Steps for execution of the algorithm:
1) Initialize both specific and general hypothesis depending on the numbers of attributes.
G = {‘?’, ‘?’,’?’,’?’…} and S= {‘𝟇’,’𝟇’,’𝟇’…}
2) For each example -----
if example is positive
move specific to general
else example is negative
move general to specific
Six attributes
This is the first hypothesis so we need to consider all attributes under specific and then make it to general one
G3 = {<‘sunny’?????>,<?warm????>,<?????Same>}
Attribute changes in 1st position followed One question mark, attribute changes in
by 5 question mark 2nd position followed by 4 question
mark
Sky Temperature Humidity Wind Water Forecast Enjoy
Sunny Warm Normal Strong Warm Same Yes
Sunny Warm High Strong Warm Same Yes
Rainy Cold High Strong Warm Change No
Sunny Warm High Strong Cold Change Yes