Python / Scipy-将optimize.curve_fit的sigma实现为optimize.leastsq [英] Python / Scipy - implementing optimize.curve_fit 's sigma into optimize.leastsq

查看:244
本文介绍了Python / Scipy-将optimize.curve_fit的sigma实现为optimize.leastsq的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用逻辑模型拟合数据点。由于有时我的数据带有ydata错误,因此我首先使用curve_fit及其sigma参数在拟合中包括我的各个标准偏差。

I am fitting data points using a logistic model. As I sometimes have data with a ydata error, I first used curve_fit and its sigma argument to include my individual standard deviations in the fit.

现在我切换到minimumsq,因为我还需要一些curve_fit无法提供的拟合优度估计。一切正常,但是现在我错过了像cursor_fit一样权衡最小平方面积的可能性。

Now I switched to leastsq, because I needed also some Goodness of Fit estimation that curve_fit could not provide. Everything works well, but now I miss the possibility to weigh the least sqares as "sigma" does with curve_fit.

有人为我如何加权

谢谢,啄木鸟

推荐答案

I刚刚发现,可以使用选项full_output结合两全其美,并从curve_fit()获得完整的minimumsq()输出:

I just found that it is possible to combine the best of both worlds, and to have the full leastsq() output also from curve_fit(), using the option full_output:

popt, pcov, infodict, errmsg, ier = curve_fit(func, xdata, ydata, sigma = SD, full_output = True)

这给了我一个信息,我可以用来计算我所有的拟合优度,并让我同时使用curve_fit的sigma选项...

This gives me infodict that I can use to calculate all my Goodness of Fit stuff, and lets me use curve_fit's sigma option at the same time...

这篇关于Python / Scipy-将optimize.curve_fit的sigma实现为optimize.leastsq的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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