Generation Of Free Running List Of Lapse Rate And Guess Rate For Psychometric Curve Fitting (scipy)
As a new user to the curve fitting function from scipy and a relatively new user of python, I am a little confused as to what *popt and p0 exactly generates (with reference to this
Solution 1:
p0
is the starting point for the fit procedure. popt
is the resulting best-fit values of the parameters.
Note that curve_fit
assumes that the signature of your function if f(x, *parameters)
: the first argument is an independent variable for which you have xdata
, and the rest are parameters that you want optimized.
In your first example, sigmoidscaled
takes four arguments, and you provide a length-three list for p0
. This way, the fitting starts with x0 = 1; k = 1; lapse = -10
.
In your second example, sigmoidscaled
takes five arguments, meaning you're fitting four parameters for which you need initial values.
Quick check:
In [22]: p0 = [1, 1, -10, 0] # add the 4th element
In [23]: popt, pcov = curve_fit(sigmoidscaled, xdata, ydata, p0, maxfev = 3000)
In [24]: popt
Out[24]: array([ -1.97865387e+01, 3.31731590e-01, -1.03275740e-01,
-1.05595226e+03])
Post a Comment for "Generation Of Free Running List Of Lapse Rate And Guess Rate For Psychometric Curve Fitting (scipy)"