coregionalisation seems to be a go-go

This commit is contained in:
James Hensman 2013-03-08 18:21:29 +00:00
parent af510d166a
commit f881e65761
3 changed files with 20 additions and 12 deletions

View file

@ -64,13 +64,13 @@ class coregionalise(kernpart):
partial_small = np.zeros_like(self.B)
for i in range(self.Nout):
for j in range(i,self.Nout):
for j in range(self.Nout):
tmp = np.sum(partial[(ii==i)*(jj==j)])
partial_small[i,j] = tmp
partial_small[j,i] = tmp
dkappa = np.diag(partial_small)
dW = 2.*(self.W[:,None,:]*partial_small[:,:,None]).sum(0)
partial_small += partial_small.T
dW = (self.W[:,None,:]*partial_small[:,:,None]).sum(0)
target += np.hstack([dW.flatten(),dkappa])

View file

@ -40,8 +40,8 @@ class product_orthogonal(kernpart):
def K(self,X,X2,target):
"""Compute the covariance matrix between X and X2."""
if X2 is None: X2 = X
target1 = np.zeros((X.shape[0],X2.shape[0]))
target2 = np.zeros((X.shape[0],X2.shape[0]))
target1 = np.zeros_like(target)
target2 = np.zeros_like(target)
self.k1.K(X[:,:self.k1.D],X2[:,:self.k1.D],target1)
self.k2.K(X[:,self.k1.D:],X2[:,self.k1.D:],target2)
target += target1 * target2