diff --git a/.travis.yml b/.travis.yml index a7ab1bb9..87c21154 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,6 +39,10 @@ script: after_success: - codecov + - conda install sphinx + - cd doc + - make html + - cd ../ deploy: provider: pypi @@ -48,4 +52,4 @@ deploy: on: plot_density server: https://testpypi.python.org/pypi - distributions: "bdist_wheel sdist" \ No newline at end of file + distributions: "bdist_wheel sdist" diff --git a/GPy/__init__.py b/GPy/__init__.py index 5bbdeff8..5af56dc4 100644 --- a/GPy/__init__.py +++ b/GPy/__init__.py @@ -43,6 +43,20 @@ def load(file_or_path): :param file_name: path/to/file.pickle """ try: + unicode = unicode + except NameError: + # 'unicode' is undefined, must be Python 3 + str = str + unicode = str + bytes = bytes + basestring = (str,bytes) + else: + # 'unicode' exists, must be Python 2 + str = str + unicode = unicode + bytes = str + basestring = basestring + try: import cPickle as pickle if isinstance(file_or_path, basestring): with open(file_or_path, 'rb') as f: diff --git a/GPy/testing/model_tests.py b/GPy/testing/model_tests.py index d7339dd0..a2ba1575 100644 --- a/GPy/testing/model_tests.py +++ b/GPy/testing/model_tests.py @@ -48,7 +48,7 @@ class MiscTests(unittest.TestCase): Y = self.Y mu, std = Y.mean(0), Y.std(0) m = GPy.models.GPRegression(self.X, Y, kernel=k, normalizer=True) - m.optimize() + m.optimize(messages=True) assert(m.checkgrad()) k = GPy.kern.RBF(1) m2 = GPy.models.GPRegression(self.X, (Y-mu)/std, kernel=k, normalizer=False) diff --git a/GPy/testing/pickle_tests.py b/GPy/testing/pickle_tests.py index 64357b39..ec9ea3c3 100644 --- a/GPy/testing/pickle_tests.py +++ b/GPy/testing/pickle_tests.py @@ -21,6 +21,7 @@ from GPy.core.parameterization.variational import NormalPosterior from GPy.models.gp_regression import GPRegression from functools import reduce from GPy.util.caching import Cacher +import GPy from pickle import PicklingError def toy_model(): @@ -60,13 +61,15 @@ class Test(ListDictTestCase): pio2 = pickle.load(f) self.assertListDictEquals(pio._properties, pio2._properties) - with tempfile.TemporaryFile('w+b') as f: - pickle.dump(piov, f) - f.seek(0) - pio2 = pickle.load(f) - #py3 fix - #self.assertListDictEquals(dict(piov.items()), dict(pio2.iteritems())) - self.assertListDictEquals(dict(piov.items()), dict(pio2.items())) + f = tempfile.TemporaryFile('w+b') + pickle.dump(piov, f) + f.seek(0) + pio2 = GPy.load(f) + f.close() + + #py3 fix + #self.assertListDictEquals(dict(piov.items()), dict(pio2.iteritems())) + self.assertListDictEquals(dict(piov.items()), dict(pio2.items())) def test_param(self): param = Param('test', np.arange(4*2).reshape(4,2)) diff --git a/GPy/testing/plotting_tests.py b/GPy/testing/plotting_tests.py index 28eb5c8d..e60928a7 100644 --- a/GPy/testing/plotting_tests.py +++ b/GPy/testing/plotting_tests.py @@ -101,7 +101,9 @@ def test_kernel(): matplotlib.rcParams[u'text.usetex'] = False k = GPy.kern.RBF(5, ARD=True) + GPy.kern.Linear(3, active_dims=[0,2,4], ARD=True) + GPy.kern.Bias(2) k.randomize() - k.plot_ARD(legend=True) + k2 = GPy.kern.RBF(5, ARD=True) + GPy.kern.Linear(3, active_dims=[0,2,4], ARD=True) + GPy.kern.Bias(2) + GPy.kern.White(4) + k2[:-1] = k[:] + k2.plot_ARD([k2.white.name], legend=True) for do_test in _image_comparison( baseline_images=['kern_{}'.format(sub) for sub in ["ARD",]], extensions=extensions): diff --git a/setup.cfg b/setup.cfg index d63e9b71..b9b4452f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,10 +8,5 @@ commit = True [bdist_wheel] universal = 1 -[build_sphinx] -source-dir = doc/source -build-dir = doc/build -all_files = 1 - -[upload_sphinx] +[upload_docs] upload-dir = doc/build/html \ No newline at end of file diff --git a/setup.py b/setup.py index 0e08f8bc..74ac7ecb 100644 --- a/setup.py +++ b/setup.py @@ -145,7 +145,10 @@ setup(name = 'GPy', 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX :: Linux', 'Programming Language :: Python :: 2.7', - 'Topic :: Scientific/Engineering :: Artificial Intelligence'] + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + ] )