slug: scipy-optimize-curvefit datepublished: 2018-03-15T07:23:49 date_updated: 2018-03-15T07:23:49 tags: Acedemic Notes, English Posts excerpt: "the gist of it is, when fitting, use p0 argument to give initial point for fitting." –-
Isn't able to estimate the covariance of the parameter, thus raising the OptimizeWarning below Scipy Curve_fit
Today's lab ran into a problem that when people try to fit a function with
exponential and square root in it, the results is either off, or the
prameter does not work.
The problem is that if the fitting function tries to go through undefined
points in your function, it throws out the warning above.
The importance of guessing is discussed in this thread, but the gist of it is, when fitting, use p0
argument to give initial point for fitting.
popt, pcov = curve_fit(func2, np.arange(10), np.arange(10), p0=(0, 0))