mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-15 06:52:39 +02:00
added a set_data method to the Gaussian likelihood
This commit is contained in:
parent
634c3597ea
commit
73f7b72708
1 changed files with 8 additions and 7 deletions
|
|
@ -5,20 +5,24 @@ class Gaussian(likelihood):
|
|||
def __init__(self,data,variance=1.,normalize=False):
|
||||
self.is_heteroscedastic = False
|
||||
self.Nparams = 1
|
||||
self.data = data
|
||||
self.N,D = data.shape
|
||||
self.Z = 0. # a correction factor which accounts for the approximation made
|
||||
|
||||
#normalisation
|
||||
if normalize:
|
||||
self._mean = data.mean(0)[None,:]
|
||||
self._std = data.std(0)[None,:]
|
||||
self.Y = (self.data - self._mean)/self._std
|
||||
else:
|
||||
self._mean = np.zeros((1,D))
|
||||
self._std = np.ones((1,D))
|
||||
self.Y = self.data
|
||||
|
||||
self.set_data(data)
|
||||
|
||||
self._set_params(np.asarray(variance))
|
||||
|
||||
def set_data(self,data):
|
||||
self.data = data
|
||||
self.N,D = data.shape
|
||||
self.Y = (self.data - self._mean)/self._std
|
||||
if D > self.N:
|
||||
self.YYT = np.dot(self.Y,self.Y.T)
|
||||
self.trYYT = np.trace(self.YYT)
|
||||
|
|
@ -26,9 +30,6 @@ class Gaussian(likelihood):
|
|||
self.YYT = None
|
||||
self.trYYT = None
|
||||
|
||||
self._set_params(np.asarray(variance))
|
||||
|
||||
|
||||
def _get_params(self):
|
||||
return np.asarray(self._variance)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue