[Numpy-discussion] performance issue (again)

josef.pktd at gmail.com josef.pktd at gmail.com
Wed Apr 22 12:38:32 EDT 2009


On Wed, Apr 22, 2009 at 11:48 AM, Mathew Yeates <myeates at jpl.nasa.gov>wrote:

> well, this isn't a perfect solution. polyfit  is better because it
> determines rank based on condition values. Finds the eigenvalues ...
> etc. But, unless it can vectorized without Python looping, it's too slow
> for me to use
>




rank is a property of the design matrix.

In your case the design matrix is a vector of ones and the x vector. So the
only case, where you run into problems, is when your three observation of x
are the same, then dot(x.T*x) is zero, you can only have one constant. If
there is no slope in x then you don't have three different observations to
estimate a slope coefficient.

Just special case (x*x).sum(1)<1e-8   or something, in this case
yestimate = y.mean

eigen vectors with one regressor are pretty useless or trivial, same with
rank.

For higher order polynomials this will become more important, but not for a
linear polynomial.

Josef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090422/3f49fa41/attachment.html>


More information about the NumPy-Discussion mailing list