2

In the DEAP algorithms (see documentation here), I notice that we need to specify the the number of generations (NGEN). I was advised that convergence has been achieved if the Pareto curve is smooth.

It is possible to monitor for convergence by specifying a "smoothness" value in the stats. However, I'm still confused about how to define "smoothness". For example, consider the Knapsack problem specified here. How do we monitor for smoothness in this example? In general, how can I monitor for convergence in DEAP?

1 Answer 1

3

You can use the logbook statistics to monitor various measures. Just define "smoothness" as an observable and quit iterating as soon as it hits your desired value.

def smoothness(pop):
    pareto = tools.ParetoFront()
    pareto.update(pop)
    return xxx       # <-- need to fill you measure here

stats = tools.Statistics()
stats.register("smoothness", smoothness)

If you are using deap for symbolic regression you might want to have a look at https://github.com/Ambrosys/glyph . It is still in its early stages though. Glyph is build on top of deap currently and tries to hide the boilerplate code. You can set custom break conditions too: https://github.com/Ambrosys/glyph/blob/master/glyph/application.py#L131

3
  • How do I define smoothness? I can see that I can monitor the average, minimum, and maximum fitness at each generation. How do I specify "smoothness"?
    – meraxes
    Feb 8, 2017 at 1:17
  • I edited my answer above. How you define smoothness depends on your problem/domain.
    – Ohjeah
    Feb 8, 2017 at 1:59
  • Alright. A little help though with defining smoothness. For example, consider the Knapsack problem: deap.readthedocs.io/en/master/examples/ga_knapsack.html How would I define the smoothness for such?
    – meraxes
    Feb 8, 2017 at 2:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.