如何找到遗传算法的最佳参数?

发布于 2024-07-26 04:54:37 字数 230 浏览 7 评论 0原文

一些遗传算法框架,例如 http://www.aforgenet.com/ 需要很多参数,例如变异比率、人口规模等

这些参数有通用的最佳数字吗? 我相信这取决于问题(适应度函数延迟、突变延迟、重组延迟、进化率等)。 我的第一个想法是使用一个 GA 来配置另一个 GA。

还有更好的想法吗?

Some Genetic Algorithm frameworks, such as http://www.aforgenet.com/ requires many parameters, such as mutation rate, population size, etc

There is universal best numbers for such parameters? I believe that it depends on the problem (fitness function delay, mutation delay, recombination delay, evolution rate, etc). My first thought was to use a GA to configure another GA.

Any better ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

鯉魚旗 2024-08-02 04:54:37

我发现将这些问题想象成一幅风景是有帮助的,你试图在其中找到最低点。

当景观太大而无法仅测试所有点时,就会使用遗传算法等方法,并且景观的“形状”使得梯度下降等方法会让您陷入局部最小值。

Rastrigin 函数就是一个很好的例子(图像参考) :
替代文本
(来源:scientific-computing.com

您的选择是:

代大小:

  • 太大: 您将有一个
    长纪元时间,限制多少
    每个人都有机会
    探索它的邻里。
  • 太小:你不会变得很好
    搜索空间的覆盖范围。

突变率:

  • 太高:你会给个体带来风险
    “跳过”他们的解决方案
    相近。
  • 太低:他们都会得到
    陷入局部最小值。

所以它确实取决于您自己的特定搜索空间。 对参数进行试验并尝试找到最佳组合。 我同意使用另一个遗传算法来优化参数并不能解决问题。

I find it helps to think of these problems as a landscape, where you're trying to find the lowest point.

Methods like genetic algorithms are used when the landscape is too large to just test all the points, and the "shape" of the landscape is such that methods like gradient-descent will get you stuck in local minima.

One good example is Rastrigin's function (image ref):
alt text
(source: scientific-computing.com)
:

Your choices are:

Generation size:

  • Too large: you're going to have a
    long epoch time, restricting how many
    chances each individual has to
    explore it's neighbourhood.
  • Too small: you don't get good
    coverage of the search space.

Mutation rate:

  • Too high: you risk the individuals
    "jumping" over a solution they were
    close to.
  • Too low: they're all going to get
    stuck in local minima.

So it really does depend on your own particular search space. Experiment with the parameters and try to find the optimal combination. I would agree that using another GA to optimise the parameters is not going to solve the problem.

为你鎻心 2024-08-02 04:54:37

我发现相当令人失望的是,有这么多答案假设您无法自动找到遗传算法的最佳参数。 我同意参数确实取决于问题,但是您可以通过一些方法找到它们。

此外,否免费午餐定理决不会阻止您找到最佳参数,因为已经有讨论质疑这一事实:

参数设置有两种:

  • Parameter Tuning(离线参数搜索) - 在 GA 运行之前)
  • 参数控制(在线参数调整 - 在 GA 运行期间)
    • 自适应
    • 自适应
    • 确定性

有很多文献描述了如何找到这些最佳参数,这取决于您是想离线还是在线进行参数搜索。 人们普遍认为,离线更适合大多数情况,因为在线参数控制方法会比离线增加太多复杂性。

以下是一些寻找“最佳”参数的示例:

参数调整

参数控制

还有更多,只需使用上面使用的关键字搜索文献即可。 有科学方法可以为任何给定问题找到合适的参数!

I find it rather disappointing there are so many answers that assume you can't find the best parameters for the Genetic Algorithm automatically. I agree that the parameters does depend on the problem however there are methods where you can find them.

Additionally the No Free Lunch Theorem by no means stops you from finding the best parameters, as there have already been discussion that disputes the fact:

There are two types of parameter setting:

  • Parameter Tuning (offline parameter search - before the GA is run)
  • Parameter Control (online parameter tweaking - during the GA run)
    • Adaptive
    • Self Adaptive
    • Deterministic

There are a lot of literature out there that describe how one can find these optimal parameters, it depends whether you are wanting to do the parameter search offline or online. Popular belief is that offline is better suited for most cases because the online parameter control methods would add too much complexity over offline.

Here are some examples to find the "best" parameters:

Parameter Tuning:

Parameter Control:

