[Numpy-discussion] deprecate numpy.matrix

eat e.antero.tammi at gmail.com
Mon Feb 10 14:03:43 EST 2014


On Mon, Feb 10, 2014 at 7:00 PM, alex <argriffi at ncsu.edu> wrote:

> On Mon, Feb 10, 2014 at 11:27 AM,  <josef.pktd at gmail.com> wrote:
> > How do we calculate the diagonal of the hat matrix without using N by N
> > matrices?
>
> Not sure if this was a rhetorical question or what, but this seems to work
> leverages = np.square(scipy.linalg.qr(X, mode='economic')[0]).sum(axis=1)
> http://www4.ncsu.edu/~ipsen/ps/slides_CSE2013.pdf

Rhetorical or not, but FWIW I'll prefer to take singular value
decomposition (u, s, vt= svd(x)) and then based on the singular values
sI'll estimate a "numerically feasible rank"
r. Thus the diagonal of such hat matrix would be (u[:, :r]** 2).sum(1).


Regards,
-eat

>
> Sorry for off-topic...
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140210/d58745b2/attachment.html>


More information about the NumPy-Discussion mailing list