TransportMaps.tests.test_distributions

Module Contents

Classes

DistributionTest

ConditionalDistributionTest

NormalDistributionCovarianceTests

A class whose instances are single test cases.

NormalDistributionPrecisionTests

A class whose instances are single test cases.

StandardNormalDistributionTest

A class whose instances are single test cases.

NormalDistributionCovarianceTriTest

A class whose instances are single test cases.

NormalDistributionCovarianceSymTest

A class whose instances are single test cases.

NormalDistributionCovarianceKLTest

A class whose instances are single test cases.

NormalDistributionPrecisionSymTest

A class whose instances are single test cases.

NormalDistributionPrecisionTriTest

A class whose instances are single test cases.

NormalDistributionPrecisionKLTest

A class whose instances are single test cases.

NormalDistributionSqrtTest

A class whose instances are single test cases.

LogNormalDistributionTest

A class whose instances are single test cases.

LogisticDistributionTest

A class whose instances are single test cases.

GammaDistributionTest

A class whose instances are single test cases.

BetaDistributionTest

A class whose instances are single test cases.

GumbelDistributionTest

A class whose instances are single test cases.

WeibullDistributionTest

A class whose instances are single test cases.

BananaDistributionTest

A class whose instances are single test cases.

FactorizedDistributionTest

We test the joint distribution \(\pi(x_0,x_1)=\pi_1(x_1|x_0)\pi_2(x_0)\) defined by

LinearBayesPosteriorDistributionTest

Test the Bayesian posterior for a linear Gaussian additive model with

NonLinearBayesPosteriorDistributionTest

Test the Bayesian posterior for a non-linear Gaussian additive model with

AR1TransitionDistributionTest

We test for the transition probability associated to the folllowing process

StochasticVolatilityDistributionTest

We test on the joint distribution of the stochastic volatility with hyper-parameters and

MarkovComponentZeroStochasticVolatilityDistributionTest

We test on the joint distribution of the stochastic volatility with hyper-parameters and

MarkovComponentOneStochasticVolatilityDistributionTest

We test on the joint distribution of the stochastic volatility with hyper-parameters and

Functions

build_suite([ttype])

run_tests([ttype, failfast])

Attributes

MPI_SUPPORT

TransportMaps.tests.test_distributions.MPI_SUPPORT = True[source]
class TransportMaps.tests.test_distributions.DistributionTest[source]

Bases: object

setUp()[source]
abstract get_d()[source]
get_sampling_distribution()[source]
abstract get_distribution()[source]
abstract get_analytic_integral()[source]

Value \(\mathbb{E}_\pi[x]\)

abstract get_test_function()[source]
abstract get_mc_eps()[source]
abstract get_quad_eps()[source]
test_rvs()[source]
test_log_pdf()[source]
test_grad_x_log_pdf()[source]
test_hess_x_log_pdf()[source]
test_test_gradients()[source]
test_mean_log_pdf()[source]
class TransportMaps.tests.test_distributions.ConditionalDistributionTest[source]

Bases: object

setUp()[source]
get_d()[source]
get_sampling_distribution()[source]
abstract get_distribution()[source]
test_log_pdf()[source]
test_grad_x_log_pdf()[source]
test_hess_x_log_pdf()[source]
class TransportMaps.tests.test_distributions.NormalDistributionCovarianceTests(methodName='runTest')[source]

Bases: DistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
get_d()[source]
get_test_function()[source]
get_analytic_integral()[source]

Value \(\mathbb{E}_\pi[x]\)

get_mc_eps()[source]
get_quad_eps()[source]
test_gauss_quadrature()[source]
class TransportMaps.tests.test_distributions.NormalDistributionPrecisionTests(methodName='runTest')[source]

Bases: DistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
get_d()[source]
get_test_function()[source]
get_analytic_integral()[source]

Value \(\mathbb{E}_\pi[x]\)

get_mc_eps()[source]
get_quad_eps()[source]
test_gauss_quadrature()[source]
class TransportMaps.tests.test_distributions.StandardNormalDistributionTest(methodName='runTest')[source]

Bases: DistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
get_d()[source]
get_test_function()[source]
get_analytic_integral()[source]

Value \(\mathbb{E}_\pi[x]\)

get_mc_eps()[source]
get_quad_eps()[source]
test_gauss_quadrature()[source]
class TransportMaps.tests.test_distributions.NormalDistributionCovarianceTriTest(methodName='runTest')[source]

Bases: StandardNormalDistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
class TransportMaps.tests.test_distributions.NormalDistributionCovarianceSymTest(methodName='runTest')[source]

Bases: StandardNormalDistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
class TransportMaps.tests.test_distributions.NormalDistributionCovarianceKLTest(methodName='runTest')[source]

Bases: StandardNormalDistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
class TransportMaps.tests.test_distributions.NormalDistributionPrecisionSymTest(methodName='runTest')[source]

Bases: StandardNormalDistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
class TransportMaps.tests.test_distributions.NormalDistributionPrecisionTriTest(methodName='runTest')[source]

Bases: StandardNormalDistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
class TransportMaps.tests.test_distributions.NormalDistributionPrecisionKLTest(methodName='runTest')[source]

Bases: StandardNormalDistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
class TransportMaps.tests.test_distributions.NormalDistributionSqrtTest(methodName='runTest')[source]

Bases: StandardNormalDistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
class TransportMaps.tests.test_distributions.LogNormalDistributionTest(methodName='runTest')[source]

Bases: DistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
get_d()[source]
get_analytic_integral()[source]

Value \(\mathbb{E}_\pi[x]\)

get_test_function()[source]
get_mc_eps()[source]
get_quad_eps()[source]
test_rvs()[source]
test_mean_log_pdf()[source]
class TransportMaps.tests.test_distributions.LogisticDistributionTest(methodName='runTest')[source]

Bases: DistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
get_d()[source]
get_analytic_integral()[source]

Value \(\mathbb{E}_\pi[x]\)

get_test_function()[source]
get_mc_eps()[source]
get_quad_eps()[source]
test_rvs()[source]
test_mean_log_pdf()[source]
class TransportMaps.tests.test_distributions.GammaDistributionTest(methodName='runTest')[source]

Bases: DistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
get_d()[source]
get_analytic_integral()[source]

Value \(\mathbb{E}_\pi[x]\)

get_test_function()[source]
get_mc_eps()[source]
get_quad_eps()[source]
test_rvs()[source]
test_mean_log_pdf()[source]
class TransportMaps.tests.test_distributions.BetaDistributionTest(methodName='runTest')[source]

Bases: DistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
get_d()[source]
get_analytic_integral()[source]

Value \(\mathbb{E}_\pi[x]\)

get_test_function()[source]
get_mc_eps()[source]
get_quad_eps()[source]
test_rvs()[source]
test_mean_log_pdf()[source]
class TransportMaps.tests.test_distributions.GumbelDistributionTest(methodName='runTest')[source]

Bases: DistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
get_d()[source]
get_analytic_integral()[source]

Value \(\mathbb{E}_\pi[x]\)

get_test_function()[source]
get_mc_eps()[source]
get_quad_eps()[source]
test_rvs()[source]
test_mean_log_pdf()[source]
class TransportMaps.tests.test_distributions.WeibullDistributionTest(methodName='runTest')[source]

Bases: DistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
get_d()[source]
get_analytic_integral()[source]

Value \(\mathbb{E}_\pi[x]\)

get_test_function()[source]
get_mc_eps()[source]
get_quad_eps()[source]
test_rvs()[source]
test_mean_log_pdf()[source]
class TransportMaps.tests.test_distributions.BananaDistributionTest(methodName='runTest')[source]

Bases: DistributionTest, unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

get_distribution()[source]
get_d()[source]
get_analytic_integral()[source]

Value \(\mathbb{E}_\pi[x]\)

get_test_function()[source]
get_mc_eps()[source]
get_quad_eps()[source]
test_rvs()[source]
test_mean_log_pdf()[source]
class TransportMaps.tests.test_distributions.FactorizedDistributionTest(methodName='runTest')[source]

Bases: DistributionTest, unittest.TestCase

We test the joint distribution \(\pi(x_0,x_1)=\pi_1(x_1|x_0)\pi_2(x_0)\) defined by

\[\begin{split}x_0 \sim \mathcal{N}(0,1) \\ x_1 | x_0 \sim \mathcal{N}(x_0^2, 1)\end{split}\]
get_sampling_distribution()[source]
get_distribution()[source]
get_d()[source]
get_analytic_integral()[source]

Value \(\mathbb{E}_\pi[x]\)

get_test_function()[source]
get_mc_eps()[source]
get_quad_eps()[source]
test_rvs()[source]
test_mean_log_pdf()[source]
class TransportMaps.tests.test_distributions.LinearBayesPosteriorDistributionTest(methodName='runTest')[source]

Bases: DistributionTest, unittest.TestCase

Test the Bayesian posterior for a linear Gaussian additive model with Gaussian prior.

\[{\bf y} = {\bf c} + {\bf T}{\bf x} + \varepsilon \;, \quad \varepsilon \sim \mathcal{N}(\mu, \Sigma) \;, \quad {\bf x} \sim \mathcal{N}(\mu_x, \Sigma_x)\]

To make it more interesting we set \(d_y=2\) and \(d_x=3\)

get_sampling_distribution()[source]
get_distribution()[source]
get_d()[source]
get_analytic_integral()[source]

Value \(\mathbb{E}_\pi[x]\)

get_test_function()[source]
get_mc_eps()[source]
get_quad_eps()[source]
test_rvs()[source]
test_mean_log_pdf()[source]
class TransportMaps.tests.test_distributions.NonLinearBayesPosteriorDistributionTest(methodName='runTest')[source]

Bases: DistributionTest, unittest.TestCase

Test the Bayesian posterior for a non-linear Gaussian additive model with Gaussian prior.

\[{\bf y} = T({\bf x}) + \varepsilon \;, \quad \varepsilon \sim \mathcal{N}(\mu, \Sigma) \;, \quad {\bf x} \sim \mathcal{N}(\mu_x, \Sigma_x)\]

To make it more interesting we set \(d_y=2\) and \(d_x=3\)

get_sampling_distribution()[source]
get_distribution()[source]
get_d()[source]
get_analytic_integral()[source]

Value \(\mathbb{E}_\pi[x]\)

get_test_function()[source]
get_mc_eps()[source]
get_quad_eps()[source]
test_rvs()[source]
test_mean_log_pdf()[source]
class TransportMaps.tests.test_distributions.AR1TransitionDistributionTest(methodName='runTest')[source]

Bases: ConditionalDistributionTest, unittest.TestCase

We test for the transition probability associated to the folllowing process

\[{\bf Z}_{k+1} = T({\bf Z}_k, \Theta) + \varepsilon \;, \quad \varepsilon \sim \nu_\pi\]

where \(T\) is a non-linear map and nu_pi is the banana distribution.

get_distribution()[source]
class TransportMaps.tests.test_distributions.StochasticVolatilityDistributionTest(methodName='runTest')[source]

Bases: DistributionTest, unittest.TestCase

We test on the joint distribution of the stochastic volatility with hyper-parameters and 4 steps.

get_sampling_distribution()[source]
get_distribution()[source]
get_d()[source]
get_analytic_integral()[source]

Value \(\mathbb{E}_\pi[x]\)

get_test_function()[source]
get_mc_eps()[source]
get_quad_eps()[source]
test_rvs()[source]
test_mean_log_pdf()[source]
class TransportMaps.tests.test_distributions.MarkovComponentZeroStochasticVolatilityDistributionTest(methodName='runTest')[source]

Bases: StochasticVolatilityDistributionTest, unittest.TestCase

We test on the joint distribution of the stochastic volatility with hyper-parameters and 4 steps.

get_distribution()[source]
get_d()[source]
class TransportMaps.tests.test_distributions.MarkovComponentOneStochasticVolatilityDistributionTest(methodName='runTest')[source]

Bases: StochasticVolatilityDistributionTest, unittest.TestCase

We test on the joint distribution of the stochastic volatility with hyper-parameters and 4 steps.

get_distribution()[source]
get_d()[source]
TransportMaps.tests.test_distributions.build_suite(ttype='all')[source]
TransportMaps.tests.test_distributions.run_tests(ttype='serial', failfast=False)[source]