[SciPy-User] 2 questions: optimize.leastsq

Skipper Seabold jsseabold at gmail.com
Tue Oct 25 09:46:23 EDT 2011


On Tue, Oct 25, 2011 at 9:21 AM, Denis Laxalde <denis.laxalde at mcgill.ca> wrote:
> On Tue, 25 Oct 2011 12:49:37 +0200,
> Johannes Radinger wrote:
>> It's all about the optimize.leastsq. I use that to fit a function with several conditions. As a result I get the parameter estimates I am looking for and the 'ier'. According to the manual this is:
>>
>> "An integer flag. If it is equal to 1, 2, 3 or 4, the solution was found. Otherwise,
>> the solution was not found"
>>
>> I just want to know: What exactly do the numbers mean? What is if it is 1 or 2? Is that any information
>> about the quality of the fit?
>
> These numbers indicate how the solver terminated, i.e. based on which
> criterion. You may have a look at the 'mesg' output which describes
> how the solver terminated. The documentation is probably
> misleading here as it describes mesg as a "message giving information
> about the cause of failure" whereas it's actually a general message.
>

You can also look at the source, if you don't want to use
full_output=1 for some reason.

https://github.com/scipy/scipy/blob/master/scipy/optimize/minpack.py#L294
http://www.netlib.org/minpack/lmdif.f

Skipper



More information about the SciPy-User mailing list