prevent the predicted variance to be negative

This commit is contained in:
Zhenwen Dai 2015-05-16 22:39:11 +01:00
parent 51a4e881da
commit d01545c92b

View file

@ -209,6 +209,8 @@ class GP(Model):
var = Kxx - np.sum(WiKx*Kx, 0) var = Kxx - np.sum(WiKx*Kx, 0)
var = var.reshape(-1, 1) var = var.reshape(-1, 1)
var[var<0.] = 0.
#force mu to be a column vector #force mu to be a column vector
if len(mu.shape)==1: mu = mu[:,None] if len(mu.shape)==1: mu = mu[:,None]