Home About Us Contact Blog
 
 
What's New Products Buy Now Downloads Forum  


GeneXproTools Online Guide

Learn how to use the 5 modeling platforms
of GeneXproTools with the Online Guide

   
 
 
Last update: February 19, 2014

 

Custom Fitness Function for Regression

GeneXproTools allows you to design your own custom fitness functions and then use them to create models.



GeneXproTools gives you access to a wide set of essential and useful parameters you may use to design your fitness functions. Note that most of these parameters, such as the model bounds and the parsimony pressure and variable pressure, are adjustable parameters easily accessible through the Fitness Function Tab in the Settings Panel:

  • 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
  • aParameters[10] = identifies the dataset: "1" for Training and "0" for Validation
  • aParameters[15] = Lower Bound
  • aParameters[16] = Upper Bound
  • aParameters[17] = Parsimony Pressure Rate
  • aParameters[18] = Variable Pressure Rate

In addition, GeneXproTools also gives you access to useful information about the structure and composition of evolving models that are essential for designing custom fitness functions that favor simpler or more complex solutions:

  • 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. Note that GeneXproTools uses fitness proportionate selection to select the models and, therefore, fitness must increase with performance and only non-negative values are acceptable. Below is the sample code of a simple custom fitness function, based on the RMSE. It's an example of a valid custom fitness function for regression problems. Note that in this case maximum fitness equals 1000 both for the training and validation datasets, and you must also feed this information into GeneXproTools through the Custom Fitness Function window so that all the charts in the Run Panel show correctly.


/////////////////////////////////////////////////////////////////////////////
// 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

// aParameters[10] = identifies the dataset: "1" for Training and "0" for Validation

// aParameters[15] = Lower Bound
// aParameters[16] = Upper Bound

// aParameters[17] = Parsimony Pressure Rate
// aParameters[18] = Variable Pressure Rate


// 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

// gepFilePath: local variable with the full path to the gep file

// Your custom fitness function must return a value, for example:
// return fitness;

// Below is an example of a simple fitness function, the Root Mean Squared Error (RMSE) 
// fitness function of GeneXproTools, for which maximum fitness is equal to 1000:

     // ROOT MEAN SQUARED ERROR FITNESS
     var nRecords = aParameters[0];
     var fitness = 0.0;
     var modelMinusTargetSquared = 0.0;
     var RMSE = 0.0;
     for (var nR=0; nR<nRecords; nR++)
     {
          var temp1 = 0.0;
          temp1 = aOutputModel[nR] - aOutputTarget[nR]; 
          temp1 *= temp1;
          modelMinusTargetSquared += temp1;
     } 

     RMSE = modelMinusTargetSquared / nRecords;

     if (RMSE <= 0.000000001)
          RMSE = 0.0;

     RMSE = Math.sqrt(RMSE);

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

     return fitness;

/////////////////////////////////////////////////////////////////////////////     


See Also:


Related Tutorials:


Related Videos:



Leave Feedback
 
  Please enter the number below using the combo boxes before sending your feedback.
 3 8 4
   

 

 Time Limited Trial

 Try GeneXproTools for free for 30 days!

 Released February 19, 2014

 Last update: 5.0.3883



New Entries  



Add-ons − GeneXproServer  

   Subscribe to the GEP-List

3 8 4
   
 
 
Home | What's New | Products | Buy Now | Downloads | Quick Tour | Support | Contact Us | About Gepsoft | Sign Up
Forum | Blog | Videos | Tutorials | Server Knowledge Base | Logistic Regression Guide | Terms of Use | Privacy & Cookies
 
 

Copyright (c) 2000-2021 Gepsoft Ltd. All rights reserved.