[SciPy-user] curve_fit step-size and optimal parameters

Sebastian Walter sebastian.walter at gmail.com
Wed Jun 10 03:58:36 EDT 2009


If you try to fit the frequency with the least-squares distance  the
problem is not only nonlinearity
but rather the fact that the objective functions has many local minimizers.
At least that's what I have observed in a toy example once.

Has anyone experience what to do in that case? (Maybe use L1 norm instead?)



On Mon, Jun 8, 2009 at 10:19 PM, Robert Kern<robert.kern at gmail.com> wrote:
> 2009/6/8 Stéfan van der Walt <stefan at sun.ac.za>:
>> 2009/6/8 Robert Kern <robert.kern at gmail.com>:
>>> On Mon, Jun 8, 2009 at 14:59, ElMickerino<elmickerino at hotmail.com> wrote:
>>>> My question is, how can I get curve_fit to use a very small step-size for
>>>> the phase, or put in strict limits, and to therefore get a robust fit.  I
>>>> don't want to tune the phase by hand for each of my 60+ datasets.
>>>
>>> You really can't. I recommend the A*sin(w*t)+B*cos(w*t)
>>> parameterization rather than the A*sin(w*t+phi) one.
>>
>> Could you expand?  I can't immediately see why the second
>> parametrisation is bad.
>
> The cyclic nature of phi. It complicates things precisely as the OP describes.
>
>> Can't a person do this fit using non-linear
>> least-squares?  Ah, that's probably why you use the other
>> parametrisation, so that you don't have to use non-linear least
>> squares?
>
> If you aren't also fitting the frequency, then yes. If you are fitting
> for the frequency, too, the problem is still non-linear.
>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless
> enigma that is made terrible by our own mad attempt to interpret it as
> though it had an underlying truth."
>  -- Umberto Eco
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



More information about the SciPy-User mailing list