<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 31, 2019 at 9:30 AM Matt Newville <<a href="mailto:newville@cars.uchicago.edu">newville@cars.uchicago.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div style="font-family:arial,helvetica,sans-serif"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 30, 2019 at 2:26 PM Stefan van der Walt <<a href="mailto:stefanv@berkeley.edu" target="_blank">stefanv@berkeley.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, 30 Jan 2019 14:27:29 -0500, <a href="mailto:josef.pktd@gmail.com" target="_blank">josef.pktd@gmail.com</a> wrote:<br>> (I'm strongly in favor of trying "defaults" first, and if that doesn't<br>> work, then dig into or debug likely candidates. in loose analogy of test<br>> driven development instead of up-front design.)<br>
<br>It seems unlikely that we will reach full agreement in this thread,<br>given the differing experiences and philosophies at play. But, that's<br>probably OK if we can all agree to modify the documentation to be clearer<br>about the risks of the preset values for p0, how to select better<br>values, and how to handle failure modes.<br>
<br>This won't 100% address Matt's concerns, but it will go a long way to<br>keeping users out of trouble, without having to make breaking changes to<br>the API.<br>
<br>What do you think?<br>
<br></blockquote><div><br></div><div style="font-family:arial,helvetica,sans-serif">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.</div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">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.  </div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">The argument for requiring initial values might be summarized as "initial values are actually required".  </div><div style="font-family:arial,helvetica,sans-serif">The argument against might be summarized as "we don't want to change the current behavior".</div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">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.</div><div style="font-family:arial,helvetica,sans-serif"><br></div></div></div></blockquote><div><br></div><div>I was only the stats reviewer for curve_fit, and never had any real stake in the API.</div><div><br></div><div>Looking at the last heavily discussed change in curve_fit that I was involved in, I found this</div><div><a href="https://github.com/scipy/scipy/pull/3098#issuecomment-29837264">https://github.com/scipy/scipy/pull/3098#issuecomment-29837264</a> and a few followup comments.<br></div><div><br></div><div>Josef</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div style="font-family:arial,helvetica,sans-serif"></div><div style="font-family:arial,helvetica,sans-serif">Cheers,</div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">--Matt </div></div></div>
_______________________________________________<br>
SciPy-Dev mailing list<br>
<a href="mailto:SciPy-Dev@python.org" target="_blank">SciPy-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scipy-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/scipy-dev</a><br>
</blockquote></div></div></div></div>