mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-11 15:15:15 +02:00
Set warnings for truncated hessian, it has been noted that that by
truncating we can have incorrect posteriors, though at convergence this should not be a problem, could be fixed by not using Cholsky as the decomposition as it cannot handle non-positive definite mats
This commit is contained in:
parent
4a751fd2da
commit
cb6c1dd0d2
1 changed files with 10 additions and 7 deletions
|
|
@ -250,8 +250,11 @@ class Laplace(likelihood):
|
|||
self.W = -self.noise_model.d2logpdf_df2(self.f_hat, self.data, extra_data=self.extra_data)
|
||||
|
||||
if not self.noise_model.log_concave:
|
||||
#print "Under 1e-10: {}".format(np.sum(self.W < 1e-6))
|
||||
self.W[self.W < 1e-6] = 1e-6 # FIXME-HACK: This is a hack since GPy can't handle negative variances which can occur
|
||||
i = self.W < 1e-6
|
||||
if np.any(i):
|
||||
warnings.warn('truncating non log-concave likelihood curvature')
|
||||
# FIXME-HACK: This is a hack since GPy can't handle negative variances which can occur
|
||||
self.W[i] = 1e-6
|
||||
|
||||
self.W12BiW12, self.ln_B_det = self._compute_B_statistics(self.K, self.W, np.eye(self.N))
|
||||
|
||||
|
|
@ -270,14 +273,14 @@ class Laplace(likelihood):
|
|||
:type W: Vector of diagonal values of hessian (1xN)
|
||||
:param a: Matrix to calculate W12BiW12a
|
||||
:type a: Matrix NxN
|
||||
:returns: (W12BiW12, ln_B_det)
|
||||
:returns: (W12BiW12a, ln_B_det)
|
||||
"""
|
||||
if not self.noise_model.log_concave:
|
||||
#print "Under 1e-10: {}".format(np.sum(W < 1e-6))
|
||||
W[W < 1e-6] = 1e-6 # FIXME-HACK: This is a hack since GPy can't handle negative variances which can occur
|
||||
# If the likelihood is non-log-concave. We wan't to say that there is a negative variance
|
||||
# To cause the posterior to become less certain than the prior and likelihood,
|
||||
# This is a property only held by non-log-concave likelihoods
|
||||
W[W < 1e-10] = 1e-10 # FIXME-HACK: This is a hack since GPy can't handle negative variances which can occur
|
||||
# If the likelihood is non-log-concave. We wan't to say that there is a negative variance
|
||||
# To cause the posterior to become less certain than the prior and likelihood,
|
||||
# This is a property only held by non-log-concave likelihoods
|
||||
|
||||
|
||||
#W is diagonal so its sqrt is just the sqrt of the diagonal elements
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue