[inference] rename wrong precision into variance

This commit is contained in:
Max Zwiessele 2016-09-01 13:16:50 +01:00
parent 898a9e3f15
commit 896887bd94
2 changed files with 5 additions and 5 deletions

View file

@ -21,7 +21,7 @@ class ExactGaussianInference(LatentFunctionInference):
def __init__(self): def __init__(self):
pass#self._YYTfactor_cache = caching.cache() pass#self._YYTfactor_cache = caching.cache()
def inference(self, kern, X, likelihood, Y, mean_function=None, Y_metadata=None, K=None, precision=None, Z_tilde=None): def inference(self, kern, X, likelihood, Y, mean_function=None, Y_metadata=None, K=None, variance=None, Z_tilde=None):
""" """
Returns a Posterior class containing essential quantities of the posterior Returns a Posterior class containing essential quantities of the posterior
""" """
@ -31,8 +31,8 @@ class ExactGaussianInference(LatentFunctionInference):
else: else:
m = mean_function.f(X) m = mean_function.f(X)
if precision is None: if variance is None:
precision = likelihood.gaussian_variance(Y_metadata) variance = likelihood.gaussian_variance(Y_metadata)
YYT_factor = Y-m YYT_factor = Y-m
@ -40,7 +40,7 @@ class ExactGaussianInference(LatentFunctionInference):
K = kern.K(X) K = kern.K(X)
Ky = K.copy() Ky = K.copy()
diag.add(Ky, precision+1e-8) diag.add(Ky, variance+1e-8)
Wi, LW, LWi, W_logdet = pdinv(Ky) Wi, LW, LWi, W_logdet = pdinv(Ky)

View file

@ -66,7 +66,7 @@ class EP(EPBase, ExactGaussianInference):
#if we've already run EP, just use the existing approximation stored in self._ep_approximation #if we've already run EP, just use the existing approximation stored in self._ep_approximation
mu, Sigma, mu_tilde, tau_tilde, Z_tilde = self._ep_approximation mu, Sigma, mu_tilde, tau_tilde, Z_tilde = self._ep_approximation
return super(EP, self).inference(kern, X, likelihood, mu_tilde[:,None], mean_function=mean_function, Y_metadata=Y_metadata, precision=1./tau_tilde, K=K, Z_tilde=np.log(Z_tilde).sum()) return super(EP, self).inference(kern, X, likelihood, mu_tilde[:,None], mean_function=mean_function, Y_metadata=Y_metadata, variance=1./tau_tilde, K=K, Z_tilde=np.log(Z_tilde).sum())
def expectation_propagation(self, K, Y, likelihood, Y_metadata): def expectation_propagation(self, K, Y, likelihood, Y_metadata):