added ability to handle likelihood with zero variance

This commit is contained in:
Nicolas 2013-06-04 15:25:13 +01:00
parent aa8b75d0c5
commit b4a3ac7809

View file

@ -51,11 +51,15 @@ class Gaussian(likelihood):
return ["noise_variance"] return ["noise_variance"]
def _set_params(self, x): def _set_params(self, x):
x = float(x) x = np.float64(x)
if self._variance != x: if self._variance != x:
self.precision = 1. / x if x == 0.:
self.precision = None
self.V = None
else:
self.precision = 1. / x
self.V = (self.precision) * self.Y
self.covariance_matrix = np.eye(self.N) * x self.covariance_matrix = np.eye(self.N) * x
self.V = (self.precision) * self.Y
self._variance = x self._variance = x
def predictive_values(self, mu, var, full_cov): def predictive_values(self, mu, var, full_cov):