From 7ba2e2ed0827941145153e1107c5466d6fcd6cb5 Mon Sep 17 00:00:00 2001 From: Alan Saul Date: Mon, 22 Dec 2014 12:00:16 +0000 Subject: [PATCH] Added svgp in partially broken state ready for multiouputs --- GPy/inference/latent_function_inference/svgp.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/GPy/inference/latent_function_inference/svgp.py b/GPy/inference/latent_function_inference/svgp.py index 1b0ec19e..3fe96c12 100644 --- a/GPy/inference/latent_function_inference/svgp.py +++ b/GPy/inference/latent_function_inference/svgp.py @@ -10,15 +10,16 @@ class SVGP(LatentFunctionInference): num_inducing = Z.shape[0] #expand cholesky representation - L = choleskies.flat_to_triang(q_u_chol[:,None]).squeeze() - S = L.dot(L.T) - Si,_ = linalg.dpotri(np.asfortranarray(L), lower=1) - logdetS = 2.*np.sum(np.log(np.abs(np.diag(L)))) + L = choleskies.flat_to_triang(q_u_chol) + S = np.einsum('ijk,ljk->ilk', L, L) #L.dot(L.T) + #Si,_ = linalg.dpotri(np.asfortranarray(L), lower=1) + Si = choleskies.multiple_dpotri(L) + logdetS = np.array([2.*np.sum(np.log(np.abs(np.diag(L[:,:,i])))) for i in range(L.shape[-1])]) if np.any(np.isinf(Si)): - print "warning:Cholesky representation unstable" - S = S + np.eye(S.shape[0])*1e-5*np.max(np.max(S)) - Si, Lnew, _,_ = linalg.pdinv(S) + raise ValueError("Cholesky representation unstable") + #S = S + np.eye(S.shape[0])*1e-5*np.max(np.max(S)) + #Si, Lnew, _,_ = linalg.pdinv(S) #compute kernel related stuff Kmm = kern.K(Z)