我想知道两种方法scipy.optimize.leastsq
和scipy.optimize.least_squares
之间的区别是什么?scipy.leastsq和scipy.least_squares之间的区别
当我实现了他们,他们产生的志^ 2的细微差别:
>>> solution0 = ((p0.fun).reshape(100,100))
>>> # p0.fun are the residuals of my fit function np.ravel'ed as returned by least_squares
>>> print(np.sum(np.square(solution0)))
0.542899505806
>>> solution1 = np.square((median-solution1))
>>> # solution1 is the solution found by least_sq, it does not yield residuals thus I have to subtract it from the median to get the residuals (my special case)
>>> print(np.sum((solution1)))
0.54402852325
任何人可以就此展开或指出在哪里可以找到替代的文件,从SciPy的一个有点神秘。