mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-04-27 13:56:23 +02:00
Merge branch 'params' of github.com:SheffieldML/GPy into params
This commit is contained in:
commit
a3287c38ea
4 changed files with 8 additions and 9 deletions
|
|
@ -42,10 +42,8 @@ class GP(Model):
|
||||||
assert Y.shape[0] == self.num_data
|
assert Y.shape[0] == self.num_data
|
||||||
_, self.output_dim = self.Y.shape
|
_, self.output_dim = self.Y.shape
|
||||||
|
|
||||||
if Y_metadata is None:
|
#TODO: check the type of this is okay?
|
||||||
self.Y_metadata = {}
|
self.Y_metadata = Y_metadata
|
||||||
else:
|
|
||||||
self.Y_metadata = Y_metadata
|
|
||||||
|
|
||||||
assert isinstance(kernel, kern.Kern)
|
assert isinstance(kernel, kern.Kern)
|
||||||
#assert self.input_dim == kernel.input_dim
|
#assert self.input_dim == kernel.input_dim
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
from posterior import Posterior
|
from posterior import Posterior
|
||||||
from ...util.linalg import pdinv, dpotrs, tdot
|
from ...util.linalg import pdinv, dpotrs, tdot
|
||||||
|
from ...util import diag
|
||||||
import numpy as np
|
import numpy as np
|
||||||
log_2_pi = np.log(2*np.pi)
|
log_2_pi = np.log(2*np.pi)
|
||||||
|
|
||||||
|
|
@ -41,7 +42,9 @@ class ExactGaussianInference(object):
|
||||||
|
|
||||||
K = kern.K(X)
|
K = kern.K(X)
|
||||||
|
|
||||||
Wi, LW, LWi, W_logdet = pdinv(K + likelihood.covariance_matrix(Y, Y_metadata))
|
Ky = K.copy()
|
||||||
|
diag.add(Ky, likelihood.gaussian_variance(Y, Y_metadata))
|
||||||
|
Wi, LW, LWi, W_logdet = pdinv(Ky)
|
||||||
|
|
||||||
alpha, _ = dpotrs(LW, YYT_factor, lower=1)
|
alpha, _ = dpotrs(LW, YYT_factor, lower=1)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class VarDTC(object):
|
||||||
_, output_dim = Y.shape
|
_, output_dim = Y.shape
|
||||||
|
|
||||||
#see whether we've got a different noise variance for each datum
|
#see whether we've got a different noise variance for each datum
|
||||||
beta = 1./np.fmax(likelihood.gaussian_variance(Y_metadata), 1e-6)
|
beta = 1./np.fmax(likelihood.gaussian_variance(Y, Y_metadata), 1e-6)
|
||||||
# VVT_factor is a matrix such that tdot(VVT_factor) = VVT...this is for efficiency!
|
# VVT_factor is a matrix such that tdot(VVT_factor) = VVT...this is for efficiency!
|
||||||
#self.YYTfactor = self.get_YYTfactor(Y)
|
#self.YYTfactor = self.get_YYTfactor(Y)
|
||||||
#VVT_factor = self.get_VVTfactor(self.YYTfactor, beta)
|
#VVT_factor = self.get_VVTfactor(self.YYTfactor, beta)
|
||||||
|
|
|
||||||
|
|
@ -51,14 +51,12 @@ class Gaussian(Likelihood):
|
||||||
self.log_concave = True
|
self.log_concave = True
|
||||||
|
|
||||||
def betaY(self,Y,Y_metadata=None):
|
def betaY(self,Y,Y_metadata=None):
|
||||||
|
#TODO: ~Ricardo this does not live here
|
||||||
return Y/self.gaussian_variance(Y_metadata)
|
return Y/self.gaussian_variance(Y_metadata)
|
||||||
|
|
||||||
def gaussian_variance(self, Y_metadata=None):
|
def gaussian_variance(self, Y_metadata=None):
|
||||||
return self.variance
|
return self.variance
|
||||||
|
|
||||||
def covariance_matrix(self, Y, Y_metadata=None):
|
|
||||||
return np.eye(Y.shape[0]) * self.variance
|
|
||||||
|
|
||||||
def update_gradients(self, grad):
|
def update_gradients(self, grad):
|
||||||
self.variance.gradient = grad
|
self.variance.gradient = grad
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue