diff --git a/GPy/kern/_src/add.py b/GPy/kern/_src/add.py index fdebdfac..3f00b22d 100644 --- a/GPy/kern/_src/add.py +++ b/GPy/kern/_src/add.py @@ -46,6 +46,9 @@ class Add(CombinationKernel): def update_gradients_diag(self, dL_dK, X): [p.update_gradients_diag(dL_dK, X) for p in self.parts] + def update_gradients_diag(self, dL_dKdiag, X): + [p.update_gradients_diag(dL_dKdiag, 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 8a24e24a..f8f2d588 100644 --- a/GPy/kern/_src/kern.py +++ b/GPy/kern/_src/kern.py @@ -62,6 +62,10 @@ class Kern(Parameterized): def gradients_X_diag(self, dL_dKdiag, 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