简体   繁体   English

Python:最小化具有潜在随机输出的函数

[英]Python: Minimization of a function with potentially random outputs

I'm looking to minimize a function with potentially random outputs. 我正在寻求最小化具有潜在随机输出的功能。 Traditionally, I would use something from the scipy.optimize library, but I'm not sure if it'll still work if the outputs are not deterministic. 传统上,我会使用scipy.optimize库中的某些内容,但是我不确定如果输出不确定,它是否仍然可以使用。

Here's a minimal example of the problem I'm working with: 这是我正在处理的问题的最小示例:

def myfunction(self, a): 
    noise = random.gauss(0, 1)
    return abs(a + noise)

Any thoughts on how to algorithmicly minimizes its expected (or average) value? 关于如何以算法最小化其预期(或平均值)值的任何想法?

A numerical approximation would be fine, as long as it can get "relatively" close to the actual value. 只要可以“相对”接近实际值,则数值近似就可以了。

We already reduced noise by averaging over many possible runs, but the function is a bit computationally expensive and we don't want to do more averaging if we can help it. 我们已经通过对许多可能的运行进行平均来降低噪声,但是该函数在计算上有点昂贵,并且如果可以帮助的话,我们不想进行更多的平均。

It turns out that for our application using scipy.optimize anneal algorithm provided a good enough estimate of the local maximum. 事实证明,对于我们的应用程序,使用scipy.optimize退火算法可以很好地估计局部最大值。

For more complex problems, pjs points out that Waeber, Frazier and Henderson (2011) link provides a better solution. 对于更复杂的问题,pjs指出Waeber,Frazier和Henderson(2011) 链接提供了更好的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM