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

Module tutorial3

source code

tutorial3

Contains all parameters for the evolutionary run, grammar rules, constraints, and specifics about the terminal and function set of the trees in tutorial3. This example file gather all the settings for a 'multiple' polynomial regression. We want to evolve a system of ordered polynomial equations by using the mathematical operators: '+','*' and the ADF: ADF1 and ADF2, in the said order. an ADF2 branch could then call for an ADF1 terminal, but not the opposite. We try to find the following model being shaped as a system of polynomials:

|ADF1=x+y

|ADF2=ADF1^3

from 30 sets of testing data (30 different values for x and y). This means the each tree has to be evaluated for every different example, so 30 times. There is an alternative solution which we will see in the next tutorial, where instead of evaluating a tree 30 times, we will input an array of 30 data in the variable leafs of the tree. Considering the constraints for building the trees, the root node will have 2 children ADF1 and ADF2 (in order), and ADF2 must be able to reuse ADF1 as a terminal... 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
 
multiply(listElem) source code
 
adfBranch(x) source code
 
rootBranch(x) source code
 
GetIdealResultsData() source code
 
FitnessFunction(my_tree) source code
Variables [hide private]
  functions = {'+': add, '*': multiply, 'adf2_+': add, 'adf2_*':...
  crossover_mapping = [('+', 'adf2_+'), ('adf2_+', '+'), ('*', '...
  nb_eval = 30
  all_x = [8.09938699279, 9.03762074198, 0.495149346389, 7.92205...
  all_y = [1.28810827642, 8.06456730404, 4.00789024978, 2.964539...
  ideal_results = []
  terminals = {'x': [8.09938699279, 9.03762074198, 0.49514934638...
  defaultFunctionSet = [(1, 2, '+'), (1, 2, '*')]
  defaultTerminalSet = [(3, 0, 'x'), (3, 0, 'y')]
  Adf2DefaultFunctionSet = [(1, 2, 'adf2_+'), (1, 2, 'adf2_*')]
  Adf2DefaultTerminalSet = [(3, 0, 'x'), (3, 0, 'y'), (5, 0, 'ad...
  treeRules = {'*': [([(1, 2, '+'), (1, 2, '*')], [(3, 0, 'x'), ...
  Strongly_Typed_Crossover_degree = 1
  Substitute_Mutation = 0
  adfOrdered = True
  __package__ = None
  i = 29
Variables Details [hide private]

functions

Value:
{'+': add, '*': multiply, 'adf2_+': add, 'adf2_*': multiply, 'adf1': a\
dfBranch, 'adf2': adfBranch, 'root': rootBranch}

crossover_mapping

Value:
[('+', 'adf2_+'), ('adf2_+', '+'), ('*', 'adf2_*'), ('adf2_*', '*')]

all_x

Value:
[8.09938699279,
 9.03762074198,
 0.495149346389,
 7.92205405914,
 6.60175700937,
 4.61266064743,
 9.82496636611,
 1.39273287538,
...

all_y

Value:
[1.28810827642,
 8.06456730404,
 4.00789024978,
 2.96453986033,
 4.75573240348,
 8.84938209358,
 2.76028008978,
 8.50156391661,
...

terminals

Value:
{'x': [8.09938699279,
       9.03762074198,
       0.495149346389,
       7.92205405914,
       6.60175700937,
       4.61266064743,
       9.82496636611,
       1.39273287538,
...

Adf2DefaultTerminalSet

Value:
[(3, 0, 'x'), (3, 0, 'y'), (5, 0, 'adf1')]

treeRules

Value:
{'*': [([(1, 2, '+'), (1, 2, '*')], [(3, 0, 'x'), (3, 0, 'y')]),
       ([(1, 2, '+'), (1, 2, '*')], [(3, 0, 'x'), (3, 0, 'y')])],
 '+': [([(1, 2, '+'), (1, 2, '*')], [(3, 0, 'x'), (3, 0, 'y')]),
       ([(1, 2, '+'), (1, 2, '*')], [(3, 0, 'x'), (3, 0, 'y')])],
 'adf1': [([(1, 2, '+'), (1, 2, '*')], [(3, 0, 'x'), (3, 0, 'y')])],
 'adf2': [([(1, 2, 'adf2_+'), (1, 2, 'adf2_*')],
           [(3, 0, 'x'), (3, 0, 'y'), (5, 0, 'adf1')])],
 'adf2_*': [([(1, 2, 'adf2_+'), (1, 2, 'adf2_*')], [(3, 0, 'x'), (3, 0\
...