mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-11 04:52:37 +02:00
[grads x]
This commit is contained in:
parent
0c6e3bc88f
commit
b1fd7c9aaf
3 changed files with 12 additions and 12 deletions
|
|
@ -377,7 +377,7 @@ class GP(Model):
|
||||||
if full_cov:
|
if full_cov:
|
||||||
dK2_dXdX = kern.gradients_XX(one, Xnew)
|
dK2_dXdX = kern.gradients_XX(one, Xnew)
|
||||||
else:
|
else:
|
||||||
dK2_dXdX = kern.gradients_XX(one, Xnew).sum(0)
|
dK2_dXdX = kern.gradients_XX_diag(one, Xnew)
|
||||||
#dK2_dXdX = np.zeros((Xnew.shape[0], Xnew.shape[1], Xnew.shape[1]))
|
#dK2_dXdX = np.zeros((Xnew.shape[0], Xnew.shape[1], Xnew.shape[1]))
|
||||||
#for i in range(Xnew.shape[0]):
|
#for i in range(Xnew.shape[0]):
|
||||||
# dK2_dXdX[i:i+1,:,:] = kern.gradients_XX(one, Xnew[i:i+1,:])
|
# dK2_dXdX[i:i+1,:,:] = kern.gradients_XX(one, Xnew[i:i+1,:])
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class Integral(Kern): #todo do I need to inherit from Stationary
|
||||||
#print "V%0.5f" % self.variances.gradient
|
#print "V%0.5f" % self.variances.gradient
|
||||||
#print "L%0.5f" % self.lengthscale.gradient
|
#print "L%0.5f" % self.lengthscale.gradient
|
||||||
else: #we're finding dK_xf/Dtheta
|
else: #we're finding dK_xf/Dtheta
|
||||||
print "NEED TO HANDLE TODO!"
|
print("NEED TO HANDLE TODO!")
|
||||||
|
|
||||||
#useful little function to help calculate the covariances.
|
#useful little function to help calculate the covariances.
|
||||||
def g(self,z):
|
def g(self,z):
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,7 @@ class Stationary(Kern):
|
||||||
dL2_dXdX: [NxQxQ]
|
dL2_dXdX: [NxQxQ]
|
||||||
"""
|
"""
|
||||||
dL_dK_diag = dL_dK_diag.copy().reshape(-1, 1, 1)
|
dL_dK_diag = dL_dK_diag.copy().reshape(-1, 1, 1)
|
||||||
assert dL_dK_diag.size == X.shape[0], "dL_dK_diag has to be given as row [N] or column vector [Nx1]"
|
assert (dL_dK_diag.size == X.shape[0]) or (dL_dK_diag.size == 1), "dL_dK_diag has to be given as row [N] or column vector [Nx1]"
|
||||||
|
|
||||||
l4 = np.ones(X.shape[1])*self.lengthscale**2
|
l4 = np.ones(X.shape[1])*self.lengthscale**2
|
||||||
return dL_dK_diag * (np.eye(X.shape[1]) * -self.dK2_drdr_diag()/(l4))[None, :,:]# np.zeros(X.shape+(X.shape[1],))
|
return dL_dK_diag * (np.eye(X.shape[1]) * -self.dK2_drdr_diag()/(l4))[None, :,:]# np.zeros(X.shape+(X.shape[1],))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue