mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-30 14:35:15 +02:00
fixes in likelihoods
This commit is contained in:
parent
ff1d0fd09b
commit
b96ff9cdfb
3 changed files with 3 additions and 32 deletions
|
|
@ -35,12 +35,7 @@ class Gaussian(Likelihood):
|
|||
if gp_link is None:
|
||||
gp_link = link_functions.Identity()
|
||||
|
||||
if isinstance(gp_link, link_functions.Identity):
|
||||
analytical_variance = True
|
||||
analytical_mean = True
|
||||
else:
|
||||
analytical_variance = False
|
||||
analytical_mean = False
|
||||
assert isinstance(gp_link, link_functions.Identity), "the likelihood only implemented for the identity link"
|
||||
|
||||
super(Gaussian, self).__init__(gp_link, name=name)
|
||||
|
||||
|
|
@ -97,14 +92,10 @@ class Gaussian(Likelihood):
|
|||
def predictive_variance(self, mu, sigma, predictive_mean=None):
|
||||
return self.variance + sigma**2
|
||||
|
||||
<<<<<<< HEAD
|
||||
def pdf_link(self, link_f, y, Y_metadata=None):
|
||||
=======
|
||||
def predictive_quantiles(self, mu, var, quantiles, Y_metadata):
|
||||
return [stats.norm.ppf(q/100.)*np.sqrt(var) + mu for q in quantiles]
|
||||
|
||||
def pdf_link(self, link_f, y, extra_data=None):
|
||||
>>>>>>> a3287c38ea775155df4e90f7fe1883d12ffb54b9
|
||||
def pdf_link(self, link_f, y, Y_metadata=None):
|
||||
"""
|
||||
Likelihood function given link(f)
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ class MixedNoise(Likelihood):
|
|||
return variance[:,None]
|
||||
|
||||
def betaY(self,Y,Y_metadata):
|
||||
#TODO not here.
|
||||
return Y/self.gaussian_variance(Y_metadata=Y_metadata)
|
||||
|
||||
def update_gradients(self, gradients):
|
||||
|
|
@ -57,16 +58,6 @@ class MixedNoise(Likelihood):
|
|||
return _variance + sigma**2
|
||||
|
||||
|
||||
def covariance_matrix(self, Y, Y_metadata):
|
||||
#assert all([isinstance(l, Gaussian) for l in self.likelihoods_list])
|
||||
#ind = Y_metadata['output_index'].flatten()
|
||||
#variance = np.zeros(Y.shape[0])
|
||||
#for lik, j in zip(self.likelihoods_list, range(len(self.likelihoods_list))):
|
||||
# variance[ind==j] = lik.variance
|
||||
#return np.diag(variance)
|
||||
return np.diag(self.gaussian_variance(Y_metadata).flatten())
|
||||
|
||||
|
||||
def samples(self, gp, Y_metadata):
|
||||
"""
|
||||
Returns a set of samples of observations based on a given value of the latent variable.
|
||||
|
|
|
|||
|
|
@ -246,9 +246,6 @@ class StudentT(Likelihood):
|
|||
return np.hstack((d2logpdf_dlink2_dvar, d2logpdf_dlink2_dv))
|
||||
|
||||
def predictive_mean(self, mu, sigma, Y_metadata=None):
|
||||
"""
|
||||
Compute mean of the prediction
|
||||
"""
|
||||
return self.gp_link.transf(mu) # only true in link is monotoci, which it is.
|
||||
|
||||
def predictive_variance(self, mu,variance, predictive_mean=None, Y_metadata=None):
|
||||
|
|
@ -260,16 +257,8 @@ class StudentT(Likelihood):
|
|||
def conditional_mean(self, gp):
|
||||
return self.gp_link.transf(gp)
|
||||
|
||||
<<<<<<< HEAD
|
||||
def predictive_mean(self, mu, sigma):
|
||||
"""
|
||||
Compute mean of the prediction
|
||||
"""
|
||||
return mu
|
||||
=======
|
||||
def conditional_variance(self, gp):
|
||||
return self.deg_free/(self.deg_free - 2.)
|
||||
>>>>>>> a3287c38ea775155df4e90f7fe1883d12ffb54b9
|
||||
|
||||
def samples(self, gp, Y_metadata=None):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue