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

Module tutorial4

source code

tutorial4

Contains all parameters for the evolutionary run, grammar rules, constraints, and specifics about the terminal and function set of the trees in tutorial4. 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 1 set of 1000 testing data (1000 different values for x and y). This time, each tree does not have to be evaluated 1000 times. We will input a list of 1000 data points in the variable leafs of the tree. There is not much time difference to process 1000 data-points than 5 when we use this trick! 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 = 1
  all_x = [9.77771930004, 4.7864537456, 1.59574738831, 0.0062713...
  all_y = [3.14855365174, 9.69422243713, 9.95023696046, 9.888698...
  nb_ex = 1000
  ideal_results = []
  terminals = {'x': [9.77771930004, 4.7864537456, 1.59574738831,...
  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 = 999
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:
[9.77771930004,
 4.7864537456,
 1.59574738831,
 0.006271368459,
 4.86481223268,
 2.39507243103,
 8.62602256503,
 9.02128694753,
...

all_y

Value:
[3.14855365174,
 9.69422243713,
 9.95023696046,
 9.88869817556,
 0.256794787615,
 1.31482718014,
 0.31910563847,
 3.29345198798,
...

terminals

Value:
{'x': [9.77771930004,
       4.7864537456,
       1.59574738831,
       0.006271368459,
       4.86481223268,
       2.39507243103,
       8.62602256503,
       9.02128694753,
...

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\
...