[SciPy-User] return "full_output" or how to stop throwing away already calculated results

David Warde-Farley dwf@cs.toronto....
Tue Mar 9 22:45:22 CST 2010


On 9-Mar-10, at 10:37 PM, Rob Falck wrote:

> Returning an object would be my preference as well, it seems more
> pythonic.  Most optimizers should be able to return at a minimum
>
> result.x
> result.objfun
> result.iterations
> result.exit_status
>
> Some optimizers have other useful data to return, such as the Lagrange
> multiplers from slsqp.  Going down that path means probably breaking
> current implementations of the optimizers, but doing it right would be
> worth it, in my opinion.  We should also agree upon names for the
> common attributes.

It would require at least one version's worth of deprecation of the  
old interface, probably two or more.

Better to settle on the interface, implement it, and introduce it  
alongside. In my opinion, the more descriptive the names, the better:  
result.minimizer instead of result.x, result.minimum_found or  
result.minimum_value rather than result.objfun, etc. - if we're going  
to add a layer of complexity then we might as well make the names as  
unambiguous as possible.

Also often of interest: number of function evaluations, gradient  
evaluations, Hessian evaluations, etc.

The current report that gets printed could also form a print_summary()  
method for these objects or something like that.

David


More information about the SciPy-User mailing list