Subject: | |
From: | |
Reply To: | |
Date: | Fri, 28 Aug 2009 10:56:56 +0200 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Zheng Yin wrote:
> How can I control ADF tree size? It looks like it goes through crossover
> and mutation just as the Main tree. I guess the parameter,
> gp.koza.xover.maxdepth will affect all trees, main one, ADF trees.
Could I
> set it separately for Main tree and ADF trees? such as I need the main
> tree has depth 10 and the ADFs have depth 5. How can I set it?
> Many thanks and looking forward to your answer.
You're right that the maximum depth is a parameter set in the breeding
pipeline rather than in the particular tree in an ADF forest. One way
to deal with it is to simply modify the Crossover.java code. This isn't
all that hard -- you just have it pick the maximum tree depth based on
the index of the tree (to your liking).
But in fact there is a way to do this without any code hacking though
it's pretty roundabout. If you have a main tree and (say) two ADF
trees, you need to create three Crossover operators, each with the same
probability of occurring. For example, instead of the standard Koza
crossover pipeline (found in koza.params):
pop.subpop.0.species.pipe = ec.breed.MultiBreedingPipeline
# Koza's decision here was odd...
pop.subpop.0.species.pipe.generate-max = false
# Subsidiary pipelines:
pop.subpop.0.species.pipe.num-sources = 2
pop.subpop.0.species.pipe.source.0 = ec.gp.koza.CrossoverPipeline
pop.subpop.0.species.pipe.source.0.prob = 0.9
pop.subpop.0.species.pipe.source.1 = ec.breed.ReproductionPipeline
pop.subpop.0.species.pipe.source.1.prob = 0.1
... you instead write:
pop.subpop.0.species.pipe = ec.breed.MultiBreedingPipeline
pop.subpop.0.species.pipe.generate-max = false
pop.subpop.0.species.pipe.num-sources = 5
pop.subpop.0.species.pipe.source.0 = ec.breed.ReproductionPipeline
pop.subpop.0.species.pipe.source.0.prob = 0.1
pop.subpop.0.species.pipe.source.1 = ec.gp.koza.CrossoverPipeline
pop.subpop.0.species.pipe.source.1.prob = 0.3
pop.subpop.0.species.pipe.source.2 = ec.gp.koza.CrossoverPipeline
pop.subpop.0.species.pipe.source.2.prob = 0.3
pop.subpop.0.species.pipe.source.3 = ec.gp.koza.CrossoverPipeline
pop.subpop.0.species.pipe.source.3.prob = 0.3
Now we need to force each of those pipelines to only cross over a
certain tree:
pop.subpop.0.species.pipe.source.1.tree.0 = 0
pop.subpop.0.species.pipe.source.1.tree.1 = 0
pop.subpop.0.species.pipe.source.2.tree.0 = 1
pop.subpop.0.species.pipe.source.2.tree.1 = 1
pop.subpop.0.species.pipe.source.3.tree.0 = 2
pop.subpop.0.species.pipe.source.3.tree.1 = 2
...and finally now that each of those crossover operators is working on
its own specific tree we can then specify a maximum depth as we like:
pop.subpop.0.species.pipe.source.1.maxdepth = 29
pop.subpop.0.species.pipe.source.2.maxdepth = 42
pop.subpop.0.species.pipe.source.3.maxdepth = 15
I admit this is hardly elegant, but it does get the job done. Assuming
I typed it correctly here...
Sean
|
|
|