# TransportMaps.Diagnostics.Routines¶

## Module Contents¶

### Functions¶

 compute_vals_variance_approx_kl(d1, d2[, params1, ...]) Compute values necessary for the evaluation of the variance diagnostic variance_approx_kl() variance_approx_kl(d1, d2[, params1, params2, ...]) Variance diagnositc
TransportMaps.Diagnostics.Routines.compute_vals_variance_approx_kl(d1, d2, params1=None, params2=None, x=None, mpi_pool_tuple=(None, None), import_set=set())[source]

Compute values necessary for the evaluation of the variance diagnostic variance_approx_kl()

Returns:

(tuple [2] ndarray [$$m$$]) –

computed values of $$\log\pi_1$$ and $$\log\pi_2$$

TransportMaps.Diagnostics.Routines.variance_approx_kl(d1, d2, params1=None, params2=None, vals_d1=None, vals_d2=None, qtype=None, qparams=None, x=None, w=None, mpi_pool_tuple=(None, None), import_set=set())[source]

Variance diagnositc

Statistical analysis of the variance diagnostic

$\mathcal{D}_{KL}(\pi_1 \Vert \pi_2) \approx \frac{1}{2} \mathbb{V}_{\pi_1} \left( \log \frac{\pi_1}{\pi_2}\right)$
Parameters:
• d1 (Distribution) – distribution $$\pi_1$$

• d2 (Distribution) – distribution $$\pi_2$$

• params1 (dict) – parameters for distribution $$\pi_1$$

• params2 (dict) – parameters for distribution $$\pi_2$$

• vals_d1 (ndarray [$$m$$]) – computed values of $$\log\pi_1$$

• vals_d2 (ndarray [$$m$$]) – computed values of:math:logpi_2

• qtype (int) – quadrature type to be used for the approximation of $$\mathbb{E}_{\pi_1}$$

• qparams (object) – parameters necessary for the construction of the quadrature

• x (ndarray [$$m,d$$]) – quadrature points used for the approximation of $$\mathbb{E}_{\pi_1}$$

• w (ndarray [$$m$$]) – quadrature weights used for the approximation of $$\mathbb{E}_{\pi_1}$$

• mpi_pool_tuple (tuple [2] of mpi_map.MPI_Pool) – pool of processes to be used for the evaluation of d1 and d2

• import_set (set) – list of couples (module_name,as_field) to be imported as import module_name as as_field (for MPI purposes)

Note

The parameters (qtype,qparams) and (x,w) are mutually exclusive, but one pair of them is necessary.