mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-12 05:22:38 +02:00
Merge branch 'devel' of github.com:/sheffieldml/GPy into mean_functions
This commit is contained in:
commit
254157ce04
6 changed files with 50 additions and 6 deletions
34
GPy/testing/svgp_tests.py
Normal file
34
GPy/testing/svgp_tests.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import numpy as np
|
||||
import scipy as sp
|
||||
import GPy
|
||||
|
||||
class SVGP_nonconvex(np.testing.TestCase):
|
||||
"""
|
||||
Inference in the SVGP with a student-T likelihood
|
||||
"""
|
||||
def setUp(self):
|
||||
X = np.linspace(0,10,100).reshape(-1,1)
|
||||
Z = np.linspace(0,10,10).reshape(-1,1)
|
||||
Y = np.sin(X) + np.random.randn(*X.shape)*0.1
|
||||
Y[50] += 3
|
||||
|
||||
lik = GPy.likelihoods.StudentT(deg_free=2)
|
||||
k = GPy.kern.RBF(1, lengthscale=5.) + GPy.kern.White(1, 1e-6)
|
||||
self.m = GPy.core.SVGP(X, Y, Z=Z, likelihood=lik, kernel=k)
|
||||
def test_grad(self):
|
||||
assert self.m.checkgrad(step=1e-4)
|
||||
|
||||
class SVGP_classification(np.testing.TestCase):
|
||||
"""
|
||||
Inference in the SVGP with a Bernoulli likelihood
|
||||
"""
|
||||
def setUp(self):
|
||||
X = np.linspace(0,10,100).reshape(-1,1)
|
||||
Z = np.linspace(0,10,10).reshape(-1,1)
|
||||
Y = np.where((np.sin(X) + np.random.randn(*X.shape)*0.1)>0, 1,0)
|
||||
|
||||
lik = GPy.likelihoods.Bernoulli()
|
||||
k = GPy.kern.RBF(1, lengthscale=5.) + GPy.kern.White(1, 1e-6)
|
||||
self.m = GPy.core.SVGP(X, Y, Z=Z, likelihood=lik, kernel=k)
|
||||
def test_grad(self):
|
||||
assert self.m.checkgrad(step=1e-4)
|
||||
Loading…
Add table
Add a link
Reference in a new issue