test Package

test Package

infpy.exp.test.suite()[source]

exp_family_test Module

class infpy.exp.test.exp_family_test.CheckConjugatePrior(conj_prior)[source]

Bases: object

Checks various methods/properties of a conjugate prior.

check_all()[source]

Run all checks on this conjugate prior.

check_conjugacy()[source]

Test that the conjugate prior is set up correctly.

check_log_normalisation_factor_expectation(sample_size=1000)[source]

Test that we get close to the same expectation of the mvn normalisation factor from sampling from a normal wishart that we do from calculation of our formula.

conj_prior = None

The conjugate prior being checked.

class infpy.exp.test.exp_family_test.CheckExpFamily(family)[source]

Bases: object

Checks various methods/properties of an exponential family.

check_KL(size=1000)[source]

Checks the KL divergence by sampling.

check_against_truth()[source]

Checks the family pdf agrees with the independently calculated pdf.

check_all()[source]
check_attributes()[source]

Checks the class has the correct attributes.

check_dimensions()[source]

Checks the family has the correct length for A(), T() and eta().

check_entropy_truth()[source]

Checks the family entropy agrees with the independently calculated entropy.

check_exp_T(size=10000)[source]

Checks the expectation of sufficient statistics.

check_thetas()[source]

Checks the family converts between eta and theta ok.

check_vectorisation()[source]

Checks the family handles multiple xs and etas at once.

check_xs()[source]

Checks the family converts between x and T ok.

family = None

The exponential family being checked.

class infpy.exp.test.exp_family_test.GeneralisedConjPriorTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

Test case for all conjugate priors.

test()[source]

Test all the subclasses of infpy.exp.ConjugatePrior.

class infpy.exp.test.exp_family_test.GeneralisedExpFamilyTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

Test case for all exponential families with default __init__ arguments.

test()[source]

Test all the subclasses of infpy.exp.ExponentialFamily.

class infpy.exp.test.exp_family_test.HighDMvnTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Test case for high dimensional multivariate normal.

setUp()[source]
test_exp_family_std_methods()[source]
test_expectations_by_sampling(size=1000)[source]

Test some expected values by sampling from the distribution.

class infpy.exp.test.exp_family_test.MvnConjPriorTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

Tests conjugate prior of MVN distribution.

test_expectations_by_sampling(sample_size=1000)[source]

Test that we get close to the same expectation of the mvn normalisation factor from sampling from a normal wishart that we do from calculation of our formula.

infpy.exp.test.exp_family_test.check_close(a, b, tol=1e-08)[source]
infpy.exp.test.exp_family_test.check_gradient(f, df, x0, tol=0.02, text='')[source]

Checks the gradient of f matches the gradient calculated by df at x0

infpy.exp.test.exp_family_test.check_is_close(u, v, tol=0.0001, strong_test=True, dont_test_zeros=False)[source]

See U{http://www.boost.org/libs/test/doc/components/test_tools/floating_point_comparison.html} for partial inspiration.

Table Of Contents

Previous topic

exp Package

Next topic

genepy Package

This Page