From 7b63a195b8b338d6c2e5df9cb03956d47d1debe0 Mon Sep 17 00:00:00 2001 From: mzwiessele Date: Thu, 25 Aug 2016 08:28:58 +0100 Subject: [PATCH] [studentT] prior by @mathDR --- GPy/kern/src/basis_funcs.py | 4 ++-- GPy/testing/prior_tests.py | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/GPy/kern/src/basis_funcs.py b/GPy/kern/src/basis_funcs.py index 7a5f84dd..81b308b0 100644 --- a/GPy/kern/src/basis_funcs.py +++ b/GPy/kern/src/basis_funcs.py @@ -142,9 +142,9 @@ class LogisticBasisFuncKernel(BasisFuncKernel): self.centers = np.atleast_2d(centers) self.ARD_slope = ARD_slope if self.ARD_slope: - self.slope = Param('slope', slope * np.ones(self.centers.size), Logexp()) + self.slope = Param('slope', slope * np.ones(self.centers.size)) else: - self.slope = Param('slope', slope, Logexp()) + self.slope = Param('slope', slope) super(LogisticBasisFuncKernel, self).__init__(input_dim, variance, active_dims, ARD, name) self.link_parameter(self.slope) diff --git a/GPy/testing/prior_tests.py b/GPy/testing/prior_tests.py index 1371f965..269d8b2d 100644 --- a/GPy/testing/prior_tests.py +++ b/GPy/testing/prior_tests.py @@ -18,6 +18,15 @@ class PriorTests(unittest.TestCase): # setting a StudentT prior on non-negative parameters # should raise an assertionerror. self.assertRaises(AssertionError, m.rbf.set_prior, studentT) + + m = GPy.models.SparseGPRegression(X, y) + + gaussian = GPy.priors.Gaussian(1, 1) + m.Z.set_prior(studentT) + # setting a Gaussian prior on non-negative parameters + # should raise an assertionerror. + #self.assertRaises(AssertionError, m.Z.set_prior, gaussian) + self.assertTrue(m.checkgrad()) def test_lognormal(self): xmin, xmax = 1, 2.5*np.pi @@ -87,7 +96,7 @@ class PriorTests(unittest.TestCase): # setting a Gaussian prior on non-negative parameters # should raise an assertionerror. #self.assertRaises(AssertionError, m.Z.set_prior, gaussian) - + self.assertTrue(m.checkgrad()) def test_fixed_domain_check(self):