TransportMaps.Distributions.TransportMapDistributions

Module Contents

Classes

PushForwardTransportMapDistribution

Class for densities of the transport map type \(T_\sharp \pi\)

PullBackTransportMapDistribution

Class for densities of the transport map type \(T^\sharp \pi\)

class TransportMaps.Distributions.TransportMapDistributions.PushForwardTransportMapDistribution(transport_map: TransportMaps.Maps.TransportMap, base_distribution: TransportMaps.Distributions.DistributionBase.Distribution)[source]

Bases: TransportMaps.Distributions.TransportMapDistributionBase.TransportMapDistribution

Class for densities of the transport map type \(T_\sharp \pi\)

Parameters:
  • transport_map (Maps.TriangularTransportMap) – transport map \(T\)

  • base_distribution (Distributions.Distribution) – distribution \(\pi\)

See also

TransportMapDistribution

pdf(x, params=None, idxs_slice=slice(None), cache=None)[source]

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

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

  • params (dict) – parameters with keys params_pi, params_t

  • 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\)]) – values of \(T_\sharp \pi\)

at the x points.

log_pdf(x, params=None, idxs_slice=slice(None), cache=None)[source]

Evaluate \(\log T_\sharp \pi({\bf x})\)

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

  • params (dict) – parameters with keys params_pi, params_t

  • 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\)]) – values of \(\log T_\sharp\pi\)

at the x points.

grad_x_log_pdf(x, params=None, idxs_slice=slice(None), cache=None, *args, **kwargs)[source]

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

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

  • params (dict) – parameters with keys params_pi, params_t

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

tuple_grad_x_log_pdf(x, params=None, idxs_slice=slice(None), cache=None, *args, **kwargs)[source]

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

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

  • params (dict) – parameters with keys params_pi, params_t

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

(tuple) –

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

hess_x_log_pdf(x, params=None, idxs_slice=slice(None), cache=None, *args, **kwargs)[source]

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

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

  • params (dict) – parameters with keys params_pi, params_t

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

action_hess_x_log_pdf(x, dx, params=None, idxs_slice=slice(None, None, None), cache=None, *args, **kwargs)[source]

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\).

map_function_base_to_target(f)[source]

Given the map \(f\) returns \(f\circ T\)

Parameters:

f (TransportMaps.Maps.Map) – the map \(f\)

Returns:

(TransportMaps.Maps.CompositeMap) – \(f \circ T\)

map_samples_base_to_target(x, mpi_pool=None)[source]

Map input samples (assumed to be from \(\pi\)) to the corresponding samples from \(T_\sharp \pi\).

Parameters:
  • x (ndarray [\(m,d\)]) – input samples

  • mpi_pool (mpi_map.MPI_Pool) – pool of processes

Returns:

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

map_samples_target_to_base(x, mpi_pool=None)[source]

Map input samples assumed to be from \(T_\sharp \pi\) to the corresponding samples from \(\pi\).

Parameters:
  • x (ndarray [\(m,d\)]) – input samples

  • mpi_pool (mpi_map.MPI_Pool) – pool of processes

Returns:

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

class TransportMaps.Distributions.TransportMapDistributions.PullBackTransportMapDistribution(transport_map: TransportMaps.Maps.TransportMap, base_distribution: TransportMaps.Distributions.DistributionBase.Distribution)[source]

Bases: TransportMaps.Distributions.TransportMapDistributionBase.TransportMapDistribution

Class for densities of the transport map type \(T^\sharp \pi\)

Parameters:
  • transport_map (Maps.TriangularTransportMap) – transport map \(T\)

  • base_distribution (Distributions.Distribution) – distribution \(\pi\)

See also

TransportMapDistribution

pdf(x, params=None, idxs_slice=slice(None), cache=None)[source]

Evaluate \(T^\sharp \pi({\bf x})\)

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

  • params (dict) – parameters with keys params_pi, params_t

  • 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\)]) – values of \(T^\sharp \pi\)

at the x points.

log_pdf(x, params=None, idxs_slice=slice(None), cache=None)[source]

Evaluate \(\log T^\sharp \pi({\bf x})\)

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

  • params (dict) – parameters with keys params_pi, params_t

  • 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\)]) – values of \(\log T^\sharp \pi\)

at the x points.

grad_x_log_pdf(x, params=None, idxs_slice=slice(None), cache=None, *args, **kwargs)[source]

Evaluate \(\nabla_{\bf x} \log T^\sharp \pi({\bf x})\)

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

  • params (dict) – parameters with keys params_pi, params_t

  • 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

\(\nabla_{\bf x} \log T^\sharp \pi\) at the x points.

tuple_grad_x_log_pdf(x, params=None, idxs_slice=slice(None), cache=None, *args, **kwargs)[source]

Evaluate \(\left(\log T^\sharp \pi({\bf x}), \nabla_{\bf x} \log T^\sharp \pi({\bf x})\right)\)

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

  • params (dict) – parameters with keys params_pi, params_t

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

(tuple) –

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

hess_x_log_pdf(x, params=None, idxs_slice=slice(None), cache=None, *args, **kwargs)[source]

Evaluate \(\nabla^2_{\bf x} \log T^\sharp \pi({\bf x})\)

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

  • params (dict) – parameters with keys params_pi, params_t

  • 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_{\bf x} \log T^\sharp \pi\) at the x points.

action_hess_x_log_pdf(x, dx, params=None, idxs_slice=slice(None), cache=None, *args, **kwargs)[source]

Evaluate \(\langle\nabla^2_{\bf x} \log T^\sharp \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 with keys params_pi, params_t

  • 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 T^\sharp \pi({\bf x}),\delta{\bf x}\rangle\) at the x points.

map_function_base_to_target(f)[source]

Given the map \(f\) returns \(f\circ T^{-1}\)

Parameters:

f (TransportMaps.Maps.Map) – the map \(f\)

Returns:

(TransportMaps.Maps.CompositeMap) – \(f \circ T^{-1}\)

map_samples_base_to_target(x, mpi_pool=None)[source]

Map input samples (assumed to be from \(\pi\)) to the corresponding samples from \(T^\sharp \pi\).

Parameters:
  • x (ndarray [\(m,d\)]) – input samples

  • mpi_pool (mpi_map.MPI_Pool) – pool of processes

Returns:

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

map_samples_target_to_base(x, mpi_pool=None)[source]

Map input samples assumed to be from \(T^\sharp \pi\) to the corresponding samples from \(\pi\).

Parameters:
  • x (ndarray [\(m,d\)]) – input samples

  • mpi_pool (mpi_map.MPI_Pool) – pool of processes

Returns:

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