[fix #380] reloading ep

This commit is contained in:
mzwiessele 2016-04-27 12:37:04 +01:00
parent 7da7460377
commit e4d76a133a
2 changed files with 29 additions and 2 deletions

View file

@ -51,7 +51,7 @@ class EP(EPBase, ExactGaussianInference):
if K is None:
K = kern.K(X)
if self._ep_approximation is None:
if getattr(self, '_ep_approximation', None) is None:
#if we don't yet have the results of runnign EP, run EP and store the computed factors in self._ep_approximation
mu, Sigma, mu_tilde, tau_tilde, Z_tilde = self._ep_approximation = self.expectation_propagation(K, Y, likelihood, Y_metadata)
else:
@ -159,7 +159,7 @@ class EPDTC(EPBase, VarDTC):
else:
Kmn = psi1.T
if self._ep_approximation is None:
if getattr(self, '_ep_approximation', None) is None:
mu, Sigma, mu_tilde, tau_tilde, Z_tilde = self._ep_approximation = self.expectation_propagation(Kmm, Kmn, Y, likelihood, Y_metadata)
else:
mu, Sigma, mu_tilde, tau_tilde, Z_tilde = self._ep_approximation