mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-02 14:45:15 +02:00
very basic functionality is now working
This commit is contained in:
parent
bdc89170d4
commit
d077d28fd1
10 changed files with 88 additions and 284 deletions
|
|
@ -1,16 +1,39 @@
|
|||
import numpy as np
|
||||
|
||||
class Gaussian:
|
||||
def __init__(self,data,variance=1.,normalise=False):
|
||||
def __init__(self,data,variance=1.,normalize=False):
|
||||
self.data = data
|
||||
if normalise:
|
||||
foo
|
||||
self._variance = variance
|
||||
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.YYT = np.dot(self.Y,self.Y.T)
|
||||
self._set_params(np.asarray(variance))
|
||||
|
||||
def _get_params(self):
|
||||
return np.asarray(self.variance)
|
||||
return np.asarray(self._variance)
|
||||
|
||||
def _get_param_names(self):
|
||||
return ["noise variance"]
|
||||
|
||||
def _set_params(self,x):
|
||||
self._variance = x
|
||||
self.variance = np.eye(self.N)*self._variance
|
||||
|
||||
def fit(self):
|
||||
"""
|
||||
No approximations needed
|
||||
"""
|
||||
pass
|
||||
def _gradients(self,foo):
|
||||
return bar(foo)
|
||||
|
||||
def _gradients(self,partial):
|
||||
return np.sum(np.diag(partial))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue