TransportMaps.Distributions

Sub-modules

Classes

Inheritance diagram of TransportMaps.Distributions.Distribution, TransportMaps.Distributions.ProductDistribution, TransportMaps.Distributions.ConditionalDistribution, TransportMaps.Distributions.DistributionFromSamples, TransportMaps.Distributions.FactorizedDistribution, TransportMaps.Distributions.FrozenDistribution_1d, TransportMaps.Distributions.GaussianDistribution, TransportMaps.Distributions.StandardNormalDistribution, TransportMaps.Distributions.ChainGraphGaussianDistribution, TransportMaps.Distributions.StarGraphGaussianDistribution, TransportMaps.Distributions.GridGraphGaussianDistribution, TransportMaps.Distributions.LogNormalDistribution, TransportMaps.Distributions.LogisticDistribution, TransportMaps.Distributions.GammaDistribution, TransportMaps.Distributions.BetaDistribution, TransportMaps.Distributions.WeibullDistribution, TransportMaps.Distributions.CauchyDistribution, TransportMaps.Distributions.GumbelDistribution, TransportMaps.Distributions.BananaDistribution, TransportMaps.Distributions.StudentTDistribution, TransportMaps.Distributions.ConditionallyGaussianDistribution, TransportMaps.Distributions.MeanConditionallyGaussianDistribution, TransportMaps.Distributions.ParametricDistribution, TransportMaps.Distributions.TransportMapDistribution, TransportMaps.Distributions.PushForwardTransportMapDistribution, TransportMaps.Distributions.PullBackTransportMapDistribution
Class Description
Distribution Abstract distribution \(\nu_\pi\).
ProductDistribution Abstract distribution \(\nu(A_1\times\cdots\times A_n) = \nu_1(A_1)\cdots\nu_n(A_n)\)
ConditionalDistribution Abstract distribution \(\pi_{{\bf X}\vert{\bf Y}}\).
DistributionFromSamples Arbitrary density built from samples
FactorizedDistribution Distribution \(\nu_\pi\) defiened by its conditional factors.
FrozenDistribution_1d [Abstract] Generic frozen distribution 1d
GaussianDistribution Multivariate Gaussian distribution \(\pi\)
StandardNormalDistribution Multivariate Standard Normal distribution \(\pi\).
ChainGraphGaussianDistribution  
StarGraphGaussianDistribution  
GridGraphGaussianDistribution  
LogNormalDistribution  
LogisticDistribution  
GammaDistribution  
BetaDistribution  
WeibullDistribution  
CauchyDistribution  
GumbelDistribution  
BananaDistribution  
StudentTDistribution  
ConditionallyGaussianDistribution Multivariate Gaussian distribution \(\pi({\bf x}\vert{\bf y}) \sim \mathcal{N}(\mu({\bf y}), \Sigma({\bf y}))\)
MeanConditionallyGaussianDistribution Multivariate Gaussian distribution \(\pi({\bf x}\vert{\bf y}) \sim \mathcal{N}(\mu({\bf y}), \Sigma)\)
ParametricDistribution Parametric distribution \(\pi_{\bf a}\).
TransportMapDistribution Abstract class for densities of the transport map type (\(T^\sharp \pi\) or \(T_\sharp \pi\))
PushForwardTransportMapDistribution Class for densities of the transport map type \(T_\sharp \pi\)
PullBackTransportMapDistribution Class for densities of the transport map type \(T^\sharp \pi\)

Documentation

class TransportMaps.Distributions.Distribution(dim)[source]

Abstract distribution \(\nu_\pi\).

Parameters:dim (int) – input dimension of the distribution
action_hess_x_log_pdf(x, dx, params=None, idxs_slice=slice(None, None, None), **kwargs)[source]

[Abstract] 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\).

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

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

[Abstract] Evaluate \(\nabla_{\bf x} \log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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

\(\nabla_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

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

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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,d\)]) – values of

\(\nabla^2_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

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

[Abstract] Evaluate \(\log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\log\pi\)

at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

mean_log_pdf()[source]

[Abstract] Evaluate \(\mathbb{E}_{\pi}[\log \pi]\)

Returns:(float) – \(\mathbb{E}_{\pi}[\log \pi]\)
Raises:NotImplementedError – the method needs to be defined in the sub-classes
pdf(x, params=None, idxs_slice=slice(None, None, None), **kwargs)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\pi\)

at the x points.

Raises:

NotImplementedError – the method calls :fun:`log_pdf`

quadrature(qtype, qparams, mass, *args, **kwargs)[source]

[Abstract] Generate quadrature points and weights.

Parameters:
  • qtype (int) – quadrature type number. The different types are defined in the associated sub-classes.
  • qparams (object) – inputs necessary to the generation of the selected quadrature
  • mass (float) – total mass of the quadrature (1 for probability measures)
Returns:

(tuple (ndarray [\(m,d\)],

ndarray [\(m\)])) – list of quadrature points and weights

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

rvs(m, *args, **kwargs)[source]

[Abstract] Generate \(m\) samples from the distribution.

Parameters:m (int) – number of samples to generate
Returns:
(ndarray [\(m,d\)]) – \(m\)
\(d\)-dimensional samples
Raises:NotImplementedError – the method needs to be defined in the sub-classes
tuple_grad_x_log_pdf(x, params=None, idxs_slice=slice(None, None, None), cache=None, **kwargs)[source]

[Abstract] Compute the tuple \(\left(\log \pi({\bf x}), \nabla_{\bf x} \log \pi({\bf x})\right)\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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].
  • cache (dict) – cache
Returns:

(tuple) – containing

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

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

class TransportMaps.Distributions.ProductDistribution(dim)[source]

Abstract distribution \(\nu(A_1\times\cdots\times A_n) = \nu_1(A_1)\cdots\nu_n(A_n)\)

get_component(avars)[source]

[Abstract] return the measure \(\nu_{a_1}\times\cdots\times\nu_{a_k}\)

Parameters:avars (list) – list of coordinates to extract from \(\nu\)
class TransportMaps.Distributions.ConditionalDistribution(dim, dim_y)[source]

Abstract distribution \(\pi_{{\bf X}\vert{\bf Y}}\).

Parameters:
  • dim (int) – input dimension of the distribution
  • dim_y (int) – dimension of the conditioning variables
action_hess_x_log_pdf(x, y, dx, dy, params=None, idxs_slice=slice(None, None, None), **kwargs)[source]

[Abstract] Evaluate \(\langle\nabla^2_{\bf x,y} \log \pi({\bf x}\vert{\bf y}), [\delta{\bf x},\delta{\bf y}]\rangle\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • y (ndarray [\(m,d_y\)]) – conditioning values \({\bf Y}={\bf y}\)
  • dx (ndarray [\(m,d\)]) – x direction on which to evaluate the Hessian
  • dy (ndarray [\(m,d_y\)]) – y 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,d\)]) – values of

\(\nabla^2_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

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

[Abstract] Evaluate \(\nabla_{\bf x,y} \log \pi({\bf x}\vert{\bf y})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • y (ndarray [\(m,d_y\)]) – conditioning values \({\bf Y}={\bf y}\)
  • 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

\(\nabla_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

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

[Abstract] Evaluate \(\nabla^2_{\bf x,y} \log \pi({\bf x}\vert{\bf y})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • y (ndarray [\(m,d_y\)]) – conditioning values \({\bf Y}={\bf y}\)
  • 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,d\)]) – values of

\(\nabla^2_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

log_pdf(x, y, params=None, idxs_slice=slice(None, None, None), **kwargs)[source]

[Abstract] Evaluate \(\log \pi({\bf x}\vert{\bf y})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • y (ndarray [\(m,d_y\)]) – conditioning values \({\bf Y}={\bf y}\)
  • 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\)]) – values of \(\log\pi\)

at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

mean_log_pdf(y)[source]

[Abstract] Evaluate \(\mathbb{E}_{\pi}[\log \pi]\)

Parameters:y (ndarray [\(d_y\)]) – conditioning values \({\bf Y}={\bf y}\)
Returns:(float) – \(\mathbb{E}_{\pi}[\log \pi]\)
Raises:NotImplementedError – the method needs to be defined in the sub-classes
pdf(x, y, params=None, idxs_slice=slice(None, None, None), cache=None)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • y (ndarray [\(d_y\)]) – conditioning values \({\bf Y}={\bf y}\)
  • 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].
  • cache (dist) – cache
Returns:

(ndarray [\(m\)]) – values of \(\pi\)

at the x points.

Raises:

NotImplementedError – the method calls :fun:`log_pdf`

quadrature(qtype, qparams, y, mass, *args, **kwargs)[source]

[Abstract] Generate quadrature points and weights.

Parameters:
  • qtype (int) – quadrature type number. The different types are defined in the associated sub-classes.
  • qparams (object) – inputs necessary to the generation of the selected quadrature
  • y (ndarray [\(d_y\)]) – conditioning values \({\bf Y}={\bf y}\)
  • mass (float) – total mass of the quadrature (1 for probability measures)
Returns:

(tuple (ndarray [\(m,d\)],

ndarray [\(m\)])) – list of quadrature points and weights

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

rvs(m, y, *args, **kwargs)[source]

[Abstract] Generate \(m\) samples from the distribution.

Parameters:
  • m (int) – number of samples to generate
  • y (ndarray [\(d_y\)]) – conditioning values \({\bf Y}={\bf y}\)
Returns:

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

\(d\)-dimensional samples

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

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

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • y (ndarray [\(m,d_y\)]) – conditioning values \({\bf Y}={\bf y}\)
  • 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].
  • cache (dist) – cache
Returns:

(tuple) – containing

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

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

class TransportMaps.Distributions.DistributionFromSamples(samples, weights=None, qtype=0)[source]

Arbitrary density built from samples

Parameters:samples (type, dimension?) – independent samples
kde(x, params=None)[source]

Evaluate \(\pi(x)\)

quadrature(qtype, qparams, *args, **kwargs)[source]

[Abstract] Generate quadrature points and weights.

Parameters:
  • qtype (int) – quadrature type number. The different types are defined in the associated sub-classes.
  • qparams (object) – inputs necessary to the generation of the selected quadrature
  • mass (float) – total mass of the quadrature (1 for probability measures)
Returns:

(tuple (ndarray [\(m,d\)],

ndarray [\(m\)])) – list of quadrature points and weights

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

rvs(m, *args, **kwargs)[source]

[Abstract] Generate \(m\) samples from the distribution.

Parameters:m (int) – number of samples to generate
Returns:
(ndarray [\(m,d\)]) – \(m\)
\(d\)-dimensional samples
Raises:NotImplementedError – the method needs to be defined in the sub-classes
class TransportMaps.Distributions.FactorizedDistribution(factors)[source]

Distribution \(\nu_\pi\) defiened by its conditional factors.

The density of the distribution \(\nu_\pi\) is defined by

\[\pi({\bf x}) = \prod_{({\bf i},{\bf k}) \in \mathcal{I}} \pi({\bf x}_{\bf i},{\bf x}_{\bf k})`\]
Parameters:factors (list of tuple) – each tuple contains a factor (ConditionalDistribution and/or Distribution), and two lists containing the list of marginal variables and conditioning variables

Example

Let \(\pi(x_0,x_1,x_2) = \pi_1(x_2|x_1,x_0) \pi_2(x_0|x_1) \pi_3(x_1)\).

>>> factors = [(p1, [2], [1,0] ),
>>>            (p2, [0], [1]  ),
>>>            (p3, [1], []    )]
>>> pi = FactorizedDistribution(factors)
action_hess_x_log_pdf(x, dx, params=None, idxs_slice=slice(None, None, None), cache=None)[source]

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

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].
  • cache (dict) – cache
Returns:

(ndarray [\(m,d,d\)]) – values of

\(\nabla^2_x\log\pi\) at the x points.

append(factor)[source]

Add a new factor to the distribution

Parameters:factor (tuple) – tuple containing a factor (ConditionalDistribution and/or Distribution), and two tuples with the list of marginal variables and conditioning variables

Example

Let \(\pi(x_0,x_1,x_2) = \pi_1(x_2|x_1,x_0) \pi_2(x_0|x_1) \pi_3(x_1)\) and let’s add the factor \(\pi_4(x_3|x_0,x_1,x_2)\), obtaining:

\[\pi(x_0,x_1,x_2,x_3) = \pi_4(x_3|x_0,x_1,x_2)\pi_1(x_2|x_1,x_0) \pi_2(x_0|x_1) \pi_3(x_1)\]
>>> factor = (pi4, [3], [0,1,2])
>>> pi.append(factor)
grad_x_log_pdf(x, params=None, idxs_slice=slice(None, None, None), cache=None)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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].
  • cache (dict) – cache
Returns:

(ndarray [\(m,d\)]) – values of

\(\nabla_x\log\pi\) at the x points.

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

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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].
  • cache (dict) – cache
Returns:

(ndarray [\(m,d,d\)]) – values of

\(\nabla^2_x\log\pi\) at the x points.

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

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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].
  • cache (dict) – cache
Returns:

(ndarray [\(m\)]) – values of \(\log\pi\)

at the x points.

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

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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].
  • cache (dict) – cache
Returns:

(tuple) – function and gradient evaluation

class TransportMaps.Distributions.FrozenDistribution_1d[source]

[Abstract] Generic frozen distribution 1d

action_hess_x_log_pdf(x, dx, *args, **kwargs)[source]

[Abstract] 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\).

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

quadrature(qtype, qparams, mass=1, **kwargs)[source]

Generate quadrature points and weights.

Types of quadratures:

Monte-Carlo (qtype==0)
qparams: (int) – number of samples
Quasi-Monte-Carlo (qtype==1)
qparams: (int) – number of samples
Latin-Hypercube-Sampling (qtype==2)
qparams: (int) – number of samples
Gauss-quadrature (qtype==3)
qparams: (list [\(d\)]) – orders for each dimension
rvs(n, *args, **kwargs)[source]

[Abstract] Generate \(m\) samples from the distribution.

Parameters:m (int) – number of samples to generate
Returns:
(ndarray [\(m,d\)]) – \(m\)
\(d\)-dimensional samples
Raises:NotImplementedError – the method needs to be defined in the sub-classes
class TransportMaps.Distributions.GaussianDistribution(mu, sigma=None, precision=None)[source]

Multivariate Gaussian distribution \(\pi\)

Parameters:
  • mu (ndarray [\(d\)]) – mean vector
  • sigma (ndarray [\(d,d\)]) – covariance matrix
  • precision (ndarray [\(d,d\)]) – precision matrix
action_hess_x_log_pdf(x, dx, *args, **kwargs)[source]

Evaluate \(\langle \nabla^2_{\bf x} \log \pi({\bf x}), \delta{\bf x}\rangle\)

grad_x_log_pdf(x, *args, **kwargs)[source]

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

hess_x_log_pdf(x, *args, **kwargs)[source]

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

log_pdf(x, *args, **kwargs)[source]

Evaluate \(\log\pi(x)\)

mean_log_pdf()[source]

Evaluate \(\mathbb{E}_{\pi}[\log \pi]\).

pdf(x, *args, **kwargs)[source]

Evaluate \(\pi(x)\)

quadrature(qtype, qparams, mass=1.0, **kwargs)[source]

Generate quadrature points and weights.

Types of quadratures:

Monte-Carlo (qtype==0)
qparams: (int) – number of samples
Quasi-Monte-Carlo (qtype==1)
qparams: (int) – number of samples
Latin-Hypercube-Sampling (qtype==2)
qparams: (int) – number of samples
Gauss-quadrature (qtype==3)
qparams: (list [\(d\)]) – orders for each dimension
rvs(m, *args, **kwargs)[source]

Generate \(m\) samples from the distribution.

Parameters:m (int) – number of samples
Returns:(ndarray [\(m,d\)]) – samples
class TransportMaps.Distributions.StandardNormalDistribution(dim)[source]

Multivariate Standard Normal distribution \(\pi\).

Parameters:d (int) – dimension
get_component(avars)[source]

Return the measure \(\nu_{a_1}\times\cdots\times\nu_{a_k} = \mathcal{N}(0,{\bf I}_k)\)

Parameters:avars (list) – list of coordinates to extract from \(\nu\)
rvs(m, *args, **kwargs)[source]

Generate \(m\) samples from the distribution.

Parameters:m (int) – number of samples
Returns:(ndarray [\(m,d\)]) – samples
class TransportMaps.Distributions.ChainGraphGaussianDistribution(dim, edge_strength=0.45)[source]
rvs(m)[source]

Generate \(m\) samples from the distribution.

Parameters:m (int) – number of samples
Returns:(ndarray [\(m,d\)]) – samples
class TransportMaps.Distributions.StarGraphGaussianDistribution(dim, edge_strength=0.45)[source]
rvs(m)[source]

Generate \(m\) samples from the distribution.

Parameters:m (int) – number of samples
Returns:(ndarray [\(m,d\)]) – samples
class TransportMaps.Distributions.GridGraphGaussianDistribution(dim, edge_strength=1.0)[source]
rvs(m)[source]

Generate \(m\) samples from the distribution.

Parameters:m (int) – number of samples
Returns:(ndarray [\(m,d\)]) – samples
class TransportMaps.Distributions.LogNormalDistribution(s, mu, scale)[source]
grad_x_log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\nabla_{\bf x} \log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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

\(\nabla_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

hess_x_log_pdf(x, *args, **kwargs)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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,d\)]) – values of

\(\nabla^2_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\log\pi\)

at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

pdf(x, *args, **kwargs)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\pi\)

at the x points.

Raises:

NotImplementedError – the method calls :fun:`log_pdf`

rvs(n, *args, **kwargs)[source]

[Abstract] Generate \(m\) samples from the distribution.

Parameters:m (int) – number of samples to generate
Returns:
(ndarray [\(m,d\)]) – \(m\)
\(d\)-dimensional samples
Raises:NotImplementedError – the method needs to be defined in the sub-classes
class TransportMaps.Distributions.LogisticDistribution(mu, s)[source]
grad_x_log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\nabla_{\bf x} \log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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

\(\nabla_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

hess_x_log_pdf(x, *args, **kwargs)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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,d\)]) – values of

\(\nabla^2_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\log\pi\)

at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

pdf(x, *args, **kwargs)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\pi\)

at the x points.

Raises:

NotImplementedError – the method calls :fun:`log_pdf`

rvs(n, *args, **kwargs)[source]

[Abstract] Generate \(m\) samples from the distribution.

Parameters:m (int) – number of samples to generate
Returns:
(ndarray [\(m,d\)]) – \(m\)
\(d\)-dimensional samples
Raises:NotImplementedError – the method needs to be defined in the sub-classes
class TransportMaps.Distributions.GammaDistribution(kappa, theta)[source]
grad_x_log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\nabla_{\bf x} \log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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

\(\nabla_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

hess_x_log_pdf(x, *args, **kwargs)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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,d\)]) – values of

\(\nabla^2_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\log\pi\)

at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

pdf(x, *args, **kwargs)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\pi\)

at the x points.

Raises:

NotImplementedError – the method calls :fun:`log_pdf`

rvs(n, *args, **kwargs)[source]

[Abstract] Generate \(m\) samples from the distribution.

Parameters:m (int) – number of samples to generate
Returns:
(ndarray [\(m,d\)]) – \(m\)
\(d\)-dimensional samples
Raises:NotImplementedError – the method needs to be defined in the sub-classes
class TransportMaps.Distributions.BetaDistribution(alpha, beta)[source]
grad_x_log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\nabla_{\bf x} \log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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

\(\nabla_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

hess_x_log_pdf(x, *args, **kwargs)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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,d\)]) – values of

\(\nabla^2_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\log\pi\)

at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

pdf(x, *args, **kwargs)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\pi\)

at the x points.

Raises:

NotImplementedError – the method calls :fun:`log_pdf`

rvs(n, *args, **kwargs)[source]

[Abstract] Generate \(m\) samples from the distribution.

Parameters:m (int) – number of samples to generate
Returns:
(ndarray [\(m,d\)]) – \(m\)
\(d\)-dimensional samples
Raises:NotImplementedError – the method needs to be defined in the sub-classes
class TransportMaps.Distributions.WeibullDistribution(c, mu=0.0, sigma=1.0)[source]
grad_x_log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\nabla_{\bf x} \log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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

\(\nabla_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

hess_x_log_pdf(x, *args, **kwargs)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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,d\)]) – values of

\(\nabla^2_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\log\pi\)

at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

pdf(x, *args, **kwargs)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\pi\)

at the x points.

Raises:

NotImplementedError – the method calls :fun:`log_pdf`

rvs(n, *args, **kwargs)[source]

[Abstract] Generate \(m\) samples from the distribution.

Parameters:m (int) – number of samples to generate
Returns:
(ndarray [\(m,d\)]) – \(m\)
\(d\)-dimensional samples
Raises:NotImplementedError – the method needs to be defined in the sub-classes
class TransportMaps.Distributions.CauchyDistribution(loc, scale)[source]
log_pdf(x, params=None)[source]

[Abstract] Evaluate \(\log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\log\pi\)

at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

pdf(x, params=None)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\pi\)

at the x points.

Raises:

NotImplementedError – the method calls :fun:`log_pdf`

quadrature(qtype, qparams)[source]

Generate quadrature points and weights.

Types of quadratures:

Monte-Carlo (qtype==0)
qparams: (int) – number of samples
Quasi-Monte-Carlo (qtype==1)
qparams: (int) – number of samples
Latin-Hypercube-Sampling (qtype==2)
qparams: (int) – number of samples
Gauss-quadrature (qtype==3)
qparams: (list [\(d\)]) – orders for each dimension
rvs(n)[source]

[Abstract] Generate \(m\) samples from the distribution.

Parameters:m (int) – number of samples to generate
Returns:
(ndarray [\(m,d\)]) – \(m\)
\(d\)-dimensional samples
Raises:NotImplementedError – the method needs to be defined in the sub-classes
class TransportMaps.Distributions.GumbelDistribution(mu, beta)[source]
grad_x_log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\nabla_{\bf x} \log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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

\(\nabla_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

hess_x_log_pdf(x, *args, **kwargs)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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,d\)]) – values of

\(\nabla^2_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\log\pi\)

at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

pdf(x, *args, **kwargs)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\pi\)

at the x points.

Raises:

NotImplementedError – the method calls :fun:`log_pdf`

rvs(n, *args, **kwargs)[source]

[Abstract] Generate \(m\) samples from the distribution.

Parameters:m (int) – number of samples to generate
Returns:
(ndarray [\(m,d\)]) – \(m\)
\(d\)-dimensional samples
Raises:NotImplementedError – the method needs to be defined in the sub-classes
class TransportMaps.Distributions.BananaDistribution(a, b, mu, sigma2)[source]
class TransportMaps.Distributions.StudentTDistribution(df, mu=0.0, sigma=1.0)[source]
grad_x_log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\nabla_{\bf x} \log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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

\(\nabla_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

hess_x_log_pdf(x, *args, **kwargs)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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,d\)]) – values of

\(\nabla^2_x\log\pi\) at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\log\pi\)

at the x points.

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

pdf(x, *args, **kwargs)[source]

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

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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\)]) – values of \(\pi\)

at the x points.

Raises:

NotImplementedError – the method calls :fun:`log_pdf`

rvs(n, *args, **kwargs)[source]

[Abstract] Generate \(m\) samples from the distribution.

Parameters:m (int) – number of samples to generate
Returns:
(ndarray [\(m,d\)]) – \(m\)
\(d\)-dimensional samples
Raises:NotImplementedError – the method needs to be defined in the sub-classes
class TransportMaps.Distributions.ConditionallyGaussianDistribution(mu, sigma=None, precision=None, coeffs=None)[source]

Multivariate Gaussian distribution \(\pi({\bf x}\vert{\bf y}) \sim \mathcal{N}(\mu({\bf y}), \Sigma({\bf y}))\)

Parameters:
  • mu (Map) – mean vector map
  • sigma (Map) – covariance matrix map
  • precision (Map) – precision matrix map
  • coeffs (ndarray) – fix the coefficients \({\bf y}\)
grad_x_log_pdf(x, y, params=None, idxs_slice=slice(None, None, None), cache=None)[source]

Evaluate \(\nabla_{\bf x,y} \log \pi({\bf x}\vert{\bf y})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • y (ndarray [\(m,d_y\)]) – conditioning values \({\bf Y}={\bf y}\)
  • 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].
  • cache (dict) – cache
Returns:

(ndarray [\(m,d\)]) – values of

\(\nabla_x\log\pi\) at the x points.

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

Evaluate \(\log \pi({\bf x}\vert{\bf y})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • y (ndarray [\(m,d_y\)] or ndarray [\(d_y\)]) – conditioning values \({\bf Y}={\bf y}\). In the second case one conditioning value is used for all the \(m\) points \({\bf x}\)
  • 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].
  • cache (dict) – cache
Returns:

(ndarray [\(m\)]) – values of \(\log\pi\)

at the x points.

rvs(m, y=None, **kwargs)[source]

Generate \(m\) samples from the distribution.

Parameters:
  • m (int) – number of samples to generate
  • y (ndarray [\(d_y\)]) – conditioning values \({\bf Y}={\bf y}\)
Returns:

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

\(d\)-dimensional samples

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

class TransportMaps.Distributions.MeanConditionallyGaussianDistribution(mu, sigma=None, precision=None, coeffs=None)[source]

Multivariate Gaussian distribution \(\pi({\bf x}\vert{\bf y}) \sim \mathcal{N}(\mu({\bf y}), \Sigma)\)

Parameters:
  • mu (Map) – mean vector map
  • sigma (ndarray) – covariance matrix map
  • precision (ndarray) – precision matrix map
  • coeffs (ndarray) – fix the coefficients \({\bf y}\)
grad_x_log_pdf(x, y, params=None, idxs_slice=slice(None, None, None), cache=None)[source]

Evaluate \(\nabla_{\bf x,y} \log \pi({\bf x}\vert{\bf y})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • y (ndarray [\(m,d_y\)]) – conditioning values \({\bf Y}={\bf y}\)
  • 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].
  • cache (dict) – cache
Returns:

(ndarray [\(m,d\)]) – values of

\(\nabla_x\log\pi\) at the x points.

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

Evaluate \(\log \pi({\bf x}\vert{\bf y})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • y (ndarray [\(m,d_y\)] or ndarray [\(d_y\)]) – conditioning values \({\bf Y}={\bf y}\). In the second case one conditioning value is used for all the \(m\) points \({\bf x}\)
  • 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].
  • cache (dict) – cache
Returns:

(ndarray [\(m\)]) – values of \(\log\pi\)

at the x points.

rvs(m, y=None, **kwargs)[source]

Generate \(m\) samples from the distribution.

Parameters:
  • m (int) – number of samples to generate
  • y (ndarray [\(d_y\)]) – conditioning values \({\bf Y}={\bf y}\)
Returns:

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

\(d\)-dimensional samples

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

class TransportMaps.Distributions.ParametricDistribution(dim)[source]

Parametric distribution \(\pi_{\bf a}\).

coeffs

[Abstract] Get the coefficients \({\bf a}\) of the distribution

Returns:(ndarray [\(N\)]) – coefficients
Raises:NotImplementedError – the method needs to be defined in the sub-classes
grad_a_log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\nabla_{\bf a} \log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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,N\)]) – \(\nabla_{\bf a} \log \pi({\bf x})\)

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

hess_a_log_pdf(x, *args, **kwargs)[source]

[Abstract] Evaluate \(\nabla^2_{\bf a} \log \pi({\bf x})\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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,N\)]) – \(\nabla^2_{\bf a} \log \pi({\bf x})\)

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

minimize_kl_divergence(tar, *args, **kwargs)[source]

[Abstract] Solve \(\arg \min_{\bf a}\mathcal{D}_{KL}(\pi_{\bf a}, \pi_{\rm tar})\)

Parameters:tar (Distribution) – target distribution
Raises:NotImplementedError – the method needs to be defined in the sub-classes
n_coeffs

[Abstract] Get the number \(N\) of coefficients

Returns:(int) – number of coefficients.
Raises:NotImplementedError – the method needs to be defined in the sub-classes
tuple_grad_a_log_pdf(x, params=None, idxs_slice=slice(None, None, None), cache=None)[source]

[Abstract] Evaluate \(\left(\log \pi({\bf x}), \nabla_{\bf a} \log \pi({\bf x})\right)\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • 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].
  • cache (dict) – cache
Returns:

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

Raises:

NotImplementedError – the method needs to be defined in the sub-classes

class TransportMaps.Distributions.TransportMapDistribution(transport_map, base_distribution)[source]

Abstract class for densities of the transport map type (\(T^\sharp \pi\) or \(T_\sharp \pi\))

Parameters:
coeffs

Get the coefficients \({\bf a}\) of the distribution

map_samples_base_to_target(x, mpi_pool=None)[source]

[Abstract] Map input samples (assumed to be from \(\pi\)) to the corresponding samples from \(T^\sharp \pi\) or \(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]

[Abstract] Map input samples (assumed to be from \(T^\sharp \pi\) or \(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

n_coeffs

Get the number \(N\) of coefficients

quadrature(qtype, qparams, mass=1.0, mpi_pool=None)[source]

Generate quadrature points and weights.

Parameters:
  • qtype (int) – quadrature type number. The different types are defined in the associated sub-classes.
  • qparams (object) – inputs necessary to the generation of the selected quadrature
  • mass (float) – total mass of the quadrature (1 for probability measures)
  • mpi_pool (mpi_map.MPI_Pool) – pool of processes
Returns:

(tuple (ndarray [\(m,d\)],

ndarray [\(m\)])) – list of quadrature points and weights

rvs(m, mpi_pool=None, batch_size=None)[source]

Generate \(m\) samples from the distribution.

Parameters:
  • m (int) – number of samples to generate
  • mpi_pool (mpi_map.MPI_Pool) – pool of processes
  • batch_size (int) – whether to generate samples in batches
Returns:

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

\(d\)-dimensional samples

class TransportMaps.Distributions.PushForwardTransportMapDistribution(transport_map, base_distribution)[source]

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

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

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

Evaluate \(\nabla_{\bf a} \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

\(\nabla_{\bf a} \log T_\sharp \pi\) at the x points.

grad_x_log_pdf(x, params=None, idxs_slice=slice(None, None, 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.

hess_x_log_pdf(x, params=None, idxs_slice=slice(None, None, 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.

log_pdf(x, params=None, idxs_slice=slice(None, None, 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.

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

minimize_kl_divergence(tar, qtype, qparams, parbase=None, partar=None, x0=None, regularization=None, tol=0.0001, maxit=100, ders=2, fungrad=False, hessact=False, batch_size=None, mpi_pool=None, grad_check=False, hess_check=False)[source]

Solve \(\arg \min_{\bf a}\mathcal{D}_{KL}\left((T_\sharp \pi)_{\bf a}, \pi_{\rm tar}\right)\)

The minimization is not directly done on the original problem, but on the equivalent problem

\[\arg \min_{\bf a}\mathcal{D}_{KL}\left(\pi, (T^\sharp\pi_{\rm tar})_{\bf a}\right) \;.\]
Parameters:
  • tar (Distribution) – target distribution \(\pi_{\rm tar}\)
  • qtype (int) – quadrature type number provided by \(\pi\)
  • qparams (object) – inputs necessary to the generation of the selected quadrature
  • partar (dict) – parameters for the evaluation of \(\pi_{\rm tar}\)
  • parbase (dict) – parameters for the evaluation of \(\pi\)
  • x0 (ndarray [\(N\)]) – coefficients to be used as initial values for the optimization
  • regularization (dict) – defines the regularization to be used. If None, no regularization is applied. If key type=='L2' then applies Tikonhov regularization with coefficient in key alpha.
  • tol (float) – tolerance to be used to solve the KL-divergence problem.
  • maxit (int) – maximum number of iterations
  • ders (int) – order of derivatives available for the solution of the optimization problem. 0 -> derivative free, 1 -> gradient, 2 -> hessian.
  • fungrad (bool) – whether the target distribution provide the method Distribution.tuple_grad_x_log_pdf() computing the evaluation and the gradient in one step. This is used only for ders==1.
  • hessact (bool) – use the action of the Hessian. The target distribution must implement the function Distribution.action_hess_x_log_pdf().
  • batch_size (list [3 or 2] of int) – the list contains the size of the batch to be used for each iteration. A size 1 correspond to a completely non-vectorized evaluation. A size None correspond to a completely vectorized one.
  • mpi_pool (mpi_map.MPI_Pool) – pool of processes
  • grad_check (bool) – whether to use finite difference to check the correctness of of the gradient
  • hess_check (bool) – whether to use finite difference to check the correctenss of the Hessian
Returns:

log informations from the solver

Return type:

log (dict)

pdf(x, params=None, idxs_slice=slice(None, None, 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.

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

Evaluate \(\left(\log T_\sharp \pi({\bf x}), \nabla_{\bf a} \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].
  • cache (dict) – cache
Returns:

(tuple) –

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

tuple_grad_x_log_pdf(x, params=None, idxs_slice=slice(None, None, 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)\)

class TransportMaps.Distributions.PullBackTransportMapDistribution(transport_map, base_distribution)[source]

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

Parameters:
action_hess_a_log_pdf(x, da, params=None, idxs_slice=slice(None, None, None), cache=None)[source]

Evaluate \(\langle\nabla^2_{\bf a} \log T^\sharp \pi({\bf x}), \delta{\bf a}\rangle\)

Parameters:
  • x (ndarray [\(m,d\)]) – evaluation points
  • da (ndarray [\(N\)]) – 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].
  • cache (dict) – cache
Returns:

(ndarray [\(m\)]) – values of

\(\langle\nabla^2_{\bf a} \log T^\sharp \pi({\bf x}), \delta{\bf a}\rangle\) 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 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.

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

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

Parameters:
  • x (ndarray [\(m,n,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,n,d,d\)]) – values of

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

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

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

Parameters:
  • x (ndarray [\(m,n\)]) – 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,n\)]) – values of

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

grad_x_log_pdf(x, params=None, idxs_slice=slice(None, None, 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.

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

Evaluate \(\nabla^2_{\bf a} \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

\(\nabla^2_{\bf a} \log T^\sharp \pi\) at the x points.

hess_x_log_pdf(x, params=None, idxs_slice=slice(None, None, 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.

log_pdf(x, params=None, idxs_slice=slice(None, None, 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.

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

minimize_kl_divergence(tar, qtype, qparams, parbase=None, partar=None, x0=None, regularization=None, tol=0.0001, maxit=100, ders=2, fungrad=False, hessact=False, batch_size=None, mpi_pool=None, grad_check=False, hess_check=False)[source]

Solve \(\arg \min_{\bf a}\mathcal{D}_{KL}\left((T^\sharp \pi)_{\bf a}, \pi_{\rm tar}\right)\)

The minimization is not directly done on the original problem, but on the equivalent problem

\[\arg \min_{\bf a}\mathcal{D}_{KL}\left(\pi, (T_\sharp\pi_{\rm tar})_{\bf a}\right) \;.\]
Parameters:
  • tar (Distribution) – target distribution \(\pi_{\rm tar}\)
  • qtype (int) – quadrature type number provided by \(\pi\)
  • qparams (object) – inputs necessary to the generation of the selected quadrature
  • partar (dict) – parameters for the evaluation of \(\pi_{\rm tar}\)
  • parbase (dict) – parameters for the evaluation of \(\pi\)
  • x0 (ndarray [\(N\)]) – coefficients to be used as initial values for the optimization
  • regularization (dict) – defines the regularization to be used. If None, no regularization is applied. If key type=='L2' then applies Tikonhov regularization with coefficient in key alpha.
  • tol (float) – tolerance to be used to solve the KL-divergence problem.
  • maxit (int) – maximum number of iterations
  • ders (int) – order of derivatives available for the solution of the optimization problem. 0 -> derivative free, 1 -> gradient, 2 -> Hessian
  • fungrad (bool) – whether the target distribution provides the method Distribution.tuple_grad_x_log_pdf() computing the evaluation and the gradient in one step. This is used only for ders==1.
  • hessact (bool) – use the action of the Hessian. The target distribution must implement the function Distribution.action_hess_x_log_pdf().
  • batch_size (list [3 or 2] of int) – the list contains the size of the batch to be used for each iteration. A size 1 correspond to a completely non-vectorized evaluation. A size None correspond to a completely vectorized one.
  • mpi_pool (mpi_map.MPI_Pool) – pool of processes
  • grad_check (bool) – whether to use finite difference to check the correctness of of the gradient
  • hess_check (bool) – whether to use finite difference to check the correctenss of the Hessian
Returns:

log informations from the solver

Return type:

log (dict)

pdf(x, params=None, idxs_slice=slice(None, None, 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.

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

Evaluate \(\left(\log T^\sharp \pi({\bf x}), \nabla_{\bf a} \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].
  • cache (dict) – cache
Returns:

(tuple) –

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

tuple_grad_x_log_pdf(x, params=None, idxs_slice=slice(None, None, 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)\)