Trees | Indices | Help |
|
---|
|
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:
>>> # setup for running tutorial 4 functions = tutorial4.functions crossover_mapping=tutorial4.crossover_mapping nb_eval=tutorial4.nb_eval nb_ex=tutorial4.nb_ex ideal_results=tutorial4.GetIdealResultsData() terminals =tutorial4.terminals Strongly_Typed_Crossover_degree=tutorial4.Strongly_Typed_Crossover_degree Substitute_Mutation=tutorial4.Substitute_Mutation treeRules = tutorial4.treeRules adfOrdered = tutorial4.adfOrdered FitnessFunction = tutorial4.FitnessFunction
These fitness functions are called in FitnessFunction in the tutorial4 module.
>>> def FitnessFunction(my_tree): >>> return evalfitness.FinalFitness2(evalfitness.EvalTreeForOneListInputSet(my_tree))
>>> import evolver if __name__ == "__main__": >>> dbname=r'C:\pop_db' >>> evolver.EvolutionRun(2000,(0,2,'root'),2,8,'AddHalfNode',100, 0.00001 ,0.5,0.49,7,0.8,dbname,True)
This means that we define:
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 = {'+': add, '*': multiply, 'adf2_+': add, 'adf2_*':
|
|||
crossover_mapping =
|
|||
nb_eval = 1
|
|||
all_x =
|
|||
all_y =
|
|||
nb_ex = 1000
|
|||
ideal_results =
|
|||
terminals =
|
|||
defaultFunctionSet =
|
|||
defaultTerminalSet =
|
|||
Adf2DefaultFunctionSet =
|
|||
Adf2DefaultTerminalSet =
|
|||
treeRules =
|
|||
Strongly_Typed_Crossover_degree = 1
|
|||
Substitute_Mutation = 0
|
|||
adfOrdered = True
|
|||
__package__ = None
|
|||
i = 999
|
|
functions
|
crossover_mapping
|
all_x
|
all_y
|
terminals
|
Adf2DefaultTerminalSet
|
treeRules
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Apr 15 11:50:09 2009 | http://epydoc.sourceforge.net |