From 7c375d0b8b8b44f4daaa003ae4448cc38fe99fd3 Mon Sep 17 00:00:00 2001 From: Jose Gomez-Dans Date: Sun, 25 Oct 2015 18:36:08 +0000 Subject: [PATCH] The inverse of Q is now calculated via its Cholesky decomposition. Should be a bit more stable, but unlikely that all numerical issues will go away with this fix. Closes #1 --- gp_emulator/GaussianProcess.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gp_emulator/GaussianProcess.py b/gp_emulator/GaussianProcess.py index ebc5a8d..f9bf30f 100644 --- a/gp_emulator/GaussianProcess.py +++ b/gp_emulator/GaussianProcess.py @@ -67,12 +67,11 @@ def _prepare_likelihood ( self ): self.Q = self.Z +\ exp_theta[self.D+1]*np.eye ( self.n ) L = np.linalg.cholesky ( self.Q ) - self.invQt = np.dot ( np.linalg.inv(L).dot( np.linalg.inv(L).T) ) + self.invQ = np.linalg.inv(L.T).dot( np.linalg.inv(L) ) #self.invQ = np.linalg.inv ( self.Q ) self.invQt = np.dot ( self.invQ, self.targets ) - self.logdetQ = 2.0 * np.sum ( np.log ( np.diag ( \ - np.linalg.cholesky ( self.Q )))) + self.logdetQ = 2.0 * np.sum ( np.log ( np.diag ( L ))) def loglikelihood ( self, theta ):