TransportMaps.Maps.TransportMapBase

Module Contents

Classes

TransportMap

Transport map \(T({\bf x},{\bf a}): \mathbb{R}^d \rightarrow \mathbb{R}^d\).

class TransportMaps.Maps.TransportMapBase.TransportMap(*args, **kwargs)[source]

Bases: TransportMaps.Maps.MapBase.Map

Transport map \(T({\bf x},{\bf a}): \mathbb{R}^d \rightarrow \mathbb{R}^d\).

Parameters:
  • dim_in (int) – input dimension

  • dim_out (int) – output dimension

abstract inverse(y, precomp=None, idxs_slice=slice(None))[source]

[Abstract] Compute: \(T^{-1}({\bf x})\)

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

  • precomp (dict) – precomputed values

  • 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\)]) – \(T^{-1}({\bf x})\) for every evaluation point

abstract grad_x_inverse(x, precomp=None, idxs_slice=slice(None), *args, **kwargs)[source]

[Abstract] Compute \(\nabla_{\bf x} T^{-1}({\bf x})\).

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

  • precomp (dict) – dictionary of precomputed values

  • 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\)]) – gradient matrices for every evaluation point.

Raises:

NotImplementedError – to be implemented in subclasses

abstract hess_x_inverse(x, precomp=None, idxs_slice=slice(None), *args, **kwargs)[source]

[Abstract] Compute \(\nabla_{\bf x}^2 T^{-1}({\bf x})\).

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

  • precomp (dict) – dictionary of precomputed values

  • 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\)]) – Hessian tensors for every evaluation point.

Raises:

NotImplementedError – to be implemented in subclasses

det_grad_x(x, precomp=None, idxs_slice=slice(None), *args, **kwargs)[source]

[Abstract] Compute: \(\det \nabla_{\bf x} T({\bf x}, {\bf a})\).

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

  • precomp (dict) – dictionary of precomputed values

  • 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\)]) – \(\det \nabla_{\bf x} T({\bf x}, {\bf a})\) at every evaluation point

abstract log_det_grad_x(x, precomp=None, idxs_slice=slice(None), *args, **kwargs)[source]

[Abstract] Compute: \(\log \det \nabla_{\bf x} T({\bf x}, {\bf a})\).

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

  • precomp (dict) – dictionary of precomputed values

  • 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\)]) – \(\log \det \nabla_{\bf x} T({\bf x}, {\bf a})\) at every evaluation point

abstract log_det_grad_x_inverse(x, precomp=None, idxs_slice=slice(None), *args, **kwargs)[source]

[Abstract] Compute: \(\log \det \nabla_{\bf x} T^{-1}({\bf x}, {\bf a})\).

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

  • precomp (dict) – dictionary of precomputed values

  • 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\)]) – \(\log \det \nabla_{\bf x} T^{-1}({\bf x}, {\bf a})\) at every evaluation point

abstract grad_x_log_det_grad_x(x, precomp=None, idxs_slice=slice(None), *args, **kwargs)[source]

[Abstract] Compute: \(\nabla_{\bf x} \log \det \nabla_{\bf x} T({\bf x}, {\bf a})\)

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

  • precomp (dict) – dictionary of precomputed values

  • 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\)]) – \(\nabla_{\bf x} \log \det \nabla_{\bf x} T({\bf x}, {\bf a})\) at every evaluation point

See also

log_det_grad_x().

abstract hess_x_log_det_grad_x(x, precomp=None, idxs_slice=slice(None), *args, **kwargs)[source]

[Abstract] Compute: \(\nabla^2_{\bf x} \log \det \nabla_{\bf x} T({\bf x}, {\bf a})\)

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

  • precomp (dict) – dictionary of precomputed values

  • 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\)]) – \(\nabla^2_{\bf x} \log \det \nabla_{\bf x} T({\bf x}, {\bf a})\) at every evaluation point

abstract action_hess_x_log_det_grad_x(x: numpy.ndarray, dx: numpy.ndarray, precomp: dict = None, idxs_slice=slice(None), *args, **kwargs)[source]

[Abstract] Compute: \(\langle\nabla^2_{\bf x} \log \det \nabla_{\bf x} T({\bf x}), \delta{\bf x}\rangle\)

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

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

  • precomp (dict) – dictionary of precomputed values

  • 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\)]) – \(\langle\nabla^2_{\bf x} \log \det \nabla_{\bf x} T({\bf x}), \delta{\bf x}\rangle\) at every evaluation point

abstract grad_x_log_det_grad_x_inverse(x, precomp=None, idxs_slice=slice(None), *args, **kwargs)[source]

