mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-03 08:42:39 +02:00
[basisfunc] kernel tests and model tests
This commit is contained in:
parent
c3c98652d1
commit
ba48c00e9d
5 changed files with 119 additions and 19 deletions
|
|
@ -477,6 +477,34 @@ class KernelGradientTestsContinuous(unittest.TestCase):
|
|||
k.randomize()
|
||||
self.assertTrue(check_kernel_gradient_functions(k, X=X, X2=X2, verbose=verbose, fixed_X_dims=[0]))
|
||||
|
||||
def test_basis_func_linear_slope(self):
|
||||
start_stop = np.random.uniform(self.X.min(0), self.X.max(0), (4, self.X.shape[1])).T
|
||||
start_stop.sort(axis=1)
|
||||
ks = []
|
||||
for i in range(start_stop.shape[0]):
|
||||
start, stop = np.split(start_stop[i], 2)
|
||||
ks.append(GPy.kern.LinearSlopeBasisFuncKernel(1, start, stop, ARD=i%2==0, active_dims=[i]))
|
||||
k = GPy.kern.Add(ks)
|
||||
self.assertTrue(check_kernel_gradient_functions(k, X=self.X, X2=self.X2, verbose=verbose))
|
||||
|
||||
def test_basis_func_changepoint(self):
|
||||
points = np.random.uniform(self.X.min(0), self.X.max(0), (self.X.shape[1]))
|
||||
ks = []
|
||||
for i in range(points.shape[0]):
|
||||
ks.append(GPy.kern.ChangePointBasisFuncKernel(1, points[i], ARD=i%2==0, active_dims=[i]))
|
||||
k = GPy.kern.Add(ks)
|
||||
self.assertTrue(check_kernel_gradient_functions(k, X=self.X, X2=self.X2, verbose=verbose))
|
||||
|
||||
def test_basis_func_domain(self):
|
||||
start_stop = np.random.uniform(self.X.min(0), self.X.max(0), (4, self.X.shape[1])).T
|
||||
start_stop.sort(axis=1)
|
||||
ks = []
|
||||
for i in range(start_stop.shape[0]):
|
||||
start, stop = np.split(start_stop[i], 2)
|
||||
ks.append(GPy.kern.DomainKernel(1, start, stop, ARD=i%2==0, active_dims=[i]))
|
||||
k = GPy.kern.Add(ks)
|
||||
self.assertTrue(check_kernel_gradient_functions(k, X=self.X, X2=self.X2, verbose=verbose))
|
||||
|
||||
class KernelTestsMiscellaneous(unittest.TestCase):
|
||||
def setUp(self):
|
||||
N, D = 100, 10
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue