GeneXproTools 4.0 comes equipped with 30 built-in fitness functions for
Logic Synthesis 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[4] = number of samples in the predominant class (function output 0 or 1)
- 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[4] = number of samples in the predominant class (function output 0 or 1)
// 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 fitness = 0.0;
for (var i=0; i<nSamples; i++)
{
// 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.
|