From 603733c6f7a0915761d0e1e1c92e77cc1d179e2c Mon Sep 17 00:00:00 2001 From: James Hensman Date: Mon, 10 Mar 2014 11:14:19 +0000 Subject: [PATCH] added update_gradints_diag to the add and base kernels --- GPy/kern/_src/add.py | 3 +++ GPy/kern/_src/kern.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/GPy/kern/_src/add.py b/GPy/kern/_src/add.py index 6498664a..a5ca9a59 100644 --- a/GPy/kern/_src/add.py +++ b/GPy/kern/_src/add.py @@ -45,6 +45,9 @@ class Add(Kern): else: [p.update_gradients_full(dL_dK, X[:,i_s], X2[:, i_s]) for p, i_s in zip(self._parameters_, self.input_slices)] + def update_gradients_diag(self, dL_dKdiag, X): + [p.update_gradients_diag(dL_dK, X[:,i_s]) for p, i_s in zip(self._parameters_, self.input_slices)] + def gradients_X(self, dL_dK, X, X2=None): """Compute the gradient of the objective function with respect to X. diff --git a/GPy/kern/_src/kern.py b/GPy/kern/_src/kern.py index e1106275..b8e428dc 100644 --- a/GPy/kern/_src/kern.py +++ b/GPy/kern/_src/kern.py @@ -37,6 +37,10 @@ class Kern(Parameterized): def gradients_X_diag(self, dL_dK, X): raise NotImplementedError + def update_gradients_diag(self, dL_dKdiag, X): + """ update the gradients of all parameters when using only the diagonal elements of the covariance matrix""" + raise NotImplementedError + def update_gradients_full(self, dL_dK, X, X2): """Set the gradients of all parameters when doing full (N) inference.""" raise NotImplementedError