mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-24 14:15:14 +02:00
Edit to linalg.py PCA function to stop it changing data matrix.
This commit is contained in:
parent
9422c603b1
commit
97db2a5bd7
1 changed files with 2 additions and 2 deletions
|
|
@ -146,9 +146,9 @@ def PCA(Y, Q):
|
|||
if not np.allclose(Y.mean(axis=0), 0.0):
|
||||
print "Y is not zero mean, centering it locally (GPy.util.linalg.PCA)"
|
||||
|
||||
Y -= Y.mean(axis=0)
|
||||
#Y -= Y.mean(axis=0)
|
||||
|
||||
Z = linalg.svd(Y, full_matrices = False)
|
||||
Z = linalg.svd(Y-Y.mean(axis=0), full_matrices = False)
|
||||
[X, W] = [Z[0][:,0:Q], np.dot(np.diag(Z[1]), Z[2]).T[:,0:Q]]
|
||||
v = X.std(axis=0)
|
||||
X /= v;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue