mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-04-27 22:06:22 +02:00
[plotting] still testing the testing
This commit is contained in:
parent
1376113405
commit
0116b03f3c
7 changed files with 32 additions and 28 deletions
|
|
@ -28,16 +28,18 @@ from .core.parameterization import Param, Parameterized, ObsAr, transformations
|
||||||
from .__version__ import __version__
|
from .__version__ import __version__
|
||||||
|
|
||||||
from numpy.testing import Tester
|
from numpy.testing import Tester
|
||||||
#@nottest
|
|
||||||
try:
|
with warnings.catch_warnings():
|
||||||
#Get rid of nose dependency by only ignoring if you have nose installed
|
warnings.simplefilter('ignore')
|
||||||
from nose.tools import nottest
|
try:
|
||||||
@nottest
|
#Get rid of nose dependency by only ignoring if you have nose installed
|
||||||
def tests(verbose=10):
|
from nose.tools import nottest
|
||||||
Tester(testing).test(verbose=verbose)
|
@nottest
|
||||||
except:
|
def tests(verbose=10):
|
||||||
def tests(verbose=10):
|
Tester(testing).test(verbose=verbose)
|
||||||
Tester(testing).test(verbose=verbose)
|
except:
|
||||||
|
def tests(verbose=10):
|
||||||
|
Tester(testing).test(verbose=verbose)
|
||||||
|
|
||||||
def load(file_or_path):
|
def load(file_or_path):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class VarDTC(LatentFunctionInference):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
const_jitter = 1e-8
|
const_jitter = 1e-8
|
||||||
def __init__(self, limit=3):
|
def __init__(self, limit=1):
|
||||||
from paramz.caching import Cacher
|
from paramz.caching import Cacher
|
||||||
self.limit = limit
|
self.limit = limit
|
||||||
self.get_trYYT = Cacher(self._get_trYYT, limit)
|
self.get_trYYT = Cacher(self._get_trYYT, limit)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class SparseGPRegression(SparseGP_MPI):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, X, Y, kernel=None, Z=None, num_inducing=10, X_variance=None, normalizer=None, mpi_comm=None):
|
def __init__(self, X, Y, kernel=None, Z=None, num_inducing=10, X_variance=None, normalizer=None, mpi_comm=None, name='sparse_gp'):
|
||||||
num_data, input_dim = X.shape
|
num_data, input_dim = X.shape
|
||||||
|
|
||||||
# kern defaults to rbf (plus white for stability)
|
# kern defaults to rbf (plus white for stability)
|
||||||
|
|
@ -55,7 +55,7 @@ class SparseGPRegression(SparseGP_MPI):
|
||||||
else:
|
else:
|
||||||
infr = VarDTC()
|
infr = VarDTC()
|
||||||
|
|
||||||
SparseGP_MPI.__init__(self, X, Y, Z, kernel, likelihood, inference_method=infr, normalizer=normalizer, mpi_comm=mpi_comm)
|
SparseGP_MPI.__init__(self, X, Y, Z, kernel, likelihood, inference_method=infr, normalizer=normalizer, mpi_comm=mpi_comm, name=name)
|
||||||
|
|
||||||
def parameters_changed(self):
|
def parameters_changed(self):
|
||||||
from ..inference.latent_function_inference.var_dtc_parallel import update_gradients_sparsegp,VarDTC_minibatch
|
from ..inference.latent_function_inference.var_dtc_parallel import update_gradients_sparsegp,VarDTC_minibatch
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,21 @@
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Copyright (c) 2015, Max Zwiessele
|
# Copyright (c) 2015, Max Zwiessele
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
# modification, are permitted provided that the following conditions are met:
|
# modification, are permitted provided that the following conditions are met:
|
||||||
#
|
#
|
||||||
# * Redistributions of source code must retain the above copyright notice, this
|
# * Redistributions of source code must retain the above copyright notice, this
|
||||||
# list of conditions and the following disclaimer.
|
# list of conditions and the following disclaimer.
|
||||||
#
|
#
|
||||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
# this list of conditions and the following disclaimer in the documentation
|
# this list of conditions and the following disclaimer in the documentation
|
||||||
# and/or other materials provided with the distribution.
|
# and/or other materials provided with the distribution.
|
||||||
#
|
#
|
||||||
# * Neither the name of GPy nor the names of its
|
# * Neither the name of GPy nor the names of its
|
||||||
# contributors may be used to endorse or promote products derived from
|
# contributors may be used to endorse or promote products derived from
|
||||||
# this software without specific prior written permission.
|
# this software without specific prior written permission.
|
||||||
#
|
#
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
|
@ -34,16 +34,16 @@ from .. import Tango
|
||||||
'''
|
'''
|
||||||
This file is for defaults for the gpy plot, specific to the plotting library.
|
This file is for defaults for the gpy plot, specific to the plotting library.
|
||||||
|
|
||||||
Create a kwargs dictionary with the right name for the plotting function
|
Create a kwargs dictionary with the right name for the plotting function
|
||||||
you are implementing. If you do not provide defaults, the default behaviour of
|
you are implementing. If you do not provide defaults, the default behaviour of
|
||||||
the plotting library will be used.
|
the plotting library will be used.
|
||||||
|
|
||||||
In the code, always ise plotting.gpy_plots.defaults to get the defaults, as
|
In the code, always ise plotting.gpy_plots.defaults to get the defaults, as
|
||||||
it gives back an empty default, when defaults are not defined.
|
it gives back an empty default, when defaults are not defined.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# Data plots:
|
# Data plots:
|
||||||
data_1d = dict(lw=1.5, marker='x', edgecolor='k')
|
data_1d = dict(lw=1.5, marker='x', color='k')
|
||||||
data_2d = dict(s=35, edgecolors='none', linewidth=0., cmap=cm.get_cmap('hot'), alpha=.5)
|
data_2d = dict(s=35, edgecolors='none', linewidth=0., cmap=cm.get_cmap('hot'), alpha=.5)
|
||||||
inducing_1d = dict(lw=0, s=500, facecolors=Tango.colorsHex['darkRed'])
|
inducing_1d = dict(lw=0, s=500, facecolors=Tango.colorsHex['darkRed'])
|
||||||
inducing_2d = dict(s=14, edgecolors='k', linewidth=.4, facecolors='white', alpha=.5, marker='^')
|
inducing_2d = dict(s=14, edgecolors='k', linewidth=.4, facecolors='white', alpha=.5, marker='^')
|
||||||
|
|
|
||||||
|
|
@ -394,7 +394,7 @@ class KernelTestsNonContinuous(unittest.TestCase):
|
||||||
self.X2[:(N0*2), -1] = 0
|
self.X2[:(N0*2), -1] = 0
|
||||||
self.X2[(N0*2):, -1] = 1
|
self.X2[(N0*2):, -1] = 1
|
||||||
|
|
||||||
@unittest.expectedFailure
|
#@unittest.expectedFailure
|
||||||
def test_IndependentOutputs(self):
|
def test_IndependentOutputs(self):
|
||||||
k = GPy.kern.RBF(self.D, active_dims=range(self.D))
|
k = GPy.kern.RBF(self.D, active_dims=range(self.D))
|
||||||
kern = GPy.kern.IndependentOutputs(k, -1, 'ind_single')
|
kern = GPy.kern.IndependentOutputs(k, -1, 'ind_single')
|
||||||
|
|
@ -403,7 +403,7 @@ class KernelTestsNonContinuous(unittest.TestCase):
|
||||||
kern = GPy.kern.IndependentOutputs(k, -1, name='ind_split')
|
kern = GPy.kern.IndependentOutputs(k, -1, name='ind_split')
|
||||||
self.assertTrue(check_kernel_gradient_functions(kern, X=self.X, X2=self.X2, verbose=verbose, fixed_X_dims=-1))
|
self.assertTrue(check_kernel_gradient_functions(kern, X=self.X, X2=self.X2, verbose=verbose, fixed_X_dims=-1))
|
||||||
|
|
||||||
@unittest.expectedFailure
|
#@unittest.expectedFailure
|
||||||
def test_Hierarchical(self):
|
def test_Hierarchical(self):
|
||||||
k = [GPy.kern.RBF(2, active_dims=[0,2], name='rbf1'), GPy.kern.RBF(2, active_dims=[0,2], name='rbf2')]
|
k = [GPy.kern.RBF(2, active_dims=[0,2], name='rbf1'), GPy.kern.RBF(2, active_dims=[0,2], name='rbf2')]
|
||||||
kern = GPy.kern.IndependentOutputs(k, -1, name='ind_split')
|
kern = GPy.kern.IndependentOutputs(k, -1, name='ind_split')
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# SKIPPING PLOTTING BECAUSE IT BEHAVES DIFFERENTLY ON DIFFERENT
|
# SKIPPING PLOTTING BECAUSE IT BEHAVES DIFFERENTLY ON DIFFERENT
|
||||||
# SYSTEMS, AND WILL MISBEHAVE
|
# SYSTEMS, AND WILL MISBEHAVE
|
||||||
#from nose import SkipTest
|
from nose import SkipTest
|
||||||
#raise SkipTest("Skipping Matplotlib testing")
|
raise SkipTest("Skipping Matplotlib testing")
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@
|
||||||
import matplotlib
|
import matplotlib
|
||||||
matplotlib.use('agg')
|
matplotlib.use('agg')
|
||||||
|
|
||||||
import nose
|
import nose, warnings
|
||||||
nose.main('GPy', defaultTest='GPy/testing/')
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("ignore")
|
||||||
|
nose.main('GPy', defaultTest='GPy/testing/')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue