[SciPy-Dev] curve_fit() should require initial values for parameters

josef.pktd at gmail.com josef.pktd at gmail.com
Thu Jan 31 10:04:41 EST 2019


On Thu, Jan 31, 2019 at 9:30 AM Matt Newville <newville at cars.uchicago.edu>
wrote:

>
>
> On Wed, Jan 30, 2019 at 2:26 PM Stefan van der Walt <stefanv at berkeley.edu>
> wrote:
>
>> On Wed, 30 Jan 2019 14:27:29 -0500, josef.pktd at gmail.com wrote:
>> > (I'm strongly in favor of trying "defaults" first, and if that doesn't
>> > work, then dig into or debug likely candidates. in loose analogy of test
>> > driven development instead of up-front design.)
>>
>> It seems unlikely that we will reach full agreement in this thread,
>> given the differing experiences and philosophies at play.  But, that's
>> probably OK if we can all agree to modify the documentation to be clearer
>> about the risks of the preset values for p0, how to select better
>> values, and how to handle failure modes.
>>
>> This won't 100% address Matt's concerns, but it will go a long way to
>> keeping users out of trouble, without having to make breaking changes to
>> the API.
>>
>> What do you think?
>>
>>
> Well, I'm not sure that agreement here should be the sole driver for what
> scipy developers do.  There will be disagreements in design philosophy, and
> someone needs to be willing and able to make decisions in such situations.
>  I do not know who is making such decisions or reviewing changes in
> `scipy.optimize`, but it appears to me that this has suffered for awhile,
> leaving conceptual, interface, and organizational messes.  I thought I
> would try to help by cleaning up one of the most egregious and simplest of
> these.
>
> The documentation for `curve_fit` does currrently state that `p0=None` is
> converted to `np.ones(n_variables)`.  It appears that some view this as
> sufficient and that these folks view some automated assignment of initial
> values is useful, even while acknowledging that it cannot be correct in
> general.
>
> The argument for requiring initial values might be summarized as "initial
> values are actually required".
> The argument against might be summarized as "we don't want to change the
> current behavior".
>
> Anyway, I am perfectly willing to lose this argument (I do not use
> `curve_fit` myself, and do not feel compelled to support its use), and the
> decision is not mine to make.  I do hope someone sensible is making these
> decisions.
>
>
I was only the stats reviewer for curve_fit, and never had any real stake
in the API.

Looking at the last heavily discussed change in curve_fit that I was
involved in, I found this
https://github.com/scipy/scipy/pull/3098#issuecomment-29837264 and a few
followup comments.

Josef



> Cheers,
>
> --Matt
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at python.org
> https://mail.python.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20190131/6e38c830/attachment-0001.html>


More information about the SciPy-Dev mailing list