我试图找到2d插值的最小值。我真的坚持试图找到一种方法将数据适当地传递给优化器,
这是我到目前为止的代码:
import scipy
from scipy.interpolate import interp2d
a_ca_energy_interp = interp2d(a, c_a, Energy)
def run_2d_params(params, func):
a, b = params
return func(a, b)
scipy.optimize.fmin(run_2d_params, np.array([1.60,6.075]),
args=a_ca_energy_interp)
引发错误:
TypeError: can only concatenate tuple (not "interp2d") to tuple
答案 0 :(得分:1)
args
必须是一个元组,即使它只是一个参数:
scipy.optimize.fmin(run_2d_params, np.array([1.60,6.075]),
args=(a_ca_energy_interp, ))