[SciPy-Dev] minimize(): tolerance unification
Matt Newville
newville at cars.uchicago.edu
Sun May 20 10:44:32 EDT 2012
Hi Pauli,
If you're working on unifying the signatures of the various minimizer
functions in scipy.optimize (Thanks!! Great!!), I have a small request
to try to make the behavior of the user-supplied objective functions
more uniform as well.
Currently, most solvers expect the objective function to return a
scalar, and raise a ValueError if the objective function returns an
array. OTOH, scipy.optimize.leastsq() requires the objective
function to return an array. As far as I can tell, the docs are
actually silent on what the value returned from the objective function
should be.
Is it worth considering the following change?: For all solvers
expecting a scalar result, if the objective function returns an array,
convert to (array**2).sum().
Obviously, this implies a 'least squares' approach as the default,
which is debatable but also probably defensible. I believe this
change would not break existing code (since the user can always return
a scalar value), but it would allow more consistent objective
functions, making it easier for users to try out different algorithms
with the same objective function.
Thanks,
--Matt
More information about the SciPy-Dev
mailing list