diff --git a/.travis.yml b/.travis.yml index 1f796285..fa34fd51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,4 +23,4 @@ install: - pip install . --use-mirrors # command to run tests, e.g. python setup.py test script: - - nosetests GPy/testing + - yes | nosetests GPy/testing diff --git a/GPy/core/sparse_gp.py b/GPy/core/sparse_gp.py index 5e381110..43af97aa 100644 --- a/GPy/core/sparse_gp.py +++ b/GPy/core/sparse_gp.py @@ -381,7 +381,7 @@ class SparseGP(GPBase): which_data_ycols='all', which_parts='all', fixed_inputs=[], plot_raw=False, levels=20, samples=0, fignum=None, ax=None, resolution=None): - """ + """ Plot the posterior of the sparse GP. - In one dimension, the function is plotted with a shaded region identifying two standard deviations. - In two dimsensions, a contour-plot shows the mean predicted function @@ -417,6 +417,11 @@ class SparseGP(GPBase): :param levels: for 2D plotting, the number of contour levels to use is ax is None, create a new figure """ #deal work out which ax to plot on + #Need these because we use which_data_rows in this function not just base + if which_data_rows == 'all': + which_data_rows = slice(None) + if which_data_ycols == 'all': + which_data_ycols = np.arange(self.output_dim) if ax is None: fig = pb.figure(num=fignum) ax = fig.add_subplot(111) diff --git a/GPy/examples/regression.py b/GPy/examples/regression.py index 9b910005..65a50f0e 100644 --- a/GPy/examples/regression.py +++ b/GPy/examples/regression.py @@ -273,27 +273,6 @@ def toy_rbf_1d_50(optimize=True, plot=True): return m - -def toy_poisson_rbf_1d(optimize=True, plot=True): - """Run a simple demonstration of a standard Gaussian process fitting it to data sampled from an RBF covariance.""" - x_len = 400 - X = np.linspace(0, 10, x_len)[:, None] - f_true = np.random.multivariate_normal(np.zeros(x_len), GPy.kern.rbf(1).K(X)) - Y = np.array([np.random.poisson(np.exp(f)) for f in f_true]).reshape(x_len,1) - - noise_model = GPy.likelihoods.poisson() - likelihood = GPy.likelihoods.EP(Y,noise_model) - - # create simple GP Model - m = GPy.models.GPRegression(X, Y, likelihood=likelihood) - - if optimize: - m.optimize('bfgs') - if plot: - m.plot() - - return m - def toy_poisson_rbf_1d_laplace(optimize=True, plot=True): """Run a simple demonstration of a standard Gaussian process fitting it to data sampled from an RBF covariance.""" optimizer='scg' diff --git a/GPy/testing/examples_tests.py b/GPy/testing/examples_tests.py index 9998590a..c468a0b0 100644 --- a/GPy/testing/examples_tests.py +++ b/GPy/testing/examples_tests.py @@ -19,25 +19,12 @@ class ExamplesTests(unittest.TestCase): def _model_instance(self, Model): self.assertTrue(isinstance(Model, GPy.models)) -""" -def model_instance_generator(model): - def check_model_returned(self): - self._model_instance(model) - return check_model_returned - -def checkgrads_generator(model): - def model_checkgrads(self): - self._checkgrad(model) - return model_checkgrads -""" - def model_checkgrads(model): model.randomize() - #assert model.checkgrad() - return model.checkgrad() + #NOTE: Step as 1e-4, this should be acceptable for more peaky models + return model.checkgrad(step=1e-4) def model_instance(model): - #assert isinstance(model, GPy.core.model) return isinstance(model, GPy.core.model.Model) def flatten_nested(lst): @@ -66,9 +53,11 @@ def test_models(): print "After" print functions for example in functions: - #if example[0] in ['oil', 'silhouette', 'GPLVM_oil_100', 'brendan_faces']: - #print "SKIPPING" - #continue + if example[0] in ['epomeo_gpx']: + #These are the edge cases that we might want to handle specially + if example[0] == 'epomeo_gpx' and not GPy.util.datasets.gpxpy_available: + print "Skipping as gpxpy is not available to parse GPS" + continue print "Testing example: ", example[0] # Generate model diff --git a/GPy/util/data_resources.json b/GPy/util/data_resources.json index d86d9088..c999b796 100644 --- a/GPy/util/data_resources.json +++ b/GPy/util/data_resources.json @@ -29,7 +29,8 @@ "urls":[ "http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/ankur_pose_data/" ], - "details":"Artificially generated data of silhouettes given poses. Note that the data does not display a left/right ambiguity because across the entire data set one of the arms sticks out more the the other, disambiguating the pose as to which way the individual is facing." + "details":"Artificially generated data of silhouettes given poses. Note that the data does not display a left/right ambiguity because across the entire data set one of the arms sticks out more the the other, disambiguating the pose as to which way the individual is facing.", + "size":1 }, "osu_accad":{ "files":[ @@ -316,4 +317,4 @@ ], "size":2031872 } -} \ No newline at end of file +} diff --git a/GPy/util/datasets.py b/GPy/util/datasets.py index 7fd1b6c5..cef4a30e 100644 --- a/GPy/util/datasets.py +++ b/GPy/util/datasets.py @@ -26,7 +26,7 @@ def reporthook(a,b,c): # Global variables data_path = os.path.join(os.path.dirname(__file__), 'datasets') default_seed = 10000 -overide_manual_authorize=False +overide_manual_authorize=True neil_url = 'http://staffwww.dcs.shef.ac.uk/people/N.Lawrence/dataset_mirror/' # Read data resources from json file. @@ -94,7 +94,7 @@ def download_url(url, store_directory, save_name = None, messages = True, suffix # if we wanted to get more sophisticated maybe we should check the response code here again even for successes. with open(save_name, 'wb') as f: f.write(response.read()) - + #urllib.urlretrieve(url+suffix, save_name, reporthook) def authorize_download(dataset_name=None):