2

在 DEAP 算法中(请参阅此处的文档),我注意到我们需要指定代数 (NGEN)。我被告知,如果帕累托曲线是平滑的,那么已经实现了收敛。

可以通过在统计数据中指定“平滑度”值来监控收敛。但是,我仍然对如何定义“平滑度”感到困惑。例如,考虑此处指定的背包问题。在这个例子中,我们如何监控平滑度?一般来说,我如何监控 DEAP 中的收敛?

4

1 回答 1

3

您可以使用日志统计信息来监控各种措施。只需将“平滑度”定义为可观察的,并在达到您想要的值时立即退出迭代。

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

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

如果您使用 deap 进行符号回归,您可能需要查看https://github.com/Ambrosys/glyph。不过,它仍处于早期阶段。Glyph 目前建立在 deap 之上,并试图隐藏样板代码。您也可以设置自定义中断条件:https ://github.com/Ambrosys/glyph/blob/master/glyph/application.py#L131

于 2017-02-08T00:37:05.737 回答