diff --git a/GPy/likelihoods/Laplace.py b/GPy/likelihoods/Laplace.py index f2197e55..42897f80 100644 --- a/GPy/likelihoods/Laplace.py +++ b/GPy/likelihoods/Laplace.py @@ -105,12 +105,12 @@ class Laplace(likelihood): #t1 += dWi_dfhat[col, col]*Ki[col,l]*self.f_hat[l, 0] ##t2 = np.zeros((1, self.N)) #t2 = np.dot(self.Sigma_tilde, Ki[:, col]) - ##for k in range(self.N): - ##t2[:] += self.Sigma_tilde[k, k]*Ki[k, col] + ###for k in range(self.N): + ###t2[:] += self.Sigma_tilde[k, k]*Ki[k, col] #dytil_dfhat[row, col] = (t1 + t2)[row] #dytil_dfhat += np.eye(self.N) - dytil_dfhat = - np.dot(dWi_dfhat, np.dot(Ki, self.f_hat)) + np.dot(self.Sigma_tilde, Ki) + np.eye(self.N) + dytil_dfhat = - np.diagflat(np.dot(dWi_dfhat, np.dot(Ki, self.f_hat))) + np.dot(self.Sigma_tilde, Ki) + np.eye(self.N) #dytil_dfhat = - (np.dot(dWi_dfhat, Ki)*self.f_hat[:, None] + np.dot(self.Sigma_tilde, Ki)).sum(-1) + np.eye(self.N) self.dytil_dfhat = dytil_dfhat return dL_dytil, dytil_dfhat diff --git a/GPy/testing/laplace_approx.tests.py b/GPy/testing/laplace_approx.tests.py index 73dfbfd6..2b3af2ad 100644 --- a/GPy/testing/laplace_approx.tests.py +++ b/GPy/testing/laplace_approx.tests.py @@ -60,8 +60,8 @@ class LaplaceTests(unittest.TestCase): def setUp(self): real_var = 0.1 #Start a function, any function - #self.X = np.linspace(0.0, 10.0, 30)[:, None] - self.X = np.random.randn(9,1) + self.X = np.linspace(0.0, 10.0, 30)[:, None] + #self.X = np.random.randn(,1) #self.X = np.ones((10,1)) Y = np.sin(self.X) + np.random.randn(*self.X.shape)*real_var self.Y = Y/Y.max()