Doing non-linear regression for a set of data
In the next section, we will see how to do the non-linear regression for a set of data.
Getting ready
The following is the main requirement that we need:
scipy.optimize.curve_fit(f, xdata, ydata, p0=None, sigma=None, absolute_sigma=False, check_finite=True, bounds=(-inf, inf), method=None, jac=None, **kwargs)
How to do it...
We present the main functions and parameters:
The parameters are:
f
: Callable. The model function,f(x, ...)
. It must take the independent variable as the first argument and the parameters to fit as separate remaining arguments.xdata
: An M-length sequence or an (k,M)-shaped array for functions with k predictors. The independent variable where the data is measured.ydata
: M-length sequence. The dependent data—nominallyf(xdata, ...)
.p0
: None, scalar, or N-length sequence, optional. Initial guess for the parameters. If none, then the initial values will all be1
(if the number of parameters for the function can be determined using...