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?
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