4 ms·
you can skip sklear and other packages and just use numpy (which is supported in pypy now), and just do an svd of the input matrix. U,d,Vt=svd(X) D=diag(d) X
by leecarraher 10y ago
you can skip sklear and other packages and just use numpy (which is supported in pypy now), and just do an svd of the input matrix.
U,d,Vt=svd(X)
D=diag(d)
Xhat= U[:,:2].dot(D[:2, :2])
- leecarraher 10y agoin addition if you want a way to project new vectors into a reduced svd space: l=2 # desired vector space dimension U,d,Vt = linalg.svd(X,full_matrices=False) P=(U*(1/d))[:,:l] xnew = dot(x,P)