GeneXproTools 4.0 comes equipped with 30 built-in fitness functions for
Classification problems and, most probably, you will find among them a suitable fitness function for your problem. But if you want to try other fitness functions to model your data,
GeneXproTools 4.0 allows you to design fitness functions of your own and use them to search the fitness landscape.
You can design your own fitness function using the Custom Fitness Function window.
For all classification problems, in order to be able to apply a particular fitness function,
the learning algorithms of GeneXproTools 4.0 must convert the value returned by the evolved model into “1” or “0” using the
0/1 Rounding Threshold. If the value returned by the evolved model is equal to or greater than the rounding threshold, then the record is classified as “1”, “0” otherwise.
Thus, the 0/1 Rounding Threshold is an integral part of all fitness functions used for classification and must be appropriately set in the Settings Panel -> Fitness Function Tab.
GeneXproTools 4.0 gives you access to a wide set of essential and useful parameters you may use to design your fitness function:
- aParameters[0] = number of samples
- aParameters[1] = averaged target output
- aParameters[2] = variance of the target output
- aParameters[3] = 0/1 rounding threshold
- aParameters[4] = number of samples in the predominant class
- aParameters[5] = minimum program size
- aParameters[6] = maximum program size
In addition, GeneXproTools also gives you access to useful information about the evolving models
that are essential for designing custom fitness functions with parsimony
pressure:
- aModelInfo[0] = program size
- aModelInfo[1] = used variables
- aModelInfo[2] = number of literals
The code for the custom fitness function must be in JavaScript and can be tested before evolving a model with it. Please remember that
GeneXproTools 4.0 uses fitness proportionate selection and, therefore, fitness must increase with performance and only non-negative values are acceptable. Below is the sample code of a correct fitness function, which is identical to the
number of hits fitness function of GeneXproTools 4.0.
/////////////////////////////////////////////////////////
// All the values of the Target output
// are accessible through the array:
// aOutputTarget[0] = 0
// aOutputTarget[1] = 1
// aOutputTarget[2] = 0
// etc.
// All the values of the output of the Model
// are accessible through the array:
// aOutputModel[0] = 0
// aOutputModel[1] = 1
// aOutputModel[2] = 1
// etc.
// Essential and useful parameters you may use
// to design your fitness function:
// aParameters[0] = number of samples
// aParameters[1] = averaged target output
// aParameters[2] = variance of the target output
// aParameters[3] = 0/1 rounding threshold
// aParameters[4] = number of samples in the predominant class
// aParameters[5] = minimum program size
// aParameters[6] = maximum program size
// Useful information about the evolving models
// you may use to design your fitness function:
// aModelInfo[0] = program size
// aModelInfo[1] = used variables
// aModelInfo[2] = number of literals
// Your custom fitness function must return a value, for example:
// return fitness;
// Below is an example of a correct fitness function, more specifically,
// the Number of Hits fitness function of GeneXproTools, for which
// the maximum fitness is equal to the number of sample cases:
// NUMBER OF HITS
var nSamples = aParameters[0];
var roundingThreshold = aParameters[3];
var fitness = 0.0;
for (var i=0; i<nSamples; i++)
{
// Convert the value returned by the model into 1 or 0
if (aOutputModel[i] >= roundingThreshold)
{
aOutputModel[i] = 1;
}
else
{
aOutputModel[i] = 0;
}
// Evaluate fitness
if (aOutputModel[i] == aOutputTarget[i])
{
fitness++;
}
}
return fitness;
/////////////////////////////////////////////////////////
Obviously, in this case, maximum fitness equals 1000 both for the
training and testing sets, and you must also feed this information
into GeneXproTools through the Custom Fitness Function window in the
boxes Max. Training Fitness and Max. Testing Fitness.
|