mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-11 15:15:15 +02:00
Merge branch 'devel' of github.com:SheffieldML/GPy into devel
This commit is contained in:
commit
41cc9c62f5
2 changed files with 9 additions and 5 deletions
|
|
@ -47,7 +47,10 @@ class VarGauss(LatentFunctionInference):
|
|||
dL_dthetaL = np.array([])
|
||||
dF_da = np.dot(K, dF_dm)
|
||||
SigmaB = Sigma*self.beta
|
||||
dF_db = -np.diag(Sigma.dot(np.diag(dF_dv.flatten())).dot(SigmaB))*2
|
||||
#dF_db_ = -np.diag(Sigma.dot(np.diag(dF_dv.flatten())).dot(SigmaB))*2
|
||||
dF_db = -2*np.sum(Sigma**2 * (dF_dv * self.beta), 0)
|
||||
#assert np.allclose(dF_db, dF_db_)
|
||||
|
||||
KL = 0.5*(Alogdet + np.trace(Ai) - num_data + np.sum(m*self.alpha))
|
||||
dKL_da = m
|
||||
A_A2 = Ai - Ai.dot(Ai)
|
||||
|
|
|
|||
|
|
@ -21,11 +21,12 @@ def psicomputations(variance, Z, variational_posterior, return_psi2_n=False):
|
|||
S = variational_posterior.variance
|
||||
|
||||
psi0 = (variance*(np.square(mu)+S)).sum(axis=1)
|
||||
psi1 = np.dot(mu,(variance*Z).T)
|
||||
if not return_psi2_n:
|
||||
psi2 = np.dot(S.sum(axis=0)*np.square(variance)*Z,Z.T)+ tdot(psi1.T)
|
||||
Zv = variance * Z
|
||||
psi1 = np.dot(mu,Zv.T)
|
||||
if return_psi2_n:
|
||||
psi2 = psi1[:,:,None] * psi1[:,None,:] + np.dot(S[:,None,:] * Zv[None,:,:], Zv.T)
|
||||
else:
|
||||
raise NotImplementedError
|
||||
psi2 = np.dot(S.sum(axis=0) * Zv, Zv.T) + tdot(psi1.T)
|
||||
|
||||
return psi0, psi1, psi2
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue