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

josef.pktd@gmai... josef.pktd@gmai...
Tue Mar 9 15:01:31 CST 2010

scipy functions throw away a lot of intermediate results


fmin_slsqp ticket:1129
scipy.linalg.lstsq  throws away residuals :

    if n<m:
        x1 = x[:n]
        if rank==n: resids = sum(x[n:]**2,axis=0)
        x = x1
    return x,resids,rank,s

in statsmodels, I am switching more to the pattern when
full_output=True (or similar keyword) for a function, then all
intermediate results are returned, attached to a generic class
instance ( or could be a struct in matlab or a bunch for Gael,...)

Is it possible to start the same pattern in scipy?

E.g. for optimizers like slsqp, if we want to change the returns then
each time it breaks the API or we have to increase full_output= 1,2,3
( like nargout in matlab)

I saw linalg.lstsq by chance this morning, but I assume there is
additional useful information hidden in other functions.

Any opinion ?


More information about the SciPy-User mailing list