TransportMaps.Maps.TriangularComponentwiseTransportMapBase

Module Contents

Classes

TriangularComponentwiseTransportMap

Triangular transport map \(T({\bf x})=[T_1,T_2,\ldots,T_{d_x}]^\top\), where \(T_i(x_{1:i}):\mathbb{R}^i\rightarrow\mathbb{R}\).

TriangularTransportMap

Triangular transport map \(T({\bf x})=[T_1,T_2,\ldots,T_{d_x}]^\top\), where \(T_i(x_{1:i}):\mathbb{R}^i\rightarrow\mathbb{R}\).

MonotonicTriangularTransportMap

Triangular transport map \(T({\bf x})=[T_1,T_2,\ldots,T_{d_x}]^\top\), where \(T_i(x_{1:i}):\mathbb{R}^i\rightarrow\mathbb{R}\).

class TransportMaps.Maps.TriangularComponentwiseTransportMapBase.TriangularComponentwiseTransportMap(**kwargs)[source]

Bases: TransportMaps.Maps.TriangularComponentwiseMapBase.TriangularComponentwiseMap, TransportMaps.Maps.ComponentwiseTransportMapBase.ComponentwiseTransportMap

Triangular transport map \(T({\bf x})=[T_1,T_2,\ldots,T_{d_x}]^\top\), where \(T_i(x_{1:i}):\mathbb{R}^i\rightarrow\mathbb{R}\).

log_det_grad_x(x, precomp=None, idxs_slice=slice(None), cache=None)[source]

Compute: \(\log \det \nabla_{\bf x} T({\bf x})\).

Since the map is lower triangular,

\[\log \det \nabla_{\bf x} T({\bf x}) = \sum_{k=1}^d \log \partial_{{\bf x}_k} T_k({\bf x}_{1:k})\]
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].

  • cache (dict) – cache

Returns:

(ndarray [\(m\)]) – \(\log \det \nabla_{\bf x} T({\bf x})\) at every evaluation point

Raises:

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

log_det_grad_x_inverse(x, precomp=None, idxs_slice=slice(None))[source]

Compute: \(\log \det \nabla_{\bf x} T^{-1}({\bf x})\).

Since the map is lower triangular,

\[\log \det \nabla_{\bf y} T^{-1}({\bf x}) = \sum_{k=1}^d \log \partial_{{\bf x}_k} T^{-1}_k({\bf y}_{1:k})\]

For \({\bf x} = T^{-1}({\bf y})\),

\[\log \det \nabla_{\bf y} T^{-1}({\bf x}) = - \sum_{k=1}^d \log \partial_{{\bf x}_k} T_k({\bf x}_{1:k})\]
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})\) at every evaluation point

Raises:

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

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

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

Raises:

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

See also

log_det_grad_x().

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

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

Raises:

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

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

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\)]) – direction 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

Raises:

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

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

Compute: \(T^{-1}({\bf y})\)

If the map has more input than outputs \(d_{\rm in} > d_{\rm out}\), it consider the first \(d_{\rm in} - d_{\rm out}\) values in x to be already inverted values and feed them to the following approximations to find the inverse.

If x has \(d < d_{\rm in}\), performs the inversion only on the \(d\) dimensional head of the map.

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

Raises:

ValueError – if \(d_{\rm in} < d_{\rm out}\)

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

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

class TransportMaps.Maps.TriangularComponentwiseTransportMapBase.TriangularTransportMap(active_vars, approx_list)[source]

Bases: TriangularComponentwiseTransportMap

Triangular transport map \(T({\bf x})=[T_1,T_2,\ldots,T_{d_x}]^\top\), where \(T_i(x_{1:i}):\mathbb{R}^i\rightarrow\mathbb{R}\).

class TransportMaps.Maps.TriangularComponentwiseTransportMapBase.MonotonicTriangularTransportMap(active_vars, approx_list)[source]

Bases: TriangularComponentwiseTransportMap

Triangular transport map \(T({\bf x})=[T_1,T_2,\ldots,T_{d_x}]^\top\), where \(T_i(x_{1:i}):\mathbb{R}^i\rightarrow\mathbb{R}\).