From d01545c92b8cbd9995fc32d35b878a8f61a67b39 Mon Sep 17 00:00:00 2001 From: Zhenwen Dai Date: Sat, 16 May 2015 22:39:11 +0100 Subject: [PATCH] prevent the predicted variance to be negative --- GPy/core/gp.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/GPy/core/gp.py b/GPy/core/gp.py index c2d2010c..63316384 100644 --- a/GPy/core/gp.py +++ b/GPy/core/gp.py @@ -209,6 +209,8 @@ class GP(Model): var = Kxx - np.sum(WiKx*Kx, 0) var = var.reshape(-1, 1) + var[var<0.] = 0. + #force mu to be a column vector if len(mu.shape)==1: mu = mu[:,None]