From e32afa11e5b437ef5db6bfd015f4f87936723bd0 Mon Sep 17 00:00:00 2001 From: Nicolo Fusi Date: Mon, 11 Mar 2013 12:33:03 +0000 Subject: [PATCH 1/3] added GPy.tests(), removed some useless tests --- GPy/__init__.py | 5 +++++ GPy/testing/bgplvm_tests.py | 5 ++++- GPy/testing/kernel_tests.py | 1 - GPy/testing/unit_tests.py | 11 ----------- setup.py | 6 ++---- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/GPy/__init__.py b/GPy/__init__.py index c0772c27..6c43e471 100644 --- a/GPy/__init__.py +++ b/GPy/__init__.py @@ -9,3 +9,8 @@ import util import examples from core import priors import likelihoods +import testing +from numpy.testing import Tester + +def tests(): + Tester(testing).test(verbose=10) diff --git a/GPy/testing/bgplvm_tests.py b/GPy/testing/bgplvm_tests.py index c49bdfda..e3bd2b36 100644 --- a/GPy/testing/bgplvm_tests.py +++ b/GPy/testing/bgplvm_tests.py @@ -12,6 +12,7 @@ class BGPLVMTests(unittest.TestCase): k = GPy.kern.rbf(Q) + GPy.kern.white(Q, 0.00001) K = k.K(X) Y = np.random.multivariate_normal(np.zeros(N),K,D).T + Y -= Y.mean(axis=0) k = GPy.kern.bias(Q) + GPy.kern.white(Q, 0.00001) m = GPy.models.Bayesian_GPLVM(Y, Q, kernel = k, M=M) m.constrain_positive('(rbf|bias|noise|white|S)') @@ -24,6 +25,7 @@ class BGPLVMTests(unittest.TestCase): k = GPy.kern.rbf(Q) + GPy.kern.white(Q, 0.00001) K = k.K(X) Y = np.random.multivariate_normal(np.zeros(N),K,D).T + Y -= Y.mean(axis=0) k = GPy.kern.linear(Q) + GPy.kern.white(Q, 0.00001) m = GPy.models.Bayesian_GPLVM(Y, Q, kernel = k, M=M) m.constrain_positive('(linear|bias|noise|white|S)') @@ -36,13 +38,14 @@ class BGPLVMTests(unittest.TestCase): k = GPy.kern.rbf(Q) + GPy.kern.white(Q, 0.00001) K = k.K(X) Y = np.random.multivariate_normal(np.zeros(N),K,D).T + Y -= Y.mean(axis=0) k = GPy.kern.rbf(Q) + GPy.kern.white(Q, 0.00001) m = GPy.models.Bayesian_GPLVM(Y, Q, kernel = k, M=M) m.constrain_positive('(rbf|bias|noise|white|S)') m.randomize() self.assertTrue(m.checkgrad()) - + if __name__ == "__main__": print "Running unit tests, please be (very) patient..." unittest.main() diff --git a/GPy/testing/kernel_tests.py b/GPy/testing/kernel_tests.py index 3d738106..bb809ea6 100644 --- a/GPy/testing/kernel_tests.py +++ b/GPy/testing/kernel_tests.py @@ -13,7 +13,6 @@ class KernelTests(unittest.TestCase): X = np.random.rand(5,5) Y = np.ones((5,1)) m = GPy.models.GP_regression(X,Y,K) - print m self.assertTrue(m.checkgrad()) def test_coregionalisation(self): diff --git a/GPy/testing/unit_tests.py b/GPy/testing/unit_tests.py index 61fb15bb..55963805 100644 --- a/GPy/testing/unit_tests.py +++ b/GPy/testing/unit_tests.py @@ -177,17 +177,6 @@ class GradientTests(unittest.TestCase): m.approximate_likelihood() self.assertTrue(m.checkgrad()) - def test_warped_GP(self): - xmin, xmax = 1, 2.5*np.pi - b, C, SNR = 1, 0, 0.1 - X = np.linspace(xmin, xmax, 500) - y = b*X + C + 1*np.sin(X) - y += 0.05*np.random.randn(len(X)) - X, y = X[:, None], y[:, None] - m = GPy.models.warpedGP(X, y, warping_terms = 3) - m.constrain_positive('(tanh_a|tanh_b|rbf|white|bias)') - self.assertTrue(m.checkgrad()) - if __name__ == "__main__": print "Running unit tests, please be (very) patient..." diff --git a/setup.py b/setup.py index d24171e2..b701b74d 100644 --- a/setup.py +++ b/setup.py @@ -3,8 +3,6 @@ import os from setuptools import setup -#from numpy.distutils.core import Extension, setup -#from sphinx.setup_command import BuildDoc # Version number version = '0.1.3' @@ -14,12 +12,12 @@ def read(fname): setup(name = 'GPy', version = version, - author = 'James Hensman, Nicolo Fusi, Ricardo Andrade, Nicolas Durrande, Alan Saul, Neil D. Lawrence', + author = read('AUTHORS.txt'), author_email = "james.hensman@gmail.com", description = ("The Gaussian Process Toolbox"), license = "BSD 3-clause", keywords = "machine-learning gaussian-processes kernels", - url = "http://ml.sheffield.ac.uk/GPy/", + url = "http://sheffieldml.github.com/GPy/", packages = ['GPy', 'GPy.core', 'GPy.kern', 'GPy.util', 'GPy.models', 'GPy.inference', 'GPy.examples', 'GPy.likelihoods'], package_dir={'GPy': 'GPy'}, package_data = {'GPy': ['GPy/examples']}, From f98e52ffe8cd5678b178eb69fa771b23af55125f Mon Sep 17 00:00:00 2001 From: Nicolo Fusi Date: Mon, 11 Mar 2013 12:40:14 +0000 Subject: [PATCH 2/3] now running nosetest doesn't run unittests twice --- GPy/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/GPy/__init__.py b/GPy/__init__.py index 6c43e471..fa69dac3 100644 --- a/GPy/__init__.py +++ b/GPy/__init__.py @@ -11,6 +11,8 @@ from core import priors import likelihoods import testing from numpy.testing import Tester +from nose.tools import nottest +@nottest def tests(): Tester(testing).test(verbose=10) From e511bb69cf25cfa3c6c8aea946a85fcdf3f437d2 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 11 Mar 2013 12:40:29 +0000 Subject: [PATCH 3/3] added in documentation the current status of kernel implementation --- doc/Figures/tick.png | Bin 0 -> 175 bytes doc/GPy.examples.rst | 16 +++++++++++++ doc/GPy.kern.rst | 28 ++++++++++++++++++----- doc/kernel_implementation.rst | 41 +++++++++++++++++++++++++--------- doc/tuto_kernel_overview.rst | 2 +- 5 files changed, 70 insertions(+), 17 deletions(-) create mode 100644 doc/Figures/tick.png diff --git a/doc/Figures/tick.png b/doc/Figures/tick.png new file mode 100644 index 0000000000000000000000000000000000000000..1175c8021717199329a79061bbf1e02c49f677fc GIT binary patch literal 175 zcmeAS@N?(olHy`uVBq!ia0vp@K+MO&3?$hCyB`86tpJ}8*Z=?j1DW&Y%?k(!NJ>g_ zaBwIoDcQDd8xIeUl9Cb&3rkm5*O@bCo;`ae#qL%PRO;aA;uyklJvo7aQH|B$Xadv1 z2w{a1iIyb8h6|zsT?;v#4E-4`_ . The following figure gives a summary of most of them: +Many kernels are already implemented in GPy. A comprehensive list can be found `here `_ and the following figure gives a summary of most of them: .. figure:: Figures/tuto_kern_overview_allkern.png :align: center