diff --git a/GPy/testing/rv_transformation_tests.py b/GPy/testing/rv_transformation_tests.py index 34e54e57..18dccd36 100644 --- a/GPy/testing/rv_transformation_tests.py +++ b/GPy/testing/rv_transformation_tests.py @@ -14,8 +14,8 @@ class TestModel(GPy.core.Model): """ A simple GPy model with one parameter. """ - def __init__(self, name): - GPy.core.Model.__init__(self, name) + def __init__(self): + GPy.core.Model.__init__(self, 'test_model') theta = GPy.core.Param('theta', 1.) self.link_parameter(theta) @@ -26,7 +26,7 @@ class TestModel(GPy.core.Model): class RVTransformationTestCase(unittest.TestCase): def _test_trans(self, trans): - m = TestModel(trans.__class__.__name__) + m = TestModel() prior = GPy.priors.LogGaussian(.5, 0.1) m.theta.set_prior(prior) m.theta.unconstrain() @@ -34,7 +34,7 @@ class RVTransformationTestCase(unittest.TestCase): # The PDF of the transformed variables p_phi = lambda phi : np.exp(-m._objective_grads(phi)[0]) # To the empirical PDF of: - theta_s = prior.rvs(100000) + theta_s = prior.rvs(1e6) phi_s = trans.finv(theta_s) # which is essentially a kernel density estimation kde = st.gaussian_kde(phi_s) @@ -56,15 +56,12 @@ class RVTransformationTestCase(unittest.TestCase): # The following test cannot be very accurate self.assertTrue(np.linalg.norm(pdf_phi - kde(phi)) / np.linalg.norm(kde(phi)) <= 1e-1) # Check the gradients at a few random points - print(theta_s.min(), theta_s.max()) for i in range(5): - print(theta_s[i]) m.theta = theta_s[i] self.assertTrue(m.checkgrad(verbose=True)) def test_Logexp(self): self._test_trans(GPy.constraints.Logexp()) - def test_Exponent(self): self._test_trans(GPy.constraints.Exponent())