[Numpy-discussion] Linear least squares

josef.pktd@gmai... josef.pktd@gmai...
Tue Jan 8 16:35:12 CST 2013


On Tue, Jan 8, 2013 at 1:17 PM, Till Stensitz <mail.till@gmx.de> wrote:
> Hi,
> i did some profiling and testing of my data-fitting code.
> One of its core parts is doing some linear least squares,
> until now i used np.linalg.lstsq. Most of time the size
> a is (250, 7) and of b is (250, 800).

My guess is that this depends a lot on the shape

try a is (10000, 7) and b is (10000, 1)

Josef


>
> Today i compared it to using pinv manually,
> to my surprise, it is much faster. I taught,
> both are svd based? Too check another computer
> i also run my test on wakari:
>
> https://www.wakari.io/nb/tillsten/linear_least_squares
>
> Also using scipy.linalg instead of np.linalg is
> slower for both cases. My numpy and scipy
> are both from C. Gohlkes website. If my result
> is valid in general, maybe the lstsq function
> should be changed or a hint should be added
> to the documentation.
>
> greetings
> Till
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion


More information about the NumPy-Discussion mailing list