Homework #1 Candidate Elimination

advertisement
Machine Learning
Computer Engineering Department
Sharif University of Technology
Fall 84
Homework #1
Candidate Elimination
Candidate elimination is one of the methods of concept learning. It means that this
algorithm takes lots of samples as training data from environment and tries to create a
rule or classifier which is not only consistent with most of the training samples but
test ones. The more consistent the classifier is with samples (training and test
samples) the better classifier it is. Candidate elimination is an online classification
method. Use the candidate elimination procedure to learn the concept G(x) described
by the following training set and show the current classifier it has created (the most
general and specific sets) corresponding to every sample it deals with.
Input: The first number n (is an unsigned integer) shows number of attributes for
every sample, followed by number of values for every attribute represented by Vi
(unsigned integer). The values of every attribute start from 1 to Vi . After one space
line another integer shows number of training samples, followed by one training
sample for every line. Each training samples contain the values corresponding to the
attributes of the sample and characters P or N which show positive or negative
samples respectively.
Output: The output at first and second line is always similar to the sample output
‘S‘ showing specific set and ‘G’ general set. ‘Q’ is the empty set. Then for every
training data you should show the specific and general sets. If general or specific sets
contains more than one term you are to delimitate them by comma ‘,’.
Sample Input
4
2
2
2
2
2
1 1 1 1 N
1 1 2 2 P
Sample Output
S=Q
G=????
S=Q
G=2???,?2??,??2?,???2
S=1122
G=??2?,???2
Download