2 new revisions:
Revision: 3ce12c6521d2
Branch: default
Author: felix.antoine.fortin
Date: Wed Apr 30 19:56:51 2014 UTC
Log: Change the generate default type in gp to pset.ret....
http://code.google.com/p/deap/source/detail?r=3ce12c6521d2
Revision: 1c6ff47c8bdf
Branch: default
Author: felix.antoine.fortin
Date: Wed Apr 30 20:07:22 2014 UTC
Log: Update release highlights.
http://code.google.com/p/deap/source/detail?r=1c6ff47c8bdf
==============================================================================
Revision: 3ce12c6521d2
Branch: default
Author: felix.antoine.fortin
Date: Wed Apr 30 19:56:51 2014 UTC
Log: Change the generate default type in gp to pset.ret.
This fixes a problem when a STGP user would forget
to set the type_ argument, the generate function
would request primitive of the type 'object'. The
type_ argument is only to accomodate GP mutations.
It is from now on set to None by default, and
replace by pset.ret if the no other type has been
specified.
http://code.google.com/p/deap/source/detail?r=3ce12c6521d2
Modified:
/deap/gp.py
/examples/gp/spambase.py
=======================================
--- /deap/gp.py Wed Mar 26 21:42:45 2014 UTC
+++ /deap/gp.py Wed Apr 30 19:56:51 2014 UTC
@@ -487,7 +487,7 @@
######################################
# GP Program generation functions #
######################################
-def genFull(pset, min_, max_, type_=__type__):
+def genFull(pset, min_, max_, type_=None):
"""Generate an expression where each leaf has a the same depth
between *min* and *max*.
@@ -503,7 +503,7 @@
return depth == height
return generate(pset, min_, max_, condition, type_)
-def genGrow(pset, min_, max_, type_=__type__):
+def genGrow(pset, min_, max_, type_=None):
"""Generate an expression where each leaf might have a different depth
between *min* and *max*.
@@ -522,7 +522,7 @@
(depth >= min_ and random.random() < pset.terminalRatio)
return generate(pset, min_, max_, condition, type_)
-def genHalfAndHalf(pset, min_, max_, type_=__type__):
+def genHalfAndHalf(pset, min_, max_, type_=None):
"""Generate an expression with a PrimitiveSet *pset*.
Half the time, the expression is generated
with :func:`~deap.gp.genGrow`,
the other half, the expression is generated
with :func:`~deap.gp.genFull`.
@@ -537,7 +537,7 @@
method = random.choice((genGrow, genFull))
return method(pset, min_, max_, type_)
-def genRamped(pset, min_, max_, type_=__type__):
+def genRamped(pset, min_, max_, type_=None):
"""
.. deprecated:: 1.0
The function has been renamed. Use :func:`~deap.gp.genHalfAndHalf`
instead.
@@ -546,7 +546,7 @@
FutureWarning)
return genHalfAndHalf(pset, min_, max_, type_)
-def generate(pset, min_, max_, condition, type_=__type__):
+def generate(pset, min_, max_, condition, type_=None):
"""Generate a Tree as a list of list. The tree is build
from the root to the leaves, and it stop growing when the
condition is fulfilled.
@@ -562,6 +562,8 @@
:returns: A grown tree with leaves at possibly different depths
dependending on the condition function.
"""
+ if type_ is None:
+ type_ = pset.ret
expr = []
height = random.randint(min_, max_)
stack = [(0, type_)]
=======================================
--- /examples/gp/spambase.py Fri Feb 14 16:38:34 2014 UTC
+++ /examples/gp/spambase.py Wed Apr 30 19:56:51 2014 UTC
@@ -71,7 +71,7 @@
creator.create("Individual", gp.PrimitiveTree, fitness=creator.FitnessMax)
toolbox = base.Toolbox()
-toolbox.register("expr", gp.genHalfAndHalf, pset=pset, type_=pset.ret,
min_=1, max_=2)
+toolbox.register("expr", gp.genHalfAndHalf, pset=pset, min_=1, max_=2)
toolbox.register("individual", tools.initIterate, creator.Individual,
toolbox.expr)
toolbox.register("population", tools.initRepeat, list, toolbox.individual)
toolbox.register("compile", gp.compile, pset=pset)
==============================================================================
Revision: 1c6ff47c8bdf
Branch: default
Author: felix.antoine.fortin
Date: Wed Apr 30 20:07:22 2014 UTC
Log: Update release highlights.
http://code.google.com/p/deap/source/detail?r=1c6ff47c8bdf
Modified:
/doc/releases.rst
=======================================
--- /doc/releases.rst Tue Apr 8 14:10:28 2014 UTC
+++ /doc/releases.rst Wed Apr 30 20:07:22 2014 UTC
@@ -80,4 +80,9 @@
- tools: add missing arguments to sortLogNondominated (`k`,
`first_front_only`). rev: `f60a6520b666`, `4de7df29dd0f`.
- gp: issue #32: :meth:`~deap.gp.PrimitiveTree.from_string` used incorrect
argument order with STGP. rev: `58c1a0711e1f`.
+**Release 1.0.2**:
+- benchmarks: fix computation of DTLZ2, DTLZ3 and DTLZ4.
+- cma 1+Lambda: fix the computation of the rank-one update.
+- gp: replace the generate functions default value for the argument
`type_` from `object` to `None`.
+ This removes the obligation to define the type_ argument for the
individual generation function when doing STGP.