mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-12 21:42:39 +02:00
[tests] show skipped
This commit is contained in:
parent
2f57cf74a4
commit
f94e0bd20c
7 changed files with 20 additions and 11 deletions
|
|
@ -85,10 +85,10 @@ class WhiteHeteroscedastic(Static):
|
|||
def __init__(self, input_dim, num_data, variance=1., active_dims=None, name='white_hetero'):
|
||||
"""
|
||||
A heteroscedastic White kernel (nugget/noise).
|
||||
It defines one variance (nugget) per input sample.
|
||||
|
||||
It defines one variance (nugget) per input sample.
|
||||
|
||||
Prediction excludes any noise learnt by this Kernel, so be careful using this kernel.
|
||||
|
||||
|
||||
You can plot the errors learnt by this kernel by something similar as:
|
||||
plt.errorbar(m.X, m.Y, yerr=2*np.sqrt(m.kern.white.variance))
|
||||
"""
|
||||
|
|
@ -98,7 +98,7 @@ class WhiteHeteroscedastic(Static):
|
|||
|
||||
def Kdiag(self, X):
|
||||
if X.shape[0] == self.variance.shape[0]:
|
||||
# If the input has the same number of samples as
|
||||
# If the input has the same number of samples as
|
||||
# the number of variances, we return the variances
|
||||
return self.variance
|
||||
return 0.
|
||||
|
|
@ -181,7 +181,7 @@ class Fixed(Static):
|
|||
self.variance.gradient = np.einsum('ij,ij', dL_dK, self.fixed_K)
|
||||
|
||||
def update_gradients_diag(self, dL_dKdiag, X):
|
||||
self.variance.gradient = np.einsum('i,i', dL_dKdiag, self.fixed_K)
|
||||
self.variance.gradient = np.einsum('i,i', dL_dKdiag, np.diagonal(self.fixed_K))
|
||||
|
||||
def psi2(self, Z, variational_posterior):
|
||||
return np.zeros((Z.shape[0], Z.shape[0]), dtype=np.float64)
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ def _plot_data_error(self, canvas, which_data_rows='all',
|
|||
|
||||
return plots
|
||||
|
||||
def plot_inducing(self, visible_dims=None, projection='2d', label='inducing', **plot_kwargs):
|
||||
def plot_inducing(self, visible_dims=None, projection='2d', label='inducing', legend=True, **plot_kwargs):
|
||||
"""
|
||||
Plot the inducing inputs of a sparse gp model
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ def plot_inducing(self, visible_dims=None, projection='2d', label='inducing', **
|
|||
"""
|
||||
canvas, kwargs = pl().new_canvas(projection=projection, **plot_kwargs)
|
||||
plots = _plot_inducing(self, canvas, visible_dims, projection, label, **kwargs)
|
||||
return pl().add_to_canvas(canvas, plots, legend=label is not None)
|
||||
return pl().add_to_canvas(canvas, plots, legend=legend)
|
||||
|
||||
def _plot_inducing(self, canvas, visible_dims, projection, label, **plot_kwargs):
|
||||
if visible_dims is None:
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class StateSpaceKernelsTests(np.testing.TestCase):
|
|||
|
||||
ss_kernel = GPy.kern.sde_RBF(1, 110., 1.5, active_dims=[0,])
|
||||
gp_kernel = GPy.kern.RBF(1, 110., 1.5, active_dims=[0,])
|
||||
|
||||
|
||||
self.run_for_model(X, Y, ss_kernel, check_gradients=True,
|
||||
predict_X=X,
|
||||
gp_kernel=gp_kernel,
|
||||
|
|
@ -193,7 +193,7 @@ class StateSpaceKernelsTests(np.testing.TestCase):
|
|||
|
||||
def test_kernel_addition(self,):
|
||||
#np.random.seed(329) # seed the random number generator
|
||||
np.random.seed(333)
|
||||
np.random.seed(42)
|
||||
(X,Y) = generate_sine_data(x_points=None, sin_period=5.0, sin_ampl=5.0, noise_var=2.0,
|
||||
plot = False, points_num=100, x_interval = (0, 40), random=True)
|
||||
|
||||
|
|
|
|||
|
|
@ -325,6 +325,14 @@ class KernelGradientTestsContinuous(unittest.TestCase):
|
|||
k.randomize()
|
||||
self.assertTrue(check_kernel_gradient_functions(k, X=self.X, X2=self.X2, verbose=verbose))
|
||||
|
||||
def test_Fixed(self):
|
||||
Xall = np.concatenate([self.X, self.X])
|
||||
cov = np.dot(Xall, Xall.T)
|
||||
X = np.arange(self.N).reshape(1,self.N)
|
||||
k = GPy.kern.Fixed(1, cov)
|
||||
k.randomize()
|
||||
self.assertTrue(check_kernel_gradient_functions(k, X=X, X2=None, verbose=verbose))
|
||||
|
||||
def test_Poly(self):
|
||||
k = GPy.kern.Poly(self.D, order=5)
|
||||
k.randomize()
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ def test_twod():
|
|||
#m.optimize()
|
||||
m.plot_data()
|
||||
m.plot_mean()
|
||||
m.plot_inducing()
|
||||
m.plot_inducing(legend=False, marker='s')
|
||||
#m.plot_errorbars_trainset()
|
||||
m.plot_data_error()
|
||||
for do_test in _image_comparison(baseline_images=['gp_2d_{}'.format(sub) for sub in ["data", "mean",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue