finally added pca package again

This commit is contained in:
Max Zwiessele 2014-03-24 11:16:57 +00:00
parent ed2aaab4bb
commit 321a75100c
5 changed files with 134 additions and 33 deletions

View file

@ -5,13 +5,14 @@ Created on 24 Feb 2014
'''
import numpy as np
from linalg import PCA
from GPy.util.pca import pca
def initialize_latent(init, input_dim, Y):
Xr = np.random.randn(Y.shape[0], input_dim)
if init == 'PCA':
PC = PCA(Y, input_dim)[0]
p = pca(Y)
PC = p.project(Y, min(input_dim, Y.shape[1]))
Xr[:PC.shape[0], :PC.shape[1]] = PC
else:
pass
return Xr
return Xr, p.fracs[:input_dim]