TransportMaps.tests.TestFunctions

Module Contents

Classes

LinearNormalMap

ArcTanTransportMap

GumbelTransportMap

WeibullTransportMap

BetaTransportMap

LogisticTransportMap

GammaTransportMap

ArcTanDistribution

Abstract distribution \(\nu_\pi\).

Functions

get(TESTN)

Attributes

NAX

TransportMaps.tests.TestFunctions.NAX[source]
TransportMaps.tests.TestFunctions.get(TESTN)[source]
class TransportMaps.tests.TestFunctions.LinearNormalMap(mu, sigma2)[source]

Bases: object

evaluate(x)[source]
__call__(x)[source]
inverse(x)[source]
class TransportMaps.tests.TestFunctions.ArcTanTransportMap(a, b, c, d, e)[source]

Bases: object

evaluate(x)[source]
__call__(x)[source]
grad_x(x)[source]
hess_x(x)[source]
nabla3_x(x)[source]
inverse(y)[source]
grad_x_inverse(x, inv=None)[source]
hess_x_inverse(x, inv=None)[source]
nabla3_x_invserse(x, inv=None)[source]
class TransportMaps.tests.TestFunctions.GumbelTransportMap(mu, beta)[source]

Bases: object

evaluate(x, params=None)[source]
__call__(x)[source]
inverse(x, params=None)[source]
class TransportMaps.tests.TestFunctions.WeibullTransportMap(c, mu, sigma)[source]

Bases: object

evaluate(x, params=None)[source]
__call__(x)[source]
inverse(x, params=None)[source]
class TransportMaps.tests.TestFunctions.BetaTransportMap(alpha, beta)[source]

Bases: object

suppmap(x, params=None)[source]
invsuppmap(x, params=None)[source]
evaluate(x, params=None)[source]
__call__(x)[source]
inverse(x, params=None)[source]
class TransportMaps.tests.TestFunctions.LogisticTransportMap(mu, s)[source]

Bases: object

evaluate(x, params=None)[source]
__call__(x)[source]
inverse(x, params=None)[source]
class TransportMaps.tests.TestFunctions.GammaTransportMap(kappa, theta)[source]

Bases: object

evaluate(x, params=None)[source]
__call__(x)[source]
inverse(x, params=None)[source]
class TransportMaps.tests.TestFunctions.ArcTanDistribution(atan_fun, base_distribution)[source]

Bases: TransportMaps.Distributions.Distribution

Abstract distribution \(\nu_\pi\).

rvs(n, *args, **kwargs)[source]

[Abstract] Generate \(m\) samples from the distribution.

Parameters:

m (int) – number of samples to generate

Returns:

(ndarray [\(m,d\)]) – \(m\)

\(d\)-dimensional samples

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

quadrature(qtype, qparams, mass=1.0, **kwargs)[source]

[Abstract] Generate quadrature points and weights.

Parameters:
  • qtype (int) – quadrature type number. The different types are defined in the associated sub-classes.

  • qparams (object) – inputs necessary to the generation of the selected quadrature

  • mass (float) – total mass of the quadrature (1 for probability measures)

Returns:

(tuple (ndarray [\(m,d\)],

ndarray [\(m\)])) – list of quadrature points and weights

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

pdf(x, *args, **kwargs)[source]

Evaluate \(\pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points

  • params (dict) – parameters

  • idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by idxs_slice must match x.shape[0].

Returns:

(ndarray [\(m\)]) – values of \(\pi\)

at the x points.

Raises:

NotImplementedError – the method calls :fun:`log_pdf`

grad_x_pdf(x, *args, **kwargs)[source]
log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points

  • params (dict) – parameters

  • idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by idxs_slice must match x.shape[0].

Returns:

(ndarray [\(m\)]) – values of \(\log\pi\)

at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

grad_x_log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\nabla_{\bf x} \log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points

  • params (dict) – parameters

  • idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by idxs_slice must match x.shape[0].

Returns:

(ndarray [\(m,d\)]) – values of

\(\nabla_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

tuple_grad_x_log_pdf(x, *args, **kwargs)[source]

[Abstract] Compute the tuple \(\left(\log \pi({\bf x}), \nabla_{\bf x} \log \pi({\bf x})\right)\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points

  • params (dict) – parameters

  • idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by idxs_slice must match x.shape[0].

  • cache (dict) – cache

Returns:

(tuple) – containing

\(\left(\log \pi({\bf x}), \nabla_{\bf x} \log \pi({\bf x})\right)\)

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

hess_x_log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\nabla^2_{\bf x} \log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points

  • params (dict) – parameters

  • idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by idxs_slice must match x.shape[0].

Returns:

(ndarray [\(m,d,d\)]) – values of

\(\nabla^2_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

action_hess_x_log_pdf(x, dx, *args, **kwargs)[source]

[Abstract] Evaluate \(\langle \nabla^2_{\bf x} \log \pi({\bf x}), \delta{\bf x}\rangle\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points

  • dx (ndarray [\(m,d\)]) – direction on which to evaluate the Hessian

  • params (dict) – parameters

  • idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by idxs_slice must match x.shape[0].

Returns:

(ndarray [\(m,d\)]) – values of

\(\langle \nabla^2_{\bf x} \log \pi({\bf x}), \delta{\bf x}\rangle\).

Raises:

NotImplementedError – the method needs to be defined in the sub-classes