GPy.testing package

deepTest(reason)[source]

Submodules

GPy.testing.cython_tests module

class CythonTestChols(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_flat_to_triang()[source]
test_triang_to_flat()[source]
class test_choleskies_backprop(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test()[source]
class test_stationary(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_rect_gradx()[source]
test_rect_lengthscales()[source]
test_square_gradX()[source]
test_square_lengthscales()[source]

GPy.testing.ep_likelihood_tests module

class TestObservationModels(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

rmse(Y, Ystar)[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

testEPClassification()[source]
test_EP_with_StudentT()[source]

GPy.testing.examples_tests module

class ExamplesTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

flatten_nested(lst)[source]
model_checkgrads(model)[source]
model_instance(model)[source]
test_models()[source]

GPy.testing.fitc module

class FITCtest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

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

GPy.testing.gp_tests module

Created on 4 Sep 2015

@author: maxz

class Test(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_mean_function()[source]
test_setxy_bgplvm()[source]
test_setxy_gp()[source]
test_setxy_gplvm()[source]

GPy.testing.gpy_kernels_state_space_tests module

Testing state space related functions.

class StateSpaceKernelsTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

run_for_model(X, Y, ss_kernel, kalman_filter_type='regular', use_cython=False, check_gradients=True, optimize=True, optimize_max_iters=250, predict_X=None, compare_with_GP=True, gp_kernel=None, mean_compare_decimal=10, var_compare_decimal=7)[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_Matern32_kernel()[source]
test_Matern52_kernel()[source]
test_RBF_kernel()[source]
test_brownian_kernel()[source]
test_exponential_kernel()[source]
test_forecast_regular()[source]
test_forecast_svd()[source]
test_forecast_svd_cython()[source]
test_kernel_addition_regular()[source]
test_kernel_addition_svd()[source]
test_kernel_multiplication()[source]
test_linear_kernel()[source]
test_periodic_kernel()[source]
test_quasi_periodic_kernel()[source]

GPy.testing.grid_tests module

class GridModelTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_alpha_match()[source]
test_gradient_match()[source]
test_prediction_match()[source]

GPy.testing.inference_tests module

The test cases for various inference algorithms

class HMCSamplerTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_sampling()[source]
class InferenceGPEP(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

genData()[source]
genNoisyData()[source]
test_inference_EP()[source]
test_inference_EP_non_classification()[source]
class InferenceXTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

genData()[source]
test_inferenceX_BGPLVM_Linear()[source]
test_inferenceX_BGPLVM_RBF()[source]
test_inferenceX_GPLVM_Linear()[source]
test_inferenceX_GPLVM_RBF()[source]
class MCMCSamplerTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_sampling()[source]
class VarDtcTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_var_dtc_inference_with_mean()[source]

Check dL_dm in var_dtc is calculated correctly

GPy.testing.kernel_tests module

class Coregionalize_cython_test(methodName='runTest')[source]

Bases: unittest.case.TestCase

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

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_nonsym()[source]
test_sym()[source]
class Kern_check_d2K_dXdX(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 secondderivative of a kernel with respect to X.

log_likelihood()[source]
parameters_changed()[source]

This method gets called when parameters have changed. Another way of listening to param changes is to add self as a listener to the param, such that updates get passed through. See :py:function:paramz.param.Observable.add_observer

class Kern_check_d2Kdiag_dXdX(kernel=None, dL_dK=None, X=None)[source]

Bases: GPy.testing.kernel_tests.Kern_check_model

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

log_likelihood()[source]
parameters_changed()[source]

This method gets called when parameters have changed. Another way of listening to param changes is to add self as a listener to the param, such that updates get passed through. See :py:function:paramz.param.Observable.add_observer

class 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]

This method gets called when parameters have changed. Another way of listening to param changes is to add self as a listener to the param, such that updates get passed through. See :py:function:paramz.param.Observable.add_observer

class 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]

This method gets called when parameters have changed. Another way of listening to param changes is to add self as a listener to the param, such that updates get passed through. See :py:function:paramz.param.Observable.add_observer

class 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]

This method gets called when parameters have changed. Another way of listening to param changes is to add self as a listener to the param, such that updates get passed through. See :py:function:paramz.param.Observable.add_observer

class 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]

This method gets called when parameters have changed. Another way of listening to param changes is to add self as a listener to the param, such that updates get passed through. See :py:function:paramz.param.Observable.add_observer

class 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 KernelGradientTestsContinuous(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_Add()[source]
test_Add_dims()[source]
test_Cosine()[source]
test_ExpQuad()[source]
test_ExpQuadCosine()[source]
test_Fixed()[source]
test_Linear()[source]
test_LinearFull()[source]
test_MLP()[source]
test_Matern32()[source]
test_Matern52()[source]
test_MultioutputKern()[source]
test_OU()[source]
test_Poly()[source]
test_Precomputed()[source]
test_Prod()[source]
test_Prod1()[source]
test_Prod2()[source]
test_Prod3()[source]
test_Prod4()[source]
test_RBF()[source]
test_RatQuad()[source]
test_Sinc()[source]
test_WhiteHeteroscedastic()[source]
test_basis_func_changepoint()[source]
test_basis_func_domain()[source]
test_basis_func_linear_slope()[source]
test_basis_func_poly()[source]
test_integral()[source]
test_integral_limits()[source]
test_multidimensional_integral_limits()[source]
test_standard_periodic()[source]
test_symmetric_even()[source]
test_symmetric_odd()[source]
class KernelTestsMiscellaneous(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_active_dims()[source]
test_which_parts()[source]
class KernelTestsNonContinuous(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testIndependendGradients()[source]
test_Coregionalize()[source]
test_Hierarchical()[source]
test_Hierarchical_gradients()[source]
test_IndependentOutputs()[source]
test_ODE_UY()[source]
class KernelTestsProductWithZeroValues(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_zero_valued_kernel_full()[source]
test_zero_valued_kernel_gradients_X()[source]
class Kernel_Psi_statistics_GradientTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_kernels()[source]
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 LaplaceTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

Specific likelihood tests, not general enough for the above tests

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_gaussian_d2logpdf_df2_2()[source]
test_laplace_log_likelihood()[source]
class TestNoiseModels[source]

Bases: object

Generic model checker

constrain_bounded(regex, model, lower, upper)[source]

Used like: partial(constrain_bounded, lower=0, upper=1)

constrain_fixed(regex, model)[source]
constrain_fixed_above(regex, model, above)[source]
constrain_fixed_below(regex, model, up_to)[source]
constrain_negative(regex, model)[source]
constrain_positive(regex, model)[source]
setUp()[source]
t_d2logpdf2_df2_dparams(model, Y, f, Y_metadata, params, params_names, param_constraints)[source]
t_d2logpdf2_dlink2_dparams(model, Y, f, Y_metadata, params, param_names, param_constraints)[source]
t_d2logpdf_df2(model, Y, f, Y_metadata)[source]
t_d2logpdf_dlink2(model, Y, f, Y_metadata, link_f_constraints)[source]
t_d3logpdf_df3(model, Y, f, Y_metadata)[source]
t_d3logpdf_dlink3(model, Y, f, Y_metadata, link_f_constraints)[source]
t_dexp_dmu(model, Y, Y_metadata)[source]
t_dexp_dvar(model, Y, Y_metadata)[source]
t_dlogpdf_df(model, Y, f, Y_metadata)[source]
t_dlogpdf_df_dparams(model, Y, f, Y_metadata, params, params_names, param_constraints)[source]
t_dlogpdf_dparams(model, Y, f, Y_metadata, params, params_names, param_constraints)[source]
t_ep_fit_rbf_white(model, X, Y, f, Y_metadata, step, param_vals, param_names, constraints)[source]
t_laplace_fit_rbf_white(model, X, Y, f, Y_metadata, step, param_vals, param_names, constraints)[source]
t_logpdf(model, Y, f, Y_metadata)[source]
t_varexp(model, Y, Y_metadata)[source]
tearDown()[source]
test_scale2_models()[source]
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

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.linalg_test module

class LinalgTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_einsum_ij_jlk_to_ilk()[source]
test_einsum_ijk_ljk_to_ilk()[source]
test_jitchol_failure()[source]
test_jitchol_success()[source]

Expect 5 rounds of jitter to be added and for the recovered matrix to be identical to the corrupted matrix apart from the jitter added to the diagonal

test_trace_dot()[source]

GPy.testing.mapping_tests module

class MappingGradChecker(mapping, X, name='map_grad_check')[source]

Bases: GPy.core.model.Model

This class has everything we need to check the gradient of a mapping. It implement a simple likelihood which is a weighted sum of the outputs of the mapping. the gradients are checked against the parameters of the mapping and the input.

log_likelihood()[source]
parameters_changed()[source]

This method gets called when parameters have changed. Another way of listening to param changes is to add self as a listener to the param, such that updates get passed through. See :py:function:paramz.param.Observable.add_observer

class MappingTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_addmapping()[source]
test_compoundmapping()[source]
test_kernelmapping()[source]
test_linearmapping()[source]
test_mlpextmapping()[source]
test_mlpmapping()[source]

GPy.testing.meanfunc_tests module

class MFtests(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_parametric_mean_function()[source]

A linear mean function with parameters that we’ll learn alongside the kernel

test_parametric_mean_function_additive()[source]

A linear mean function with parameters that we’ll learn alongside the kernel

test_parametric_mean_function_composition()[source]

A linear mean function with parameters that we’ll learn alongside the kernel

test_simple_mean_function()[source]

The simplest possible mean function. No parameters, just a simple Sinusoid.

test_svgp_mean_function()[source]

GPy.testing.minibatch_tests module

Created on 4 Sep 2015

@author: maxz

class BGPLVMTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_gradients_missingdata()[source]
test_gradients_missingdata_stochastics()[source]
test_gradients_stochastics()[source]
test_lik_comparisons_m0_s0()[source]
test_lik_comparisons_m0_s1()[source]
test_lik_comparisons_m1_s0()[source]
test_lik_comparisons_m1_s1()[source]
test_predict()[source]
test_predict_missing_data()[source]
class SparseGPMinibatchTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_gradients_missingdata()[source]
test_gradients_missingdata_stochastics()[source]
test_gradients_stochastics()[source]
test_lik_comparisons_m0_s0()[source]
test_lik_comparisons_m0_s1()[source]
test_lik_comparisons_m1_s0()[source]
test_lik_comparisons_m1_s1()[source]
test_predict()[source]
test_predict_missing_data()[source]
test_sparsegp_init()[source]

GPy.testing.misc_tests module

class MiscTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

Testing some utilities of misc

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_safe_exp_lower()[source]
test_safe_exp_upper()[source]

GPy.testing.model_tests module

class GradientTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

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

Hook method for setting up the test fixture before exercising it.

test_BCGPLVM_rbf_bias_white_kern_2D()[source]

Testing GPLVM with rbf + bias kernel

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_SparseGPLVM_rbf_bias_white_kern_2D()[source]

Testing GPLVM with rbf + bias kernel

test_SparseGPRegression_rbf_linear_white_kern_1D()[source]

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

test_SparseGPRegression_rbf_linear_white_kern_2D()[source]

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

test_SparseGPRegression_rbf_white_kern_1D_uncertain_inputs()[source]

Testing the sparse GP regression with rbf, linear kernel on 1d 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_SparseGPRegression_rbf_white_kern_2D_uncertain_inputs()[source]

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

test_TPRegression_matern32_1D()[source]

Testing the TP regression with matern32 kernel on 1d data

test_TPRegression_matern32_2D()[source]

Testing the TP regression with matern32 kernel on 2d data

test_TPRegression_matern32_ARD_2D()[source]

Testing the TP regression with matern32 kernel on 2d data

test_TPRegression_matern52_1D()[source]

Testing the TP regression with matern52 kernel on 1d data

test_TPRegression_matern52_2D()[source]

Testing the TP regression with matern52 kernel on 2d data

test_TPRegression_matern52_ARD_2D()[source]

Testing the TP regression with matern52 kernel on 2d data

test_TPRegression_rbf_2D()[source]

Testing the TP regression with rbf kernel on 2d data

test_TPRegression_rbf_ARD_2D()[source]

Testing the GP regression with rbf kernel on 2d data

test_gp_VGPC()[source]
test_gp_heteroscedastic_regression()[source]
test_gp_kronecker_gaussian()[source]
test_multiout_regression()[source]
test_multiout_regression_md()[source]
test_multioutput_model_with_derivative_observations()[source]
test_multioutput_model_with_ep()[source]
test_multioutput_regression_1D()[source]
test_multioutput_sparse_regression_1D()[source]
test_posterior_covariance()[source]
test_posterior_covariance_between_points_with_normalizer()[source]

Check that model.posterior_covariance_between_points returns the covariance from model.predict when normalizer=True

test_posterior_covariance_missing_data()[source]
test_predictive_gradients_with_normalizer()[source]

Check that model.predictive_gradients returns the gradients of model.predict when normalizer=True

test_simple_MultivariateGaussian_prior()[source]
test_simple_MultivariateGaussian_prior_matrixmean()[source]
test_sparse_EP_DTC_probit()[source]
test_sparse_EP_DTC_probit_uncertain_inputs()[source]
test_sparse_gp_heteroscedastic_regression()[source]
test_ssgplvm()[source]
class MiscTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

check_jacobian()[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_big_model()[source]
test_input_warped_gp_identity()[source]

A InputWarpedGP with the identity warping function should be equal to a standard GP.

test_kumar_warping_gradient()[source]
test_kumar_warping_parameters()[source]
test_likelihood_replicate()[source]
test_likelihood_replicate_kern()[source]
test_likelihood_set()[source]
test_logistic_basis_func_gradients()[source]
test_missing_data()[source]
test_model_optimize()[source]
test_model_set_params()[source]
test_model_updates()[source]
test_mrd()[source]
test_multioutput_regression_with_normalizer()[source]

Test that normalizing works in multi-output case

test_normalizer()[source]
test_offset_regression()[source]
test_posterior_inf_basis_funcs()[source]
test_predict_uncertain_inputs()[source]

Projection of Gaussian through a linear function is still gaussian, and moments are analytical to compute, so we can check this case for predictions easily

test_raw_predict()[source]
test_raw_predict_numerical_stability()[source]

Test whether the predicted variance of normal GP goes negative under numerical unstable situation. Thanks simbartonels@github for reporting the bug and providing the following example.

test_setXY()[source]
test_sparse_raw_predict()[source]
test_warped_gp_cubic_sine(max_iters=100)[source]

A test replicating the cubic sine regression problem from Snelson’s paper. This test doesn’t have any assertions, it’s just to ensure coverage of the tanh warping function code.

test_warped_gp_identity()[source]

A WarpedGP with the identity warping function should be equal to a standard GP.

test_warped_gp_log()[source]

A WarpedGP with the log warping function should be equal to a standard GP with log labels. Note that we predict the median here.

GPy.testing.mpi_tests module

GPy.testing.pep_tests module

class PEPgradienttest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_pep_1d_gradients()[source]
test_pep_2d_gradients()[source]
test_pep_fitc_consistency()[source]
test_pep_vfe_consistency()[source]

GPy.testing.pickle_tests module

Created on 13 Mar 2014

@author: maxz

class ListDictTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

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

Bases: GPy.testing.pickle_tests.ListDictTestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_model()[source]
test_model_concat()[source]
test_modelrecreation()[source]
test_posterior()[source]
test_load_pickle = SkipTest(<function Test.test_load_pickle>)
toy_model()[source]

GPy.testing.plotting_tests module

class ConfigTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_change_plotting()[source]
compare_axis_dicts(x, y, decimal=6)[source]
flatten_axis(ax, prevname='')[source]
test_bayesian_gplvm()[source]
test_classification()[source]
test_figure()[source]
test_gplvm()[source]
test_kernel()[source]
test_plot()[source]
test_sparse()[source]
test_sparse_classification()[source]
test_threed()[source]
test_twod()[source]

GPy.testing.prior_tests module

class PriorTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_Gamma()[source]
test_InverseGamma()[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]
test_studentT()[source]
test_uniform()[source]

GPy.testing.quadrature_tests module

class QuadTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

test file for checking implementation of gaussian-kronrod quadrature. we will take a function which can be integrated analytically and check if quadgk result is similar or not! through this file we can test how numerically accurate quadrature implementation in native numpy or manual code is.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_finite_quad()[source]
test_infinite_quad()[source]

GPy.testing.rv_transformation_tests module

Test if hyperparameters in models are properly transformed.

class RVTransformationTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_Exponent()[source]
test_Exponent_grad()[source]
test_Logexp()[source]
test_Logexp_grad()[source]
class TestModel(theta=1.0)[source]

Bases: GPy.core.model.Model

A simple GPy model with one parameter.

log_likelihood()[source]

GPy.testing.serialization_tests module

Created on 20 April 2017

@author: pgmoren

class Test(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_serialize_deserialize_GP()[source]
test_serialize_deserialize_GPClassification()[source]
test_serialize_deserialize_GPRegressor()[source]
test_serialize_deserialize_SparseGP()[source]
test_serialize_deserialize_SparseGPClassification()[source]
test_serialize_deserialize_inference_methods()[source]
test_serialize_deserialize_kernels()[source]
test_serialize_deserialize_likelihoods()[source]
test_serialize_deserialize_mappings()[source]
test_serialize_deserialize_normalizers()[source]

GPy.testing.state_space_main_tests module

Test module for state_space_main.py

class StateSpaceKernelsTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

run_continuous_model(F, L, Qc, p_H, p_R, P_inf, X_data, Y_data, index=None, m_init=None, P_init=None, use_cython=False, kalman_filter_type='regular', calc_log_likelihood=True, calc_grad_log_likelihood=True, grad_params_no=0, grad_calc_params=None)[source]
run_descr_model(measurements, A, Q, H, R, true_states=None, mean_compare_decimal=8, m_init=None, P_init=None, dA=None, dQ=None, dH=None, dR=None, use_cython=False, kalman_filter_type='regular', calc_log_likelihood=True, calc_grad_log_likelihood=True)[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_continuous_ss(plot=False)[source]

This function tests the continuous state-space model.

test_discrete_ss_1D(plot=False)[source]

This function tests Kalman filter and smoothing when the state dimensionality is one dimensional.

test_discrete_ss_2D(plot=False)[source]

This function tests Kalman filter and smoothing when the state dimensionality is two dimensional.

test_discrete_ss_first(plot=False)[source]

Tests discrete State-Space model - first test.

generate_brownian_data(x_points=None, kernel_var=2.0, noise_var=2.0, plot=False, points_num=100, x_interval=(0, 20), random=True)[source]

Generate brownian data - data from Brownian motion. First point is always 0, and Beta(0) = 0 - standard conditions for Brownian motion.

x_points: np.array
Previously generated X points
variance: float
Gaussian noise variance added to the sine function
plot: bool
Whether to plot generated data

(if x_points is None, the the following parameters are used to generate those. They are the same as in ‘generate_x_points’ function)

points_num: int

x_interval: tuple (a,b)

random: bool

generate_linear_data(x_points=None, tangent=2.0, add_term=1.0, noise_var=2.0, plot=False, points_num=100, x_interval=(0, 20), random=True)[source]

Function generates linear data.

x_points: np.array
Previously generated X points
tangent: float
Factor with which independent variable is multiplied in linear equation.
add_term: float
Additive term in linear equation.
noise_var: float
Gaussian noise variance added to the sine function
plot: bool
Whether to plot generated data

(if x_points is None, the the following parameters are used to generate those. They are the same as in ‘generate_x_points’ function)

points_num: int

x_interval: tuple (a,b)

random: bool

generate_linear_plus_sin(x_points=None, tangent=2.0, add_term=1.0, noise_var=2.0, sin_period=2.0, sin_ampl=10.0, plot=False, points_num=100, x_interval=(0, 20), random=True)[source]

Generate the sum of linear trend and the sine function.

For parameters see the ‘generate_linear’ and ‘generate_sine’.

Comment: Gaussian noise variance is added only once (for linear function).

generate_random_y_data(samples, dim, ts_no)[source]

Generate data:

samples - how many samples dim - dimensionality of the data ts_no - number of time series

Y: np.array((samples, dim, ts_no))
generate_sine_data(x_points=None, sin_period=2.0, sin_ampl=10.0, noise_var=2.0, plot=False, points_num=100, x_interval=(0, 20), random=True)[source]

Function generates sinusoidal data.

x_points: np.array
Previously generated X points
sin_period: float
Sine period
sin_ampl: float
Sine amplitude
noise_var: float
Gaussian noise variance added to the sine function
plot: bool
Whether to plot generated data

(if x_points is None, the the following parameters are used to generate those. They are the same as in ‘generate_x_points’ function)

points_num: int

x_interval: tuple (a,b)

random: bool

generate_x_points(points_num=100, x_interval=(0, 20), random=True)[source]

Function generates (sorted) points on the x axis.

points_num: int
How many points to generate
x_interval: tuple (a,b)
On which interval to generate points
random: bool
Regular points or random
x_points: np.array
Generated points

GPy.testing.svgp_tests module

class SVGP_Poisson_with_meanfunction(methodName='runTest')[source]

Bases: unittest.case.TestCase

Inference in the SVGP with a Bernoulli likelihood

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_grad()[source]
class SVGP_classification(methodName='runTest')[source]

Bases: unittest.case.TestCase

Inference in the SVGP with a Bernoulli likelihood

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_grad()[source]
class SVGP_nonconvex(methodName='runTest')[source]

Bases: unittest.case.TestCase

Inference in the SVGP with a student-T likelihood

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_grad()[source]

GPy.testing.tp_tests module

Created on 14 Jul 2017, based on gp_tests

@author: javdrher

class Test(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_gp_equivalence()[source]
test_mean_function()[source]
test_normalizer()[source]
test_predict_equivalence()[source]
test_setxy_gp()[source]

GPy.testing.util_tests module

class TestDebug(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_DSYR()[source]
test_checkFinite()[source]
test_checkFullRank()[source]
test_fixed_inputs_mean()[source]
test_fixed_inputs_median()[source]

test fixed_inputs convenience function

test_fixed_inputs_uncertain()[source]
test_fixed_inputs_zero()[source]
test_offset_cluster()[source]
test_subarray()[source]
class TestStandardize(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_inverse_covariance()[source]

Test inverse covariance outputs correct size

class TestUnivariateGaussian(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_cdfNormal()[source]
test_derivLogCdfNormal()[source]
test_logCdfNormal()[source]
test_logPdfNormal()[source]

GPy.testing.variational_tests module

Copyright (c) 2015, Max Zwiessele All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of paramax nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

class KLGrad(Xvar, kl)[source]

Bases: GPy.core.model.Model

objective_function()[source]

The objective function for the given algorithm.

This function is the true objective, which wants to be minimized. Note that all parameters are already set and in place, so you just need to return the objective function here.

For probabilistic models this is the negative log_likelihood (including the MAP prior), so we return it here. If your model is not probabilistic, just return your objective to minimize here!

parameters_changed()[source]

This method gets called when parameters have changed. Another way of listening to param changes is to add self as a listener to the param, such that updates get passed through. See :py:function:paramz.param.Observable.add_observer

class Test(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testNormal()[source]