From df7cfa62a7710d4ba9a8b33012bcf5698decda4c Mon Sep 17 00:00:00 2001 From: Nicolo Fusi Date: Mon, 15 Apr 2013 16:01:54 +0100 Subject: [PATCH 1/5] fixed psi0 psi1 renaming error --- GPy/models/Bayesian_GPLVM.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GPy/models/Bayesian_GPLVM.py b/GPy/models/Bayesian_GPLVM.py index dd55b38f..a99f7667 100644 --- a/GPy/models/Bayesian_GPLVM.py +++ b/GPy/models/Bayesian_GPLVM.py @@ -69,8 +69,8 @@ class Bayesian_GPLVM(sparse_GP, GPLVM): return dKL_dmu, dKL_dS def dL_dmuS(self): - dL_dmu_psi0, dL_dS_psi0 = self.kern.dpsi1_dmuS(self.dL_dpsi1, self.Z, self.X, self.X_variance) - dL_dmu_psi1, dL_dS_psi1 = self.kern.dpsi0_dmuS(self.dL_dpsi0, self.Z, self.X, self.X_variance) + dL_dmu_psi0, dL_dS_psi0 = self.kern.dpsi0_dmuS(self.dL_dpsi0, self.Z, self.X, self.X_variance) + dL_dmu_psi1, dL_dS_psi1 = self.kern.dpsi1_dmuS(self.dL_dpsi1, self.Z, self.X, self.X_variance) dL_dmu_psi2, dL_dS_psi2 = self.kern.dpsi2_dmuS(self.dL_dpsi2, self.Z, self.X, self.X_variance) dL_dmu = dL_dmu_psi0 + dL_dmu_psi1 + dL_dmu_psi2 dL_dS = dL_dS_psi0 + dL_dS_psi1 + dL_dS_psi2 From 671ae41256574a99211917cefc98084f2cfd5d95 Mon Sep 17 00:00:00 2001 From: Nicolo Fusi Date: Mon, 15 Apr 2013 16:02:02 +0100 Subject: [PATCH 2/5] small changes --- GPy/inference/SGD.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/GPy/inference/SGD.py b/GPy/inference/SGD.py index 5d1b673d..be1c92de 100644 --- a/GPy/inference/SGD.py +++ b/GPy/inference/SGD.py @@ -230,6 +230,8 @@ class opt_SGD(Optimizer): shapes = self.get_param_shapes(N, Q) f, step, Nj = self.step_with_missing_data(f_fp, X, step, shapes) else: + self.model.likelihood.YYT = np.dot(self.model.likelihood.Y, self.model.likelihood.Y.T) + self.model.likelihood.trYYT = np.trace(self.model.likelihood.YYT) Nj = N f, fp = f_fp(self.x_opt) step = self.momentum * step + self.learning_rate * fp From 7c63d7e3468f0b79387ba2254715b5afce0172ab Mon Sep 17 00:00:00 2001 From: Nicolo Fusi Date: Mon, 15 Apr 2013 16:27:56 +0100 Subject: [PATCH 3/5] removed useless _set_params() --- GPy/core/model.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/GPy/core/model.py b/GPy/core/model.py index 28bb4ff5..f70125fd 100644 --- a/GPy/core/model.py +++ b/GPy/core/model.py @@ -264,8 +264,11 @@ class model(parameterised): return - LL_gradients - prior_gradients def objective_and_gradients(self, x): - obj_f = self.objective_function(x) - obj_grads = self.objective_function_gradients(x) + self._set_params_transformed(x) + obj_f = -self.log_likelihood() - self.log_prior() + LL_gradients = self._transform_gradients(self._log_likelihood_gradients()) + prior_gradients = self._transform_gradients(self._log_prior_gradients()) + obj_grads = - LL_gradients - prior_gradients return obj_f, obj_grads def optimize(self, optimizer=None, start=None, **kwargs): From 06e811b2c38683424429dfc1ce466b665a98f257 Mon Sep 17 00:00:00 2001 From: Nicolo Fusi Date: Tue, 16 Apr 2013 15:03:18 +0100 Subject: [PATCH 4/5] small changes --- GPy/inference/SGD.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/GPy/inference/SGD.py b/GPy/inference/SGD.py index be1c92de..588ced75 100644 --- a/GPy/inference/SGD.py +++ b/GPy/inference/SGD.py @@ -220,7 +220,7 @@ class opt_SGD(Optimizer): b = len(features)/self.batch_size features = [features[i::b] for i in range(b)] NLL = [] - + import pylab as plt for count, j in enumerate(features): self.model.D = len(j) self.model.likelihood.D = len(j) @@ -246,7 +246,11 @@ class opt_SGD(Optimizer): NLL.append(f) self.fopt_trace.append(f) + # fig = plt.figure('traces') + # plt.clf() + # plt.plot(self.param_traces['noise']) + # import pdb; pdb.set_trace() # for k in self.param_traces.keys(): # self.param_traces[k].append(self.model.get(k)[0]) From 25063fd53d1d7d74da479f129f2fbfe57bf37950 Mon Sep 17 00:00:00 2001 From: andreas Date: Thu, 18 Apr 2013 16:39:55 +0100 Subject: [PATCH 5/5] pdinv passes extra args to jitchol --- GPy/util/linalg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GPy/util/linalg.py b/GPy/util/linalg.py index f88099a4..79025d4f 100644 --- a/GPy/util/linalg.py +++ b/GPy/util/linalg.py @@ -97,7 +97,7 @@ def jitchol_old(A,maxtries=5): raise linalg.LinAlgError,"not positive definite, even with jitter." -def pdinv(A): +def pdinv(A, *args): """ :param A: A DxD pd numpy array @@ -110,7 +110,7 @@ def pdinv(A): :rval logdet: the log of the determinant of A :rtype logdet: float64 """ - L = jitchol(A) + L = jitchol(A, *args) logdet = 2.*np.sum(np.log(np.diag(L))) Li = chol_inv(L) Ai = linalg.lapack.flapack.dpotri(L)[0]