Home About Us Contact Search >>
Mean Squared Error Fitness Function  
Products Buy Now Downloads Support
 
 

Mean Squared Error Fitness Function

The JavaScript implementation of the Mean Squared Error fitness function is shown below. It is an example of a valid Custom Fitness Function of GeneXproTools 4.3. You can try it using the demo of GeneXproTools.

 
// 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 Model output
// 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 records
// 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 nRecords = aParameters[0];
var fitness = 0.0;
var modelMinusTargetSquared = 0.0;
var MSE = 0.0;
for (var nR=0; nR<nRecords; nR++)
{
    var temp1 = 0.0;
    temp1 = aOutputModel[nR] - aOutputTarget[nR]; 
    temp1 *= temp1;
    modelMinusTargetSquared += temp1;
} 

MSE = modelMinusTargetSquared / nRecords;

if (MSE <= 0.000000001)
    MSE = 0.0;

fitness = (1/(1+MSE))*1000;

return fitness;
 

Download a free trial of GeneXproTools
 
 
GeneXproTools  

   


GeneXproServer  


Tutorials


Quick Tour Videos




Gene Expression Programming


   Subscribe to the GEP-list
Enter 2 + 32 =
Signup Now

“Finally, a world class user interface in the field of genetic programming and evolutionary computation !! GeneXproTools is simply unrivaled in its marvelous user interface, the breadth of its Fitness Functions, the choice and flexibility in Math and Logic functions, the clarity of its final Model Presentation, and a built in panel for Scoring new data, right inside the interface. This kind of functionality and ease of use has never been seen before in the field of Genetic Programming. Additionally, Dr Ferreira’s specific methodology of Gene Expression Programming makes important contributions to the field of evolutionary computation, and the various algorithms she has developed and deployed inside of GeneXproTools are brilliantly conceived, and her methodologies evolve highly predictive models that solve real business problems. GeneXproTools is an extraordinary structural tour de force.“

Brian C. Watt, CRM
Chief Risk Officer
Chief Financial Officer
GECC Inc, USA
   
 

More

 
 
 
 
[an error occurred while processing this directive]