[SciPy-Dev] optimize: what should happen if objective functions return non-finite numbers?

Andrew Nelson andyfaff at gmail.com
Wed Jun 15 23:36:39 EDT 2016


>
> > I think this is a different issue --- the only way curve_fit
> > communicates fit failures in general is via setting the estimated
> > covariances to infinity. This is not so convenient, but that's how it
> > works currently.
>
> Sorry, this was wrong --- it's supposed to raise a RuntimeError, iow.,
> works differently from minimize().
>
> However, nan values confuse leastsq() to think it converged --- this can
> and should be fixed.


To clarify here - is the expected behaviour that curve_fit and leastsq
raise a RuntimeError if the user function returns NaN? What about np.inf,
-np.inf?

Note: least_squares raises a ValueError if the "Residuals are not finite in
the initial point".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20160616/e69c8159/attachment.html>


More information about the SciPy-Dev mailing list