Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Candidate Elimination Algorithm: Problem-1

Reference: E. Rich, K. Knight, "Artificial Intelligence", McGraw Hill, Second Edition.

Problem 1:

Learning the concept of "Japanese Economy Car"

Features: ( Country of Origin, Manufacturer, Color, Decade, Type )

Example
Origin Manufacturer Color Decade Type
Type
Japan Honda Blue 1980 Economy Positive
Japan Toyota Green 1970 Sports Negative
Japan Toyota Blue 1990 Economy Positive
USA Chrysler Red 1980 Economy Negative
Japan Honda White 1980 Economy Positive

Solution:

1. Positive Example: (Japan, Honda, Blue, 1980, Economy)

Initialize G to a singleton set that


G = { (?, ?, ?, ?, ?) }
includes everything.
S = { (Japan, Honda, Blue, 1980,
Initialize S to a singleton set that
Economy) }
includes the first positive example.

These models represent the most general and the most specific heuristics one might learn.
The actual heuristic to be learned, "Japanese Economy Car", probably lies between them somewhere within
the version space.

2. Negative Example: (Japan, Toyota, Green, 1970, Sports)

Specialize G to exclude the negative example.

{ (?, Honda, ?, ?, ?),


(?, ?, Blue, ?, ?),
G=
(?, ?, ?, 1980, ?),
(?, ?, ?, ?, Economy) }
{ (Japan, Honda, Blue, 1980, Economy)
S=
}
Refinement occurs by generalizing S or specializing G, until the heuristic hopefully converges to one that
works well.

3. Positive Example: (Japan, Toyota, Blue, 1990, Economy)

Prune G to exclude descriptions inconsistent with the positive example.


Generalize S to include the positive example.

{ (?, ?, Blue, ?, ?),


G=
(?, ?, ?, ?, Economy) }
S= { (Japan, ?, Blue, ?, Economy) }

4. Negative Example: (USA, Chrysler, Red, 1980, Economy)

Specialize G to exclude the negative example (but stay consistent with S)

{ (?, ?, Blue, ?, ?),


G=
(Japan, ?, ?, ?, Economy) }
S= { (Japan, ?, Blue, ?, Economy) }

5. Positive Example: (Japan, Honda, White, 1980, Economy)

Prune G to exclude descriptions inconsistent with positive example.


Generalize S to include positive example.

G = { (Japan, ?, ?, ?, Economy) }
S = { (Japan, ?, ?, ?, Economy) }
G and S are singleton sets and S = G.
Converged.
No more data, so algorithm stops.
Candidate Elimination Algorithm: Problem-2
Problem 2: Learning the concept of "Japanese Economy Car" (continued)

Features: ( Origin, Manufacturer, Color, Decade, Type )

Example
Origin Manufacturer Color Decade Type
Type
Japan Honda Blue 1980 Economy Positive
Japan Toyota Green 1970 Sports Negative
Japan Toyota Blue 1990 Economy Positive
USA Chrysler Red 1980 Economy Negative
Japan Honda White 1980 Economy Positive
Japan Toyota Green 1980 Economy Positive
Japan Honda Red 1990 Economy Negative

Solution:

1-5. See Problem 1

6. Positive Example: (Japan, Toyota, Green, 1980, Economy)

New example is G = { (Japan, ?, ?, ?,


consistent with version- Economy) }
space, so no change is S = { (Japan, ?, ?, ?,
made. Economy) }

7. Negative Example: (Japan, Honda, Red, 1990, Economy)

Example is inconsistent G cannot be specialized.


with the version-space. S cannot be generalized.

The version space collapses.

Conclusion: No conjunctive hypothesis is consistent with the data set.


Problem3 : Consider the following training data sets. Apply CEA.
+-------+-------+----------+-------------+
| Size | Color | Shape | Class/Label |
+=======+=======+==========+=============+
| big | red | circle | No |
| small | red | triangle | No |
| small | red | circle | Yes |
| big | blue | circle | No |
| small | blue | circle | Yes |
+-------+-------+----------+-------------+

Answer
For your hypothesis space (H), you start with your sets of maximally general (G) and maximally specific
(S) hypotheses:
G0 = {<?, ?, ?>}
S0 = {<0, 0, 0>}

When you are presented with a negative example, you need to remove from S any hypothesis
inconsistent with the current observation and replace any inconsistent hypothesis in G with its minimal
specializations that are consistent with the observation but still more general than some member of S.

So for your first (negative) example, (big, red, circle), the minimal specializations would make the
new hypothesis space
G1 = {<small, ? , ?>, <?, blue, ?>, <?, ?, triangle>}
S1 = S0 = {<0, 0, 0>}
Note that S did not change.

For your next example, (small, red, triangle), which is also negative, you will need to further
specialize G. Note that the second hypothesis in G1 does not match the new observation so only the first
and third hypotheses in G1 need to be specialized. That would yield
G2 = {<small, blue, ?>, <small, ?, circle>, <?, blue, ?>, <big, ?, triangle>, <?,
blue, triangle>}
However, since the first and last hypotheses in G2 above are specializations of the middle hypothesis
(<?, blue, ?>), we drop those two, giving
G2 = {<small, ?, circle>, <?, blue, ?>, <big, ?, triangle>}
S2 = S1 = S0 = {<0, 0, 0>}

For the positive (small, red, circle) observation, you must generalize S and remove anything in G
that is inconsistent, which gives
G3 = {<small, ?, circle>}
S3 = {<small, red, circle>}
(big, blue, circle) is the next negative example. But since it in not consistent with G, there is
nothing to do so
G4 = G3 = {<small, ?, circle>}
S4 = S3 = {<small, red, circle>}
Lastly, you have the positive example of (small, blue, circle), which requires you to generalize S to
make it consistent with the example, giving
G5 = {<small, ?, circle>}
S5 = {<small, ?, circle>}
Since G and S are equal, you have learned the concept of "small circles".

You might also like