From ec6f8c5f3b9d782f078ca17b7a7189dabf6fe911 Mon Sep 17 00:00:00 2001 From: Max Zwiessele Date: Mon, 29 Jul 2013 15:19:28 +0100 Subject: [PATCH] pca initializer more robust to lower dimensions --- GPy/models/gplvm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GPy/models/gplvm.py b/GPy/models/gplvm.py index 86c0ac28..d106cd4f 100644 --- a/GPy/models/gplvm.py +++ b/GPy/models/gplvm.py @@ -38,7 +38,8 @@ class GPLVM(GP): def initialise_latent(self, init, input_dim, Y): Xr = np.random.randn(Y.shape[0], input_dim) 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 def getstate(self):