mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-27 14:25:16 +02:00
americanized spellings
This commit is contained in:
parent
95cedc7e4e
commit
6a330db253
7 changed files with 80 additions and 81 deletions
|
|
@ -30,7 +30,6 @@ class GP(model):
|
|||
.. Note:: Multiple independent outputs are allowed using columns of Y
|
||||
|
||||
"""
|
||||
#FIXME normalize vs normalise
|
||||
def __init__(self, X, likelihood, kernel, normalize_X=False, Xslices=None):
|
||||
|
||||
# parse arguments
|
||||
|
|
@ -41,7 +40,7 @@ class GP(model):
|
|||
assert isinstance(kernel, kern.kern)
|
||||
self.kern = kernel
|
||||
|
||||
#here's some simple normalisation for the inputs
|
||||
#here's some simple normalization for the inputs
|
||||
if normalize_X:
|
||||
self._Xmean = X.mean(0)[None,:]
|
||||
self._Xstd = X.std(0)[None,:]
|
||||
|
|
@ -134,7 +133,7 @@ class GP(model):
|
|||
def _raw_predict(self,_Xnew,slices=None, full_cov=False):
|
||||
"""
|
||||
Internal helper function for making predictions, does not account
|
||||
for normalisation or likelihood
|
||||
for normalization or likelihood
|
||||
"""
|
||||
Kx = self.kern.K(self.X,_Xnew, slices1=self.Xslices,slices2=slices)
|
||||
mu = np.dot(np.dot(Kx.T,self.Ki),self.likelihood.Y)
|
||||
|
|
@ -172,10 +171,10 @@ class GP(model):
|
|||
- If a list of booleans, specifying which kernel parts are active
|
||||
|
||||
If full_cov and self.D > 1, the return shape of var is Nnew x Nnew x self.D. If self.D == 1, the return shape is Nnew x Nnew.
|
||||
This is to allow for different normalisations of the output dimensions.
|
||||
This is to allow for different normalizations of the output dimensions.
|
||||
|
||||
"""
|
||||
#normalise X values
|
||||
#normalize X values
|
||||
Xnew = (Xnew.copy() - self._Xmean) / self._Xstd
|
||||
mu, var = self._raw_predict(Xnew, slices, full_cov)
|
||||
|
||||
|
|
@ -187,7 +186,7 @@ class GP(model):
|
|||
|
||||
def plot_f(self, samples=0, plot_limits=None, which_data='all', which_functions='all', resolution=None, full_cov=False):
|
||||
"""
|
||||
Plot the GP's view of the world, where the data is normalised and the likelihood is Gaussian
|
||||
Plot the GP's view of the world, where the data is normalized and the likelihood is Gaussian
|
||||
|
||||
:param samples: the number of a posteriori samples to plot
|
||||
:param which_data: which if the training data to plot (default all)
|
||||
|
|
@ -203,7 +202,7 @@ class GP(model):
|
|||
- In higher dimensions, we've no implemented this yet !TODO!
|
||||
|
||||
Can plot only part of the data and part of the posterior functions using which_data and which_functions
|
||||
Plot the data's view of the world, with non-normalised values and GP predictions passed through the likelihood
|
||||
Plot the data's view of the world, with non-normalized values and GP predictions passed through the likelihood
|
||||
"""
|
||||
if which_functions=='all':
|
||||
which_functions = [True]*self.kern.Nparts
|
||||
|
|
@ -221,7 +220,7 @@ class GP(model):
|
|||
Ysim = np.random.multivariate_normal(m.flatten(),v,samples)
|
||||
gpplot(Xnew,m,m-2*np.sqrt(np.diag(v)[:,None]),m+2*np.sqrt(np.diag(v))[:,None])
|
||||
for i in range(samples):
|
||||
pb.plot(Xnew,Ysim[i,:],Tango.coloursHex['darkBlue'],linewidth=0.25)
|
||||
pb.plot(Xnew,Ysim[i,:],Tango.colorsHex['darkBlue'],linewidth=0.25)
|
||||
pb.plot(self.X[which_data],self.likelihood.Y[which_data],'kx',mew=1.5)
|
||||
pb.xlim(xmin,xmax)
|
||||
ymin,ymax = min(np.append(self.likelihood.Y,m-2*np.sqrt(np.diag(v)[:,None]))), max(np.append(self.likelihood.Y,m+2*np.sqrt(np.diag(v)[:,None])))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue