Textbook ML - Removed
Textbook ML - Removed
{Yes, No}
Hypotheses H: Set of hypothesis each with conjunctions of literals as propositions [i.e, each
literal is represented as an attribute-value pair]
Solution: The hypothesis ‘i’ for the concept leaming task of an Elephant is given as:
h=
Step 3: Scan the next instance 12, since I2 is a positive instance. Generalize ’h’ to include positive
instance I2. For each of the non-matching attribute value in ‘h’ put a ‘2’ to include this positive
instance. The third attribute value is mismatching in ‘I with 12, so puta ‘2’,
R: 29 Yes Good Good Fast Yes Positive instance
h=<29 Yes? Good Fast Yes>
Now,scan 13. Since it is a negative instance, ignore it. Hence, the hypothesis remains the same
without any change after scanning 13.
I 2B No Good Good Fast No Negative instance
h=<29 Yes? Good Fast Yes>
Now scan I4, Since it is a positive instance, check for mismatch in the hypothesis ‘h’ with I4.
The 5" and 6* attribute value are mismatching, so add “? to those attributes in ‘W’.
M4: 29 Yes Good Good Slow No Positive instance
h=<29 Yes? Good 2
Now, the final hypothesis generated with Find-S algorithm is
h=<29 Yes? Good 2?
It includes all positive instances and obviously ignores any negative instance.
a)
Limitations of Find-S Algorithm
1, Find-S algorithm tries to find a hypothe
all negative instances, As long as the training dataset is consistent, the hypothesis found by this
algorithm may be consistent
hat is consistent with positive instances, ignoring
> 2. The algorithm finds only one unique hypothesis, wherein there may be many other hypotheses
1 that are consistent with the training dataset.90 «Machine Learning ——.
3, Many times, the training dataset may contain some errors; hence such inconsistent data instances
can mislead this algorithm in determining the consistent hypothesis since it ignores negative
‘instances.
Hence, it is necessary to find the set of hypotheses that are consistent with the training data
including the negative examples. To overcome the limitations of Find-S algorithm, Candidate |
Elimination algorithm was proposed to output the set of all hypotheses consistent with the training
dataset.
346 Version Spaces
The version space contains the subset of hypotheses from the hypothesis space that is consistent
with all training instances in the training dataset.
Scan for information on ‘Addtional Examples on Version Spaces”
List-Then-Eliminate Algorithm
‘The principle idea ofthis learning algorithm isto initialize the version space to contain all hypotheses
and then eliminate any hypothesis that is found inconsistent with any training instances. Initially,
the algorithm starts with a version space to contain all hypotheses scanning each training instance.
‘Thehypotheses that are inconsistent with the training instance are eliminated. Finally, the algorithm
outputs the list of remaining hypotheses that are all consistent.
sian
|
Input: Version Space ~a list of all hypotheses
Output: Set of consistent hypotheses
1. Initialize the version space with a list of hypotheses,
2. For each training instance,
* remove from version space any hypothesis that is inconsistent.
This algorithm works fine if the hypothesis space is finite but practically it is difficult to
deploy this algorithm. Hence, a variation of this idea is introduced in the Candidate Elimination
algorithm.
Version Spaces and the Candidate Elimination Algorithm
Version space learning is to generate all consistent hypotheses around. This algorithm computes
the version space by the combination of the two cases namely,
* Specific to General learning ~ Generalize S to include the positive example
* General to Specific learning - Specialize G to exclude the negative exampleBasics oftearning Theory» 94
Using the Candidate Elimination algorithm, we can compute the version space containing
ail and only those) hypotheses from H that are consistent with the given observed sequence of
training instances, The algorithm defines two boundaries called ‘general boundary’ which is a set of
ail hypotheses that are the most general and ‘specific boundary’ which isa set ofall hypotheses that
sre the most specific. Thus, the algorithm limits the version space to contain only those hypotheses
that are most general and most specific. Thus, it provides a compact representation of List-then
algorithm.
Input: Set of instances in the Training dataset
Output: Hypothesis G and S
1. Initialize G, to the maximally general hypotheses.
2. Initialize §, to the maximally specific hypotheses.
© Generalize the initial hypothesis for the first positive instance.
3, For each subsequent new training instance,
* Ifthe instance is positive,
© Generalize $ to include the positive instance,
> Check the attribute value of the positive instance and S,
«If the attribute value of positive instance and $ are different, fill that
field value with ‘?’.
+ If the attribute value of positive instance and $ are same, then do no
change.
0 Prune G to exclude all inconsistent hypotheses in G with the positive instance.
+ Ifthe instance is negative,
© Specialize G to exclude the negative instance,
> Add to G all minimal specializations to exclude the negative example and
be consistent with S.
+ If the attribute value of $ and the negative instance are different, then
fill that attribute value with $ value,
«If the attribute value of $ and negative instance are same, no need to
update ‘G’ and fill that attribute value with ‘7’.
‘0 Remove from S all inconsistent hypotheses with the negative instance.
Generating Positive Hypothesis ‘S’ If itis a positive example, refine $ to include the positive
instance, We need to generalize $ to include the positive instance. The hypothesis is the conjun
S’ and positive instance. When generalizing, for the first positive instance, add to § all minimal
generalizations such that S is filled with attribute values of the positive instance. For the subsequent
Dositive instances scanned, check the attribute value of the positive instance and S obtained in the92. © Machine Learning $$ poms
previous iteration. If the attribute values: of positive instance and S$ are different, fill that field value
/ jteration
with a7. Ifthe attribute values of positive instance and $ are same, no change is required. i
Now Sea
Ifitis a negative instance, it skips, :
Generating Negative Hypothesis ‘G’ If it is a negative instance, refine G to exclude the gine
negative instance. Then, prune G to exclude all inconsistent hypotheses in G with the positive consiste
instance, The idea is to add to G all minimal specializations to exclude the negative instance and end fill
be consistent with the positive instance. Negative hypothesis indicates general hypothesis. ‘elutes,
If the attribute values of positive and negative instances are different, then fill that field with are gen
positive instance value so that the hypothesis does not classify that negative instance as true. Ifthe The
attribute values of positive and negative instances are same, then no need to update ‘G’ and fill that oa
attribute value with a’. e
Generating Version Space - [Consistent Hypothesis] We need to take the combination of
sets in‘G’ and check that with ‘S', When the combined set fields are matched with fields in’S’, then
only that is included in the version space as consistent hypothesis.
a 33
BPERRSREWA Consider the same set of instances from the training dataset shown in-Table 3.3 Iterati
and generate version space as consistent hypothesis. Bae
e
Solution: u
Step 1: Initialize ‘G’ boundary to the maximally general hypotheses,
Gao? 2 2% 2% ® s
Step 2: Initialize ‘S’ boundary to the maximally specific hypothesis. There are 6 attributes, so for u
each attribute, we initially fill’¢ in the hypothesis ‘S’. c
S=<—p 9 9 9 P
Generalize the initial hypothesis for the first positive instance. Il is a positive instance,
so generalize the most specific hypothesis ‘S’ to include this positive instance. Hence,
I: 29 Yes Excellent © Good Fast. Yes _ Positive instance one.
Si=<29 Yes Excellent Good Fast Yes>
G 7 2 2 2 >
Step 3:
Iteration 1 cor:
Scan the next instance 12. Since [2 is a positive instance, generalize ‘S1' to include positive
instance 12. For each of the non-matching attribute value in ‘$1’, put a‘?’ to include this positive
instance. The third attribute value is mismatching in ‘$1’ with 12, so put a‘?’.
R: 29 Yes Good Good Fast Yes _ Positive instance
$2=<29 Yes? Good Fast - Yes>
Prune G1 to exclude all inconsistent hypotheses with the positive instance. Since G1 is o
consistent with this positive instance, there is no change. The resulting G2 is,
Gl=2? 2? ? ? 2 >—__——— Basics of Learning Theory + 93
Iteration 2
Now Sean 13,
B: 2 No Good Good Fast. No Negative instance
since it is a negative instance, specialize G2 to exclude the negative example but stay
consistent with $2. Generate hypothesis for each of the non-matching, attribute value in $2
and fill with the attribute value of $2, In those generated hypotheses, for all matching attribute
values, put a‘? The first, second and 6* attribute values do not match, hence ‘3 hypotheses
are generated in G3.
‘There is no inconsistent hypothesis in $2 with the negative instance, hence $3 remains the
same.
B09 27 2 2 2 Bb
£ a Ys 2° 2 2 Pb
: ar 2 2 2 Yes
§3=<29 Yes ? — Good Fast’ Yeo
eration 3
Now Scan [4, Since it is a positive instance, check for mismatch in the hypothesis ‘53° with M4.
‘The 5 and 6" attribute value are mismatching, so add ‘?’ to those attributes in ‘54’.
Is 29 Yes Good Good Slow No Positive instance
Sh=<29 Yes 2 Good 2? 9
Prune G3 to exclude all inconsistent hypotheses with the positive instance I4.
G=s9 2 2 2 2 Bw
“a Yes? 2 >
2 Yes, Indonsistent
Since the third hypothesis in G3 is inconsistent with this positive instance, remove the third
one, The resulting G4 is,
ou 2
Gh=<29 ? 2 2 2 >
2 Yes? 2 2 >
Using the two boundary sets, $4 and G4, the version space is converged to contain the set of
consistent hypotheses.
‘The final version space is,
<29 Yes? ? 2 >
2 Good ? >
Yes? Good
jorithm finds the version s
those hypotheses that are most
general and most specific.
The shown in Figure 3,2,
nntation of deriving the version space
mmatic rep!