We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当使用目标函数时,有一些参数需要传入但不需要优化,例如:y=x[0]*b+x[1]**c+d x是需要优化的,但bcd是三个不需要优化的变量(需要传入目标函数)。在scipy库中用的是args{...},在sko中是如何实现的呢?
The text was updated successfully, but these errors were encountered:
我寻思这个不是目标函数内部实现吗
Sorry, something went wrong.
你可以选择 curry 化把你的目标函数修改一下,比如你的目标函数,你可以用lambda把参数 b,c,d都固定住:
lambda
b = 1 c = 2 d = 3 y = lambda x : x[0] * b + x[1] ** c + d
或者你使用下面的方法:
>> def curry1(b): ...: def curry2(c): ...: def curry3(d): ...: def f(x): ...: return x[0] * b + x[1] ** c + d ...: return f ...: return curry3 ...: return curry2 >> f = curry1(1)(2)(3)
无论哪种,你把 b ,c,d 都固定住之后就可以直接传到 sko 就可以
No branches or pull requests
当使用目标函数时,有一些参数需要传入但不需要优化,例如:y=x[0]*b+x[1]**c+d
x是需要优化的,但bcd是三个不需要优化的变量(需要传入目标函数)。在scipy库中用的是args{...},在sko中是如何实现的呢?
The text was updated successfully, but these errors were encountered: