GPy.testing package

Submodules

GPy.testing.examples_tests module

class GPy.testing.examples_tests.ExamplesTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

GPy.testing.examples_tests.flatten_nested(lst)[source]
GPy.testing.examples_tests.model_checkgrads(model)[source]
GPy.testing.examples_tests.model_instance(model)[source]
GPy.testing.examples_tests.test_models()[source]

GPy.testing.fitc module

class GPy.testing.fitc.FITCtest(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_fitc_1d()[source]
test_fitc_2d()[source]

GPy.testing.index_operations_tests module

class GPy.testing.index_operations_tests.Test(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_clear()[source]
test_index_view()[source]
test_indexview_remove()[source]
test_misc()[source]
test_print()[source]
test_remove()[source]
test_shift_left()[source]
test_shift_right()[source]
test_view_of_view()[source]

GPy.testing.inference_tests module

The test cases for various inference algorithms

class GPy.testing.inference_tests.InferenceXTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

genData()[source]
test_inferenceX_BGPLVM()[source]
test_inferenceX_GPLVM()[source]

GPy.testing.kernel_tests module

class GPy.testing.kernel_tests.Coregionalize_weave_test(methodName='runTest')[source]

Bases: unittest.case.TestCase

Make sure that the coregionalize kernel work with and without weave enabled

setUp()[source]
test_nonsym()[source]
test_sym()[source]
class GPy.testing.kernel_tests.Kern_check_dK_dX(kernel=None, dL_dK=None, X=None, X2=None)[source]

Bases: GPy.testing.kernel_tests.Kern_check_model

This class allows gradient checks for the gradient of a kernel with respect to X.

parameters_changed()[source]
class GPy.testing.kernel_tests.Kern_check_dK_dtheta(kernel=None, dL_dK=None, X=None, X2=None)[source]

Bases: GPy.testing.kernel_tests.Kern_check_model

This class allows gradient checks for the gradient of a kernel with respect to parameters.

parameters_changed()[source]
class GPy.testing.kernel_tests.Kern_check_dKdiag_dX(kernel=None, dL_dK=None, X=None, X2=None)[source]

Bases: GPy.testing.kernel_tests.Kern_check_dK_dX

This class allows gradient checks for the gradient of a kernel diagonal with respect to X.

log_likelihood()[source]
parameters_changed()[source]
class GPy.testing.kernel_tests.Kern_check_dKdiag_dtheta(kernel=None, dL_dK=None, X=None)[source]

Bases: GPy.testing.kernel_tests.Kern_check_model

This class allows gradient checks of the gradient of the diagonal of a kernel with respect to the parameters.

log_likelihood()[source]
parameters_changed()[source]
class GPy.testing.kernel_tests.Kern_check_model(kernel=None, dL_dK=None, X=None, X2=None)[source]

Bases: GPy.core.model.Model

This is a dummy model class used as a base class for checking that the gradients of a given kernel are implemented correctly. It enables checkgrad() to be called independently on a kernel.

is_positive_semi_definite()[source]
log_likelihood()[source]
class GPy.testing.kernel_tests.KernelGradientTestsContinuous(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_Add()[source]
test_Add_dims()[source]
test_Linear()[source]
test_LinearFull()[source]
test_Matern32()[source]
test_Matern52()[source]
test_Prod()[source]
test_Prod2()[source]
test_Prod3()[source]
test_RBF()[source]
class GPy.testing.kernel_tests.KernelTestsMiscellaneous(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_which_parts()[source]
class GPy.testing.kernel_tests.KernelTestsNonContinuous(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_Hierarchical()[source]
test_IndependentOutputs()[source]
test_ODE_UY()[source]
GPy.testing.kernel_tests.check_kernel_gradient_functions(kern, X=None, X2=None, output_ind=None, verbose=False, fixed_X_dims=None)[source]

This function runs on kernels to check the correctness of their implementation. It checks that the covariance function is positive definite for a randomly generated data set.

Parameters:
  • kern (GPy.kern.Kernpart) – the kernel to be tested.
  • X (ndarray) – X input values to test the covariance function.
  • X2 (ndarray) – X2 input values to test the covariance function.

GPy.testing.likelihood_tests module

class GPy.testing.likelihood_tests.LaplaceTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

Specific likelihood tests, not general enough for the above tests

setUp()[source]
tearDown()[source]
test_gaussian_d2logpdf_df2_2()[source]
test_laplace_log_likelihood()[source]
class GPy.testing.likelihood_tests.TestNoiseModels[source]

Bases: object

Generic model checker

setUp()[source]
t_d2logpdf2_df2_dparams(model, Y, f, params, params_names, param_constraints)[source]
t_d2logpdf2_dlink2_dparams(model, Y, f, params, param_names, param_constraints)[source]
t_d2logpdf_df2(model, Y, f)[source]
t_d2logpdf_dlink2(model, Y, f, link_f_constraints)[source]
t_d3logpdf_df3(model, Y, f)[source]
t_d3logpdf_dlink3(model, Y, f, link_f_constraints)[source]
t_dlogpdf_df(model, Y, f)[source]
t_dlogpdf_df_dparams(model, Y, f, params, params_names, param_constraints)[source]
t_dlogpdf_dparams(model, Y, f, params, params_names, param_constraints)[source]
t_ep_fit_rbf_white(model, X, Y, f, step, param_vals, param_names, constraints)[source]
t_laplace_fit_rbf_white(model, X, Y, f, step, param_vals, param_names, constraints)[source]
t_logpdf(model, Y, f)[source]
tearDown()[source]
test_scale2_models()[source]
GPy.testing.likelihood_tests.dparam_checkgrad(func, dfunc, params, params_names, args, constraints=None, randomize=False, verbose=False)[source]

checkgrad expects a f: R^N -> R^1 and df: R^N -> R^N However if we are holding other parameters fixed and moving something else We need to check the gradient of each of the fixed parameters (f and y for example) seperately, whilst moving another parameter. Otherwise f: gives back R^N and

df: gives back R^NxM where M is

The number of parameters and N is the number of data Need to take a slice out from f and a slice out of df

GPy.testing.likelihood_tests.dparam_partial(inst_func, *args)[source]

If we have a instance method that needs to be called but that doesn’t take the parameter we wish to change to checkgrad, then this function will change the variable using set params.

inst_func: should be a instance function of an object that we would like
to change

param: the param that will be given to set_params args: anything else that needs to be given to the function (for example

the f or Y that are being used in the function whilst we tweak the param

GPy.testing.model_tests module

class GPy.testing.model_tests.GradientTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

check_model(kern, model_type='GPRegression', dimension=1, uncertain_inputs=False)[source]
setUp()[source]
test_GPLVM_rbf_bias_white_kern_2D()[source]

Testing GPLVM with rbf + bias kernel

test_GPLVM_rbf_linear_white_kern_2D()[source]

Testing GPLVM with rbf + bias kernel

test_GPRegression_bias_kern_1D()[source]

Testing the GP regression with bias kernel on 1d data

test_GPRegression_bias_kern_2D()[source]

Testing the GP regression with bias kernel on 2d data

test_GPRegression_exponential_1D()[source]

Testing the GP regression with exponential kernel on 1d data

test_GPRegression_exponential_2D()[source]

Testing the GP regression with exponential kernel on 2d data

test_GPRegression_exponential_ARD_2D()[source]

Testing the GP regression with exponential kernel on 2d data

test_GPRegression_linear_kern_1D()[source]

Testing the GP regression with linear kernel on 1d data

test_GPRegression_linear_kern_1D_ARD()[source]

Testing the GP regression with linear kernel on 1d data

test_GPRegression_linear_kern_2D()[source]

Testing the GP regression with linear kernel on 2d data

test_GPRegression_linear_kern_2D_ARD()[source]

Testing the GP regression with linear kernel on 2d data

test_GPRegression_matern32_1D()[source]

Testing the GP regression with matern32 kernel on 1d data

test_GPRegression_matern32_2D()[source]

Testing the GP regression with matern32 kernel on 2d data

test_GPRegression_matern32_ARD_2D()[source]

Testing the GP regression with matern32 kernel on 2d data

test_GPRegression_matern52_1D()[source]

Testing the GP regression with matern52 kernel on 1d data

test_GPRegression_matern52_2D()[source]

Testing the GP regression with matern52 kernel on 2d data

test_GPRegression_matern52_ARD_2D()[source]

Testing the GP regression with matern52 kernel on 2d data

test_GPRegression_mlp_1d()[source]

Testing the GP regression with mlp kernel with white kernel on 1d data

test_GPRegression_rbf_1d()[source]

Testing the GP regression with rbf kernel with white kernel on 1d data

test_GPRegression_rbf_2D()[source]

Testing the GP regression with rbf kernel on 2d data

test_GPRegression_rbf_ARD_2D()[source]

Testing the GP regression with rbf kernel on 2d data

test_GP_EP_probit()[source]
test_SparseGPRegression_rbf_linear_white_kern_1D()[source]

Testing the sparse GP regression with rbf kernel on 2d data

test_SparseGPRegression_rbf_linear_white_kern_1D_uncertain_inputs()[source]

Testing the sparse GP regression with rbf, linear kernel on 1d data with uncertain inputs

test_SparseGPRegression_rbf_linear_white_kern_2D()[source]

Testing the sparse GP regression with rbf kernel on 2d data

test_SparseGPRegression_rbf_linear_white_kern_2D_uncertain_inputs()[source]

Testing the sparse GP regression with rbf, linear kernel on 2d data with uncertain inputs

test_SparseGPRegression_rbf_white_kern_1d()[source]

Testing the sparse GP regression with rbf kernel with white kernel on 1d data

test_SparseGPRegression_rbf_white_kern_2D()[source]

Testing the sparse GP regression with rbf kernel on 2d data

test_generalized_FITC(*args, **kwargs)[source]
test_gp_VGPC()[source]
test_gp_heteroscedastic_regression()[source]
test_gp_kronecker_gaussian()[source]
test_multioutput_regression_1D(*args, **kwargs)[source]
test_multioutput_sparse_regression_1D(*args, **kwargs)[source]
test_sparse_EP_DTC_probit()[source]
test_sparse_gp_heteroscedastic_regression()[source]
class GPy.testing.model_tests.MiscTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_big_model()[source]
test_likelihood_replicate()[source]
test_likelihood_replicate_kern()[source]
test_likelihood_set()[source]
test_missing_data()[source]
test_model_optimize()[source]
test_model_set_params()[source]
test_raw_predict()[source]
test_sparse_raw_predict()[source]

GPy.testing.observable_tests module

class GPy.testing.observable_tests.ParamTestParent(name=None, parameters=[], *a, **kw)[source]

Bases: GPy.core.parameterization.parameterized.Parameterized

parameters_changed()[source]
parent_changed_count = -1
class GPy.testing.observable_tests.ParameterizedTest(name=None, parameters=[], *a, **kw)[source]

Bases: GPy.core.parameterization.parameterized.Parameterized

parameters_changed()[source]
params_changed_count = -1
class GPy.testing.observable_tests.Test(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_observable()[source]
test_priority()[source]
test_priority_notify()[source]
test_set_params()[source]

GPy.testing.parameterized_tests module

Created on Feb 13, 2014

@author: maxzwiessele

class GPy.testing.parameterized_tests.ArrayCoreTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_init()[source]
test_slice()[source]
class GPy.testing.parameterized_tests.ParameterizedTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_add_parameter()[source]
test_add_parameter_already_in_hirarchy()[source]
test_add_parameter_in_hierarchy()[source]
test_constraints()[source]
test_constraints_in_init()[source]
test_constraints_views()[source]
test_default_constraints()[source]
test_fix_unfix()[source]
test_fixes()[source]
test_fixing_optimize()[source]
test_fixing_randomize()[source]
test_fixing_randomize_parameter_handling()[source]
test_parameter_modify_in_init()[source]
test_printing()[source]
test_randomize()[source]
test_regular_expression_misc()[source]
test_remove_parameter()[source]
test_remove_parameter_param_array_grad_array()[source]
test_updates()[source]

GPy.testing.pickle_tests module

Created on 13 Mar 2014

@author: maxz

class GPy.testing.pickle_tests.ListDictTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

assertArrayListEquals(l1, l2)[source]
assertListDictEquals(d1, d2, msg=None)[source]
class GPy.testing.pickle_tests.Test(methodName='runTest')[source]

Bases: GPy.testing.pickle_tests.ListDictTestCase

test_add_observer(test_item)
test_model()[source]
test_model_concat()[source]
test_modelrecreation()[source]
test_observable_array()[source]
test_param()[source]
test_parameter_index_operations()[source]
test_parameterized()[source]
test_posterior()[source]
GPy.testing.pickle_tests.toy_model()[source]

GPy.testing.prior_tests module

class GPy.testing.prior_tests.PriorTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_Gamma()[source]
test_fixed_domain_check()[source]
test_fixed_domain_check1()[source]
test_incompatibility()[source]
test_lognormal()[source]
test_set_gaussian_for_reals()[source]
test_set_prior()[source]

Module contents

MaxZ

GPy.testing.deepTest(reason)[source]