Returns the individual with one of the mutations applied to it
roll = np.random.random()
if roll <= 1/3:
return gp.mutUniform(individual, expr=self._toolbox.expr_mut, pset=self._pset)
elif roll <= 2/3:
return gp.mutInsert(individual, pset=self._pset)
After Change
partial(gp.mutInsert, pset=self._pset),
partial(gp.mutShrink)
]
return np.random.choice(mutation_techniques)(individual)
def _gen_grow_safe(self, pset, min_, max_, type_=None):
Generate an expression where each leaf might have a different depth
between *min* and *max*.