Module tutorial1
[hide private]
[frames] | no frames]

Module tutorial1

source code

tutorial1

Contains all parameters for the evolutionary run, grammar rules, constraints, and specifics about the terminal and function set of the trees in tutorial1. This example file gather all the settings for a simple polynomial regression using one variable x and the following mathematical operators: '+','-','neg','*','^2'(or square),'cos','sin'. We try to find a third degree polynomial: x^3 + x^2 + cos(x) from 2 sets of testing data (2 different values for x). Considering the constraints for building the trees, the root node will only have one child, and there will be no need for ADF in the function and terminal set. A typical way to run the tutorial would be to:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Author: by Mehdi Khoury

Version: 1.20

Copyright: (c) 2009 Mehdi Khoury under the mit license http://www.opensource.org/licenses/mit-license.html

Contact: mehdi.khoury at gmail.com

Functions [hide private]
 
add(listElem) source code
 
sub(listElem) source code
 
neg(listElem) source code
 
multiply(listElem) source code
 
square(listElem) source code
 
cos(listElem) source code
 
sin(listElem) source code
 
rootBranch(x) source code
 
GetIdealResultsData() source code
 
FitnessFunction(my_tree) source code
Variables [hide private]
  functions = {'+': add, '-': sub, 'neg': neg, '*': multiply, '^...
  nb_eval = 2
  all_x = [0.418821298464, 6.25319749511]
  terminals = {'x': [0.418821298464, 6.25319749511]}
  ideal_results = [[1.1624461939], [284.617552503]]
  crossover_mapping = []
  defaultFunctionSet = [(1, 2, '+'), (1, 2, '*'), (1, 1, '^2'), ...
  defaultTerminalSet = [(3, 0, 'x')]
  treeRules = {'*': [([(1, 2, '+'), (1, 2, '*'), (1, 1, '^2'), (...
  Strongly_Typed_Crossover_degree = 0
  Substitute_Mutation = 0
  adfOrdered = False
  __package__ = None
  i = 1
Variables Details [hide private]

functions

Value:
{'+': add, '-': sub, 'neg': neg, '*': multiply, '^2': square, 'cos': c\
os, 'sin': sin, 'root': rootBranch}

defaultFunctionSet

Value:
[(1, 2, '+'),
 (1, 2, '*'),
 (1, 1, '^2'),
 (1, 2, '-'),
 (1, 1, 'cos'),
 (1, 1, 'sin'),
 (1, 1, 'neg')]

treeRules

Value:
{'*': [([(1, 2, '+'),
         (1, 2, '*'),
         (1, 1, '^2'),
         (1, 2, '-'),
         (1, 1, 'cos'),
         (1, 1, 'sin'),
         (1, 1, 'neg')],
        [(3, 0, 'x')]),
...