|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbodhidharma.classifiers.genetic_algorithms.Evaluator
bodhidharma.classifiers.genetic_algorithms.ClassifierSelectionEvaluator
public class ClassifierSelectionEvaluator
Objects of this class evaluate and interpret the meaning of bit strings stored in
genetic algorithm Chromosome
objects. Each bit in the bit string
represents the on (1) or off (0) setting of a classifier. Classifiers with an on
setting are used for final classification and classifiers with an off are not used
in final classification. This Evaluator
is used for classifier selection.
The fitness value is calculated by performing a combined classification using equal
weighting for all of the classifiers.
KNN
,
Chromosome
,
Breeder
Field Summary |
---|
Fields inherited from class bodhidharma.classifiers.genetic_algorithms.Evaluator |
---|
bit_string_length |
Constructor Summary | |
---|---|
ClassifierSelectionEvaluator(double[][][] test_classifier_results,
int[][] correct_classifications,
int number_categories,
ClassificationResultsInterpereter results_interpereter)
Basic constructor. |
Method Summary | |
---|---|
double |
getFitness(short[] bit_string)
Return the fitness of a chromosome given its DNA (bit string). |
java.lang.Object[] |
parseBitString(short[] bit_string)
Returns an array of Booleans holding the meaning of the given bit string of a Chromosome . |
Methods inherited from class bodhidharma.classifiers.genetic_algorithms.Evaluator |
---|
getBitStringLength |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassifierSelectionEvaluator(double[][][] test_classifier_results, int[][] correct_classifications, int number_categories, ClassificationResultsInterpereter results_interpereter)
test_classifier_results
- Test classifier result values that will be classified to test performance. First indice indicates classifier, second indice indicates recording and third indice indicates category. Value of 1 for first indice corresponds to single-dimensional feature classifier. Is null if this classifier not used.correct_classifications
- Model classifications of test_classifier_results. First indice indicates recording. Entries indicate the indices of the categories that are correct classifications.number_categories
- The possible number of categories into which recordings can be classified.results_interpereter
- Used to perform actual classifications so that fitnesses can be performed. Default fitness will be used if null.Method Detail |
---|
public double getFitness(short[] bit_string) throws java.lang.Exception
If all classifiers in the bit string are set to off (0), then one of them is randomly chosen to be set to 1
The fitness is calculated for each recording and category, and then averaged over all recordings.
There are two ways of calculating fitness. The first is used if the results_interpereter field is not null, and the second if it is null. The first way gives a fitness based on the fraction of correct classifications based on the given bit_string.
The alternative fitness for a category of a recording is set equal to the difference between the average score of the classifiers and 1 if the recording does belong to the given category and 0 if it does not.
Throws an exception if there is a problem with the classification or if the length of the bit_string is not equal to the length of the bit_string_length field.
getFitness
in class Evaluator
java.lang.Exception
public java.lang.Object[] parseBitString(short[] bit_string) throws java.lang.Exception
Chromosome
. Values of 1 in the given bit_string
are set to true and values of 0 are set to false. There is one element
in the returned array for each bit in the bit_string. Bit strings
passed to this method should be of the same length as the length specified
in the constructor of this object.
Automatically sets the first entry to false if test_classifier_results[0] is null.
Throws an exception if the length of the bit_string is not equal to the length of the bit_string_length> field.
parseBitString
in class Evaluator
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |