[Numpy-discussion] linear algebra help

Charles R Harris charlesr.harris at gmail.com
Mon May 18 11:49:17 EDT 2009


On Mon, May 18, 2009 at 9:35 AM, <josef.pktd at gmail.com> wrote:

> On Mon, May 18, 2009 at 10:55 AM, Charles R Harris
> <charlesr.harris at gmail.com> wrote:
> >
> >
> > 2009/5/18 Stéfan van der Walt <stefan at sun.ac.za>
> >>
> >> 2009/5/18 Sebastian Walter <sebastian.walter at gmail.com>:
> >> > B = numpy.dot(A.T, A)
> >>
> >> This multiplication should be avoided whenever possible -- you are
> >> effectively squaring your condition number.
> >
> > Although the condition number doesn't mean much unless the columns are
> > normalized. Having badly scaled columns can lead to problems with lstsq
> > because of its default cutoff based on the condition number.
> >
> > Chuck
>
> Do you know if any of the linalg methods, np.linalg.lstsq or
> scipy.linalg.lstsq, do any normalization internally to improve
> numerical accuracy?
>
-
They don't. Although, IIRC, lapack provides routines for doing so. Maybe
there is another least squares routine that does the scaling.


>
> I saw automatic internal normalization (e.g. rescaling) for some
> econometrics methods, and was wondering whether we should do this also
> in stats.models or whether scipy.linalg is already taking care of
> this. I have only vague knowledge of the numerical precision of
> different linear algebra methods.
>

It's a good idea. Otherwise the condition number depends on choice of units
and other such extraneous things.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090518/ad33bdc7/attachment.html>


More information about the NumPy-Discussion mailing list