pca initializer more robust to lower dimensions

This commit is contained in:
Max Zwiessele 2013-07-29 15:19:28 +01:00
parent f469ce8f41
commit ec6f8c5f3b

View file

@ -38,7 +38,8 @@ class GPLVM(GP):
def initialise_latent(self, init, input_dim, Y): def initialise_latent(self, init, input_dim, Y):
Xr = np.random.randn(Y.shape[0], input_dim) Xr = np.random.randn(Y.shape[0], input_dim)
if init == 'PCA': if init == 'PCA':
Xr[:, :Y.shape[1]] = PCA(Y, input_dim)[0] PC = PCA(Y, input_dim)[0]
Xr[:PC.shape[0], :PC.shape[1]] = PC
return Xr return Xr
def getstate(self): def getstate(self):