And many more, just search for the literature using keywords used above. There are scientific methods for finding suitable parameters for any given problem!

污味仙女 2024-08-02 04:54:37

这并不容易。

为什么? 由于没有免费的午餐定理。 这基本上表明,不存在适用于所有问题的通用搜索算法。

您能做的最好的事情就是针对特定问题空间定制搜索。 您必须手动调整参数以适合您的解决方案。 对不起。

使用 GA 查找 GA 参数变得很复杂。 如何找到 GAGA 搜索的最佳参数? 另一个GA...?

It ain't easy.

Why? Because of the No Free Lunch theorem. This basically states that there is no general search algorithm that works well for all problems.

The best you can do is tailor the search for a specific problem space. You'll have to manually tweak your parameters to fit your solution. Sorry.

Using a GA to find GA parameters gets complicated. How do you find the optimal parameters for your GAGA search? Another GA...?

一刻暧昧 2024-08-02 04:54:37

有一次我编写了一种遗传算法,我将这些值包含在要变异的值中,基本上就像您所说的使用 GA 来配置自身一样。 它的工作效果出奇的好,特别是因为我发现它对于在计算过程中改变这些值是有益的。

The one time I programmed a genetic algorithm I included those values in the values to mutate, basically like you said using a GA to configure itself. It worked surprisingly well, especially since I've found it to be beneficial for those values to change over the course of it's computation.

尸血腥色 2024-08-02 04:54:37

对于给定的数据集确实没有一种自动的方法。 如果有的话,他们不会公开这些参数。 使用第二个 GA 来调整第一个 GA 的参数是危险的——您是否使用第三个 GA 来调整第二个 GA 的参数? 即使你这样做了,这仍然会导致过度拟合。

我的建议是使用这些参数,看看它们如何影响每一代的种群分布,需要多少代才能得到可接受的答案,等等。如果突变太多,您的种群将永远不会稳定。 太少,你最终会得到同质化。

遗传算法的一个肮脏的秘密是,调整它们是一门艺术,而不是一门科学。

There really isn't an automatic way to do it for a given dataset. If there were, they wouldn't expose those parameters. Using a second GA to tune the parameters of the first GA is perilous -- do you use a third GA to tune the parameters of the second? Even if you did that, it's a recipe for overfitting anyway.

My advice would be to play with the parameters, and see how they affect your population distrubution at each generation, how many generations it takes to get to an acceptable answer, etc. If you have too much mutation your population will never stabilize. Too little and you'll end up with homogeneity.

It's a dirty secret of GAs that tuning them is an art, not a science.

终止放荡 2024-08-02 04:54:37

正如其他人所说,没有一个答案。 尽管有一些倾向在 0.7-0.9 水平上使用交叉率,在 0.1-0.3 水平上使用突变,但这实际上取决于情况。 取决于问题,可能取决于适应度函数,并且肯定取决于遗传算法本身。 遗传算法有很多变体,同一问题的最佳参数可能会有所不同。

至于使用GA来调整目标GA的参数,有类似的方法,但是,正如所指出的,如何调整第一个GA的参数? 请记住,也许突变率在开始时应该较高,然后应该下降,而交叉率应该增加。 这是探索与利用的问题。 有一些方法可以让遗传算法更具适应性,并让它在寻找解决方案时改变其参数。 模糊控制器有时用于操纵遗传算法的参数。 还有其他方法。

如果您想了解更多,请购买一些书籍,或查看学术研究论文。
如果您需要在没有广泛研究的情况下设置自己的 GA,请尝试其他工作中的一些值,并进行实验。

As everyone else said, there is no one answer. Although there is some tendency to use crossover rate on level 0.7-0.9 and mutation on 0.1-0.3 it really depends. Depends on problem, may depend on fitness function, and definitely depends on Genetic Algorithm itself. There are many GA variations, optimal parameters for the same problem may vary.

As for using GA to tune parameters of target GA there are approaches like that, but, as it was pointed out, how to tune parameters of first GA? Keep in mind, that maybe mutation rate should be higher at the beginning, and than it should decreasing while cross over rate should be increasing. It is issue of exploration versus exploitation. There are approaches to let GA be more adaptive and let it change its parameters as it looks for solution. Fuzzy controllers are sometimes used to manipulate parameters of GA. There are also other approaches.

If you want to know about it more, buy some books, or look through academic research papers.
If you need to setup your own GA without extensive research, try some values from others work, and experiment with them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文