[Abstract] Compute: \(\nabla_{\bf x} \log \det \nabla_{\bf x} T^{-1}({\bf x}, {\bf a})\)

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

  • precomp (dict) – dictionary of precomputed values

  • 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\)]) – \(\nabla_{\bf x} \log \det \nabla_{\bf x} T^{-1}({\bf x}, {\bf a})\) at every evaluation point

See also

log_det_grad_x().

abstract hess_x_log_det_grad_x_inverse(x, precomp=None, idxs_slice=slice(None), *args, **kwargs)[source]

[Abstract] Compute: \(\nabla^2_{\bf x} \log \det \nabla_{\bf x} T^{-1}({\bf x}, {\bf a})\)

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

  • precomp (dict) – dictionary of precomputed values

  • 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\)]) – \(\nabla^2_{\bf x} \log \det \nabla_{\bf x} T^{-1}({\bf x}, {\bf a})\) at every evaluation point

abstract action_hess_x_log_det_grad_x_inverse(x: numpy.ndarray, dx: numpy.ndarray, precomp: dict = None, idxs_slice=slice(None), *args, **kwargs)[source]

[Abstract] Compute: \(\langle\nabla^2_{\bf x} \log \det \nabla_{\bf x} T^-1({\bf x}), \delta{\bf x}\rangle\)

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

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

  • precomp (dict) – dictionary of precomputed values

  • 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\)]) – \(\langle\nabla^2_{\bf x} \log \det \nabla_{\bf x} T^-1({\bf x}), \delta{\bf x}\rangle\) at every evaluation point

abstract log_pushforward(x, pi, params_t=None, params_pi=None, idxs_slice=slice(None), cache=None)[source]

Compute: \(\log \pi \circ T_{\bf a}^{-1}({\bf y}) + \log \vert\det \grad_{\bf x}T_{\bf a}^{-1}({\bf y})\vert\)

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

  • pi (Distributions.Distribution) – distribution to be pushed forward

  • params_t (dict) – parameters for the evaluation of \(T_{\bf a}\)

  • params_pi (dict) – parameters for the evaluation of \(\pi\)

  • 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:

(ndarray [\(m\)]) – \(\log \pi \circ T^{-1}({\bf y,a}) + \log \vert\det \grad_{\bf x}T^{-1}({\bf y,a})\vert\) at every evaluation point

Raises:

ValueError – if \(d\) does not match the dimension of the transport map.

pushforward(x, pi, params_t=None, params_pi=None, idxs_slice=slice(None), cache=None)[source]

Compute: \(\pi \circ T_{\bf a}^{-1}({\bf y}) \vert\det \grad_{\bf x}T_{\bf a}^{-1}({\bf y})\vert\)

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

  • pi (Distributions.Distribution) – distribution to be pushed forward

  • params_t (dict) – parameters for the evaluation of \(T_{\bf a}\)

  • params_pi (dict) – parameters for the evaluation of \(\pi\)

  • 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:

(ndarray [\(m\)]) – \(\pi \circ T^{-1}({\bf y,a}) \vert\det \grad_{\bf x}T^{-1}({\bf y,a})\vert\) at every evaluation point

Raises:

ValueError – if \(d\) does not match the dimension of the transport map.

abstract log_pullback(x, pi, params_t=None, params_pi=None, idxs_slice=slice(None), cache=None)[source]

Compute: \(\log\pi \circ T({\bf x}) + \log \vert\det \grad_{\bf x}T({\bf x})\vert\).

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

  • pi (Distributions.Distribution) – distribution to be pulled back

  • params_t (dict) – parameters for the evaluation of \(T_{\bf a}\)

  • params_pi (dict) – parameters for the evaluation of \(\pi\)

  • 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:

(ndarray [\(m\)]) – \(\log \pi \circ T({\bf x}) + \log\vert\det \grad_{\bf x}T({\bf x})\vert\) at every evaluation point

Raises:

ValueError – if \(d\) does not match the dimension of the transport map.

pullback(x, pi, params_t=None, params_pi=None, idxs_slice=slice(None), cache=None)[source]

Compute: \(\pi \circ T({\bf x}) \vert\det \grad_{\bf x}T({\bf x})\vert\).

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

  • pi (Distributions.Distribution) – distribution to be pulled back

  • params_t (dict) – parameters for the evaluation of \(T_{\bf a}\)

  • params_pi (dict) – parameters for the evaluation of \(\pi\)

  • 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:

(ndarray [\(m\)]) – \(\pi \circ T({\bf x}) \vert\det \grad_{\bf x}T({\bf x})\vert\) at every evaluation point

Raises:

ValueError – if \(d\) does not match the dimension of the transport map.