GeneXproTools 4.0 comes equipped with 36 built-in fitness functions for
Function Finding 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.
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[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
MSE fitness function of GeneXproTools 4.0.
/////////////////////////////////////////////////////////
// All the values of the Target output
// are accessible through the array:
// aOutputTarget[0] = 2.549
// aOutputTarget[1] = 5.215
// etc.
// All the values of the output of the Model
// are accessible through the array:
// aOutputModel[0] = 78.6945
// aOutputModel[1] = 12.6421
// 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[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:
// the Mean Squared Error (MSE) fitness function of GeneXproTools,
// for which the maximum fitness is equal to 1000:
// MEAN SQUARED ERROR
var nSamples = aParameters[0];
var fitness = 0.0;
var modelMinusTargetSquared = 0.0;
var MSE = 0.0;
for (var i=0; i<nSamples; i++)
{
var temp1 = 0.0;
temp1 = aOutputModel[i] -
aOutputTarget[i];
temp1 *= temp1;
modelMinusTargetSquared += temp1;
}
MSE = modelMinusTargetSquared / nSamples;
if (MSE <= 0.000000001)
MSE = 0.0;
fitness = (1/(1+MSE))*1000;
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.
|