最大化具有许多参数的函数(python) [英] Maximize a function with many parameters (python)

查看:115
本文介绍了最大化具有许多参数的函数(python)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我要说的是我缺乏科学数学或统计学的经验-因此这可能是一个非常著名的问题,但是我不知道从哪里开始.

first, let me say that I lack experiences with scientific math or statistics - so this might be a very well-known problem, but I don't know where to start.

我有一个函数f(x1, x2, ..., xn),在这里我需要猜测x'ses并找到f的最大值.该函数具有以下属性:

I have a function f(x1, x2, ..., xn) where I need to guess the x'ses and find the highest value for f. The function has the following properties:

  • 总数或参数通常在40到60之间,因此不可能采用暴力手段.

  • the total number or parameters is usually around 40 to 60, so a brute-force approach is impossible.

每个x的可能值范围为0.01到2.99

the possible values for each x range from 0.01 to 2.99

函数稳定,这意味着较高的f值意味着对参数的猜测更好,反之亦然.

the function is steady, meaning that a higher f value means that the guess for the parameters is better and vice versa.

到目前为止,我在python中实现了一个非常基本的方法.最初,它将所有参数设置为1,随机猜测新值并检查f是否比以前高.如果不是,请回滚到以前的值. 在一个具有10,000次迭代的循环中,这似乎可以某种方式起作用,但是结果可能还远非完美.

So far, I implemented a pretty basic method in python. It initially sets all parameters to 1, randomly guesses new values and checks if the f is higher than before. If not, roll back to the previous values. In a loop with 10,000 iterations this seems to work somehow, but the result is propably far from being perfect.

任何有关如何改进对最佳参数的搜索的建议将不胜感激.搜寻此问题时,出现了链接MCMC的问题,但这似乎是一种非常高级的方法,我甚至需要很多时间才能理解该方法. 基本的提示或概念对我的帮助远胜于详尽的方法和算法.

Any suggestions on how to improve the search for the optimal parameters will be appreciated. When googling this issue things linke MCMC came up, but that seems like a very advanced method and I would need a lot of time to even understand the method. Basic hints or concepts would help me more than elaborated methods and algorithms.

推荐答案

不要自己做.安装 SciPy 并使用其 scipy.optimize.minimize 看起来很合适.

Don't do it yourself. Install SciPy and use its optimization routines. scipy.optimize.minimize looks like a good fit.

这篇关于最大化具有许多参数的函数(python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