Added supportp for tall X in PCA
This commit is contained in:
parent
fa3722600c
commit
aeb37cf4cd
|
@ -17,6 +17,14 @@ def pca(a, aopt, scale='scores', mode='normal'):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
m, n = a.shape
|
m, n = a.shape
|
||||||
|
|
||||||
|
if m*10.>n:
|
||||||
|
v, s, ut = dot(a.T, a)
|
||||||
|
s = sqrt(s)
|
||||||
|
eigvals = s
|
||||||
|
u = u.T
|
||||||
|
vt = v.T
|
||||||
|
else:
|
||||||
u, s, vt = svd(a, full_matrices=0)
|
u, s, vt = svd(a, full_matrices=0)
|
||||||
eigvals = (1./m)*s
|
eigvals = (1./m)*s
|
||||||
T = u*s
|
T = u*s
|
||||||
|
|
Reference in New Issue