TransportMaps.Maps.ParametricTriangularComponentwiseTransportMapBase¶

Module Contents¶

Classes¶

 ParametricTriangularComponentwiseTransportMap Triangular transport map $$T[{\bf a}_{1:d_x}]({\bf x})=[T_1[{\bf a}_1], \ldots,T_{d_x}[{\bf a}_{d_x}]]^\top$$, where $$T_i[{\bf a}_i]({\bf x}):\mathbb{R}^{n_i}\times\mathbb{R}^{d_x}\rightarrow\mathbb{R}$$.
class TransportMaps.Maps.ParametricTriangularComponentwiseTransportMapBase.ParametricTriangularComponentwiseTransportMap(**kwargs)[source]

Triangular transport map $$T[{\bf a}_{1:d_x}]({\bf x})=[T_1[{\bf a}_1], \ldots,T_{d_x}[{\bf a}_{d_x}]]^\top$$, where $$T_i[{\bf a}_i]({\bf x}):\mathbb{R}^{n_i}\times\mathbb{R}^{d_x}\rightarrow\mathbb{R}$$.

Compute: $$[\nabla_{\bf a}\partial_{{\bf x}_k} T_k]_k$$

This is

$\begin{split}\left[ \begin{array}{ccccc} \nabla_{{\bf a}_1}\partial_{{\bf x}_1}T_1 & 0 & \cdots & & 0 \\ 0 \nabla_{{\bf a}_2}\partial_{{\bf x}_2}T_2 & 0 & \cdots & 0 \\ \vdots & \ddots & & & \\ 0 & & \cdots & 0 & \nabla_{{\bf a}_d}\partial_{{\bf x}_d}T_d \end{array} \right]\end{split}$
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,d$$]) – $$[\partial_{{\bf x}_1}T_1({\bf x}_1,{\bf a}^{(1)}),\ldots,\partial_{{\bf x}_d}T_d({\bf x}_{1:d},{\bf a}^{(d)})]$$ at every evaluation point

Raises:

ValueError – if $$d$$ does not match the dimension of the transport map.

Compute: $$\nabla_{\bf a} \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].

• cache (dict) – cache

Returns:

(ndarray [$$m,N$$]) –

$$\nabla_{\bf a} \log \det \nabla_{\bf x} T({\bf x}, {\bf a})$$ at every evaluation point

Raises:

ValueError – if $$d$$ does not match the dimension of the transport map.

log_det_grad_x()

Compute: $$\nabla^2_{\bf a} \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].

• cache (dict) – cache

Returns:

(ndarray [$$m,N,N$$]) – $$\nabla^2_{\bf a} \log \det \nabla_{\bf x} T({\bf x}, {\bf a})$$ at every evaluation point

Raises:

ValueError – if $$d$$ does not match the dimension of the transport map.

log_det_grad_x() and grad_a_log_det_grad_x()

Compute: $$\langle\nabla^2_{\bf a} \log \det \nabla_{\bf x} T({\bf x}, {\bf a}), \delta{\bf a}\rangle$$.

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

• da (ndarray [$$N$$]) – 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].

• cache (dict) – cache

Returns:

(ndarray [$$m,N$$]) – $$\langle\nabla^2_{\bf a} \log \det \nabla_{\bf x} T({\bf x}, {\bf a}), \delta{\bf a}\rangle$$ at every evaluation point

Raises:

ValueError – if $$d$$ does not match the dimension of the transport map.

log_det_grad_x() and grad_a_log_det_grad_x()

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

Raises:

ValueError – if $$d$$ does not match the dimension of the transport map.

log_det_grad_x() and grad_x_log_det_grad_x().

Compute $$\nabla_{\bf a} T^{-1}({\bf x},{\bf a})$$

By the definition of the transport map $$T({\bf x},{\bf a})$$, the components $$T_1 ({\bf x}_1, {\bf a}^{(1)})$$, $$T_2 ({\bf x}_{1:2}, {\bf a}^{(2)})$$, … are defined by different sets of parameters $${\bf a}^{(1)}$$, $${\bf a}^{(2)}$$, etc.

Differently from grad_a(), $$\nabla_{\bf a} T^{-1}({\bf x},{\bf a})$$ is not block diagonal, but only lower block triangular Consequentely this function will return the full gradient.

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,N$$]) –

$$\nabla_{\bf a} T^{-1}({\bf x},{\bf a})$$

Raises:

ValueError – if $$d$$ does not match the dimension of the transport map.

precomp_minimize_kl_divergence(x, params, precomp_type='uni')[source]

Precompute necessary structures for the speed up of minimize_kl_divergence()

Enriches the dictionaries in the precomp list if necessary.

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

• params (dict) – parameters to be updated

• precomp_type (str) – whether to precompute univariate Vandermonde matrices ‘uni’ or multivariate Vandermonde matrices ‘multi’

Returns:

(tuple (None,:class:dict<dict>)) – dictionary of necessary

strucutres. The first argument is needed for consistency with

allocate_cache_minimize_kl_divergence(x)[source]

Allocate cache space for the KL-divergence minimization

Parameters:

x (ndarray [$$m,d$$]) – evaluation points

reset_cache_minimize_kl_divergence(cache)[source]

Reset the cache space for the KL-divergence minimization

Parameters:

cache (dict) – dictionary of cached values

abstract get_default_init_values_minimize_kl_divergence()[source]