

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


In this homework assignment, you will modify the “Simple GA in C” code to do some experiments on feature selection with the GA, as described in class (and below).
You can download the Simple GA in C from the class web page:
http://www.cs.pdx.edu/~mm/MachineLearning2006/simple-ga-in-c.tar.gz
Un-gzip the tar file, extract the files, and follow the instructions in README.pdf to run the program.
You should run this code on the Linux network to do the experiments described below.
If you have any questions about this code (or if you are not familiar with C), feel free to e-mail me or come see me.
You will be writing a fitness function for the genetic algorithm to perform feature selection for a naive Bayes classifier. The individuals are bit strings of length 57. Each position in the string is an off/on switch for the corresponding attribute in the UCI spam database. Suppose you have a training set spam.train, a validation set spam.val, and a test set spam.test. The fitness of individual c is calculated as follows:
FITNESS_FUNCTION_NAME "feature selection" MAX_NUM_FUNCTION_EVALS 1000 # Maximum of 50 generations POP_SIZE 20 CHROM_LENGTH 57 ELITISM TRUE FITNESS_FUNCTION_OPTIMUM_KNOWN TRUE FITNESS_FUNCTION_OPTIMUM 1. RUN_NUM_DIR "
All other parameters can stay the same as in the original params file.
Give the recorded information from steps 4 and 5 in table form in your writeup, and write a one-paragraph discussion.
SELECTION_METHOD "fitness proportionate"
in the params file. Once your run is done, choose one generation G and choose a schema s. Using information given in the .long file, record the number of instances of s at generation G and at generation G + 1. along with their fitnesses. Now use the Schema Theorem to compute the predicted change in frequency of s over one generation. In your writeup, give the schema you chose, show your work in the calculation, and describe how the predicted result compares with the observed result.