least squares solvers

Why is the non-linear LS solver in sp.optimize called leastsq, whereas the linear solver in sp.linalg is called lstsq? Wouldn't a consistent name be better? sp.linalg.lstsq uses SVD, by lapack driver *gelss. If we don't need singular values, solving by QR is faster (lapack driver *gels). (I actually use Fortran just to get DGELS instead of DGELSS.) Sturla

On Fri, Jan 27, 2012 at 09:47, Sturla Molden <sturla@molden.no> wrote:
I personally don't think so. I prefer that different functions that do different things with different signatures have different names. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco

On Fri, Jan 27, 2012 at 09:53:52AM +0000, Robert Kern wrote:
I personally don't think so. I prefer that different functions that do different things with different signatures have different names.
I agree, but I would have actually prefered if the signatures didn't differ as much :). Gael, from the peanut gallery

On 27.01.2012 10:47, Sturla Molden wrote:
Also I think the docstring for sp.optimize.leastsq should refer to the linear solver, because I have seen multiple examples of people using sp.optimize.leastsq to solve linear systems.
Another thing is that the terminology here could be confusing. The docstring for lstsq uses the naming convention from linear algebra, i.e. sp.linalg.lstsq(a, b) will minimize 2-norm |b - Ax|. Those needing it for statistics (multiple regression) might not relize that b corresponds to y, A to X, and x to b. So fitting y = X * b by least squares is sp.linalg.lstsq(X, y). I think the docstring should be more explicit on this. Sturla

On Fri, Jan 27, 2012 at 09:58, Sturla Molden <sturla@molden.no> wrote:
The docstring editor is here: http://docs.scipy.org/scipy/docs/scipy.optimize.minpack.leastsq/#leastsq You will need a login. To get edit privileges, post a new thread to this list giving the username you have chosen.
http://docs.scipy.org/numpy/docs/numpy.linalg.linalg.lstsq/ http://docs.scipy.org/scipy/docs/scipy.linalg.basic.lstsq/ -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
participants (3)
-
Gael Varoquaux
-
Robert Kern
-
Sturla Molden