mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-13 14:03:20 +02:00
removed some X_normalising things
This commit is contained in:
parent
b9a51a2ab8
commit
63ec89567f
1 changed files with 9 additions and 10 deletions
|
|
@ -9,7 +9,8 @@ from ..util.plot import gpplot, Tango, x_frame1D, x_frame2D
|
|||
from model import Model
|
||||
from parameterization import ObservableArray
|
||||
from .. import likelihoods
|
||||
from GPy.likelihoods.gaussian import Gaussian
|
||||
from ..likelihoods.gaussian import Gaussian
|
||||
from ..inference.latent_function_inference import exact_gaussian_inference
|
||||
|
||||
class GP(Model):
|
||||
"""
|
||||
|
|
@ -26,7 +27,7 @@ class GP(Model):
|
|||
|
||||
"""
|
||||
def __init__(self, X, Y, kernel, likelihood, inference_method=None, name='gp'):
|
||||
super(GPBase, self).__init__(name)
|
||||
super(GP, self).__init__(name)
|
||||
|
||||
assert X.ndim == 2
|
||||
self.X = ObservableArray(X)
|
||||
|
|
@ -50,13 +51,13 @@ class GP(Model):
|
|||
else:
|
||||
inference_method = expectation_propagation
|
||||
print "defaulting to ", inference_method, "for latent function inference"
|
||||
|
||||
super(GP, self).__init__(X, Y, kernel, likelihood, inference_method, name)
|
||||
self.parameters_changed()
|
||||
self.inference_method = inference_method
|
||||
|
||||
self.add_parameter(self.kern, gradient=self.dL_dtheta_K)
|
||||
self.add_parameter(self.likelihood, gradient=lambda:self.posterior.dL_dtheta_lik)
|
||||
|
||||
self.parameters_changed()
|
||||
|
||||
def parameters_changed(self):
|
||||
super(GP, self).parameters_changed()
|
||||
self.K = self.kern.K(self.X)
|
||||
|
|
@ -241,8 +242,7 @@ class GP(Model):
|
|||
|
||||
#define the frame on which to plot
|
||||
resolution = resolution or 200
|
||||
Xu = self.X * self._Xscale + self._Xoffset #NOTE self.X are the normalized values now
|
||||
Xnew, xmin, xmax = x_frame1D(Xu[:,free_dims], plot_limits=plot_limits)
|
||||
Xnew, xmin, xmax = x_frame1D(self.X[:,free_dims], plot_limits=plot_limits)
|
||||
Xgrid = np.empty((Xnew.shape[0],self.input_dim))
|
||||
Xgrid[:,free_dims] = Xnew
|
||||
for i,v in fixed_inputs:
|
||||
|
|
@ -259,7 +259,7 @@ class GP(Model):
|
|||
Y = self.Y
|
||||
for d in which_data_ycols:
|
||||
gpplot(Xnew, m[:, d], lower[:, d], upper[:, d], axes=ax, edgecol=linecol, fillcol=fillcol)
|
||||
ax.plot(Xu[which_data_rows,free_dims], Y[which_data_rows, d], 'kx', mew=1.5)
|
||||
ax.plot(self.X[which_data_rows,free_dims], Y[which_data_rows, d], 'kx', mew=1.5)
|
||||
|
||||
#optionally plot some samples
|
||||
if samples: #NOTE not tested with fixed_inputs
|
||||
|
|
@ -279,8 +279,7 @@ class GP(Model):
|
|||
|
||||
#define the frame for plotting on
|
||||
resolution = resolution or 50
|
||||
Xu = self.X * self._Xscale + self._Xoffset #NOTE self.X are the normalized values now
|
||||
Xnew, _, _, xmin, xmax = x_frame2D(Xu[:,free_dims], plot_limits, resolution)
|
||||
Xnew, _, _, xmin, xmax = x_frame2D(self.X[:,free_dims], plot_limits, resolution)
|
||||
Xgrid = np.empty((Xnew.shape[0],self.input_dim))
|
||||
Xgrid[:,free_dims] = Xnew
|
||||
for i,v in fixed_inputs:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue