考虑这个简单的优化代码:
from symfit import *
x1 = 1
x2 = 4
p1, p2 = parameters('p1, p2')
model = p1*p2
constraints = [
Eq(x1*p1+(x2-x1)*p2, 1),
Ge(p1, p2),
Ge(p2, 0)
]
fit = Fit(- model, constraints=constraints)
fit_result = fit.execute()
print(fit_result)
这给了我以下警告:
/home/user/.local/lib/python3.5/site-packages/symfit/core/fit.py:1783: RuntimeWarning: invalid value encountered in double_scalars
return 1 - SS_res/SS_tot
这是什么原因造成的?