leastsq

SeparableModelResult.leastsq(params=None, **kws)

Use Levenberg-Marquardt minimization to perform a fit.

It assumes that the input Parameters have been initialized, and a function to minimize has been properly set up. When possible, this calculates the estimated uncertainties and variable correlations from the covariance matrix.

This method calls scipy.optimize.leastsq. By default, numerical derivatives are used, and the following arguments are set:

leastsq() arg Default Value Description
xtol 1.e-7 Relative error in the approximate solution
ftol 1.e-7 Relative error in the desired sum of squares
maxfev 2000*(nvar+1) Maximum number of function calls (nvar= # of variables)
Dfun None Function to call for Jacobian calculation
Parameters:
  • params (Parameters, optional) – Parameters to use as starting point.
  • **kws (dict, optional) – Minimizer options to pass to scipy.optimize.leastsq.
Returns:

Object containing the optimized parameter and several goodness-of-fit statistics.

Return type:

MinimizerResult

Changed in version 0.9.0: Return value changed to MinimizerResult.