Closed PAC-Bayesian closed 6 years ago
Hi,
I am trying to implement a new kernel, but a little bit confused about the following methods in the root class Kern in GPy.kern.src.kern:
Kern
GPy.kern.src.kern
def gradients_X(self, dL_dK, X, X2): """ .. math:: \\frac{\partial L}{\partial X} = \\frac{\partial L}{\partial K}\\frac{\partial K}{\partial X} """ raise NotImplementedError
def gradients_X_diag(self, dL_dKdiag, X): """ The diagonal of the derivative w.r.t. X """ raise NotImplementedError
It seems both should return an array of the same shape of X.
X
My questions are: Does gradients_X_diag only involve calculations from Kdiag? Or is it equivalent to gradients_X(self, np.diag(dL_dK), X, X)?
gradients_X_diag
Kdiag
gradients_X(self, np.diag(dL_dK), X, X)
Thank you!
Yes the first option is right. It only involves the gradients of the diagonal of the covariance matrix.
Hi,
I am trying to implement a new kernel, but a little bit confused about the following methods in the root class
Kern
inGPy.kern.src.kern
:It seems both should return an array of the same shape of
X
.My questions are: Does
gradients_X_diag
only involve calculations fromKdiag
? Or is it equivalent togradients_X(self, np.diag(dL_dK), X, X)
?Thank you!