pythondeap

DEAP: what does the indpb parameter do in the mutPolynomialBounded function?


The DEAP documentation states that deap.tools.mutPolynomialBounded takes five parameters. However, only the first four are described. Why is indpb needed?

In the code, it appears to be the mutation probability, but how is it different from the mutation probability that is specified when calling eaSimple for instance?

How is having these two mutation probabilities different from having just one mutation probability that is mutpb * indpb ?


Solution

  • In DEAP, indpb is the probability of a gene changing its original value to its allele. mutpb, on the other hand, determines whether an individual (chromosome) will mutate at all.

    So, after crossover, each offspring (child/new individual) needs to first detemine whether it mutates or not, i.e., random.random() < mutpb. If yes, then indpb will actually determine how many genes in the offspring (child) are actually get changed, i.e., random.random() <= indpb.

    A dummy example: let's say, you have an offspring [1, 3, 2, 2, 1]. The indpb will control how many and which values in here get changed. However, whether this offspring is actually going to mutate or not is up to mutpb.