[Numpy-discussion] linear algebra help
Charles R Harris
Mon May 18 10:49:17 CDT 2009
On Mon, May 18, 2009 at 9:35 AM, <firstname.lastname@example.org> wrote:
> On Mon, May 18, 2009 at 10:55 AM, Charles R Harris
> <email@example.com> wrote:
> > 2009/5/18 Stéfan van der Walt <firstname.lastname@example.org>
> >> 2009/5/18 Sebastian Walter <email@example.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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion