[Numpy-discussion] deprecate numpy.matrix
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')).sum(axis=1)
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).
> Sorry for off-topic...
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion