TransportMaps.Distributions.FrozenDistributions

Module Contents

Classes

FrozenDistribution_1d

[Abstract] Generic frozen distribution 1d

StandardNormalDistribution

Multivariate Standard Normal distribution \(\pi\).

NormalDistribution

Multivariate Gaussian distribution \(\mathcal{N}(\mu,\Sigma)\)

ChainGraphGaussianDistribution

Multivariate Gaussian distribution \(\pi\)

StarGraphGaussianDistribution

Multivariate Gaussian distribution \(\pi\)

GridGraphGaussianDistribution

Multivariate Gaussian distribution \(\pi\)

LogNormalDistribution

[Abstract] Generic frozen distribution 1d

LogisticDistribution

[Abstract] Generic frozen distribution 1d

GammaDistribution

[Abstract] Generic frozen distribution 1d

BetaDistribution

[Abstract] Generic frozen distribution 1d

UniformDistribution

Abstract distribution \(\nu_\pi\).

GumbelDistribution

[Abstract] Generic frozen distribution 1d

WeibullDistribution

[Abstract] Generic frozen distribution 1d

CauchyDistribution

[Abstract] Generic frozen distribution 1d

StudentTDistribution

[Abstract] Generic frozen distribution 1d

BananaDistribution

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

class TransportMaps.Distributions.FrozenDistributions.FrozenDistribution_1d[source]

Bases: TransportMaps.Distributions.DistributionBase.Distribution

[Abstract] Generic frozen distribution 1d

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

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

Sparse Grid Gauss-Hermite quadrature (qtype==4)

qparams: (list [\(d\)]) – orders for each dimension

See also

Distribution.quadrature()

tuple_grad_x_log_pdf(x, *args, **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

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

class TransportMaps.Distributions.FrozenDistributions.StandardNormalDistribution(dim)[source]

Bases: TransportMaps.Distributions.ProductDistributionBase.ProductDistribution

Multivariate Standard Normal distribution \(\pi\).

Parameters:

d (int) – dimension

property mu[source]
property sigma[source]
property precision[source]
property square_root[source]
covariance[source]
rvs(m, *args, **kwargs)[source]

Generate \(m\) samples from the distribution.

Parameters:

m (int) – number of samples

Returns:

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

See also

Distribution.rvs()

quadrature(qtype, qparams, mass=1.0, batch_size=np.inf, **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

Sparse Grid Gauss-Hermite quadrature (qtype==4)

qparams: (list [\(d\)]) – orders for each dimension

See also

Distribution.quadrature()

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

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

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

See also

Distribution.log_pdf()

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

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

See also

Distribution.grad_x_log_pdf()

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

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

See also

Distribution.grad_x_log_pdf()

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

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

See also

Distribution.hess_x_log_pdf()

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

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

See also

Distribution.action_hess_x_log_pdf()

solve_square_root(y)[source]

Solve \(\Sigma^{\frac{1}{2}}{\bf x} = {\bf y}\) (\({\bf x}={\bf y}\) for Standard Normal).

solve_square_root_transpose(y)[source]

Solve \(\Sigma^{\frac{\top}{2}}{\bf x} = {\bf y}\) (\({\bf x}={\bf y}\) for Standard Normal).

solve_sigma(y)[source]

Solve \(\Sigma{\bf x} = {\bf y}\) (\({\bf x}={\bf y}\) for Standard Normal).

mean_log_pdf()[source]

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

See also

Distribution.mean_log_pdf()

class TransportMaps.Distributions.FrozenDistributions.NormalDistribution(mu, covariance=None, precision=None, square_root_covariance=None, square_root_precision=None, square_root_type='sym')[source]

Bases: TransportMaps.Distributions.TransportMapDistributions.PushForwardTransportMapDistribution

Multivariate Gaussian distribution \(\mathcal{N}(\mu,\Sigma)\)

Parameters:
  • mu (ndarray [\(d\)]) – mean vector \(\mu\)

  • covariance (ndarray [\(d,d\)]) – covariance matrix \(\Sigma\)

  • precision (ndarray [\(d,d\)]) – precision matrix \(\Sigma^{-1}\)

  • square_root_covariance (ndarray [\(d,d\)]) – square root \(\Sigma^{\frac{1}{2}}\)

  • square_root_precision (ndarray [\(d,d\)]) – square root \(\Sigma^{-\frac{1}{2}}\)

  • square_root_type (str) – type of square root to be used in case covariance or precision``were provided. For ``square_root_type=='sym', \(L=U\Lambda^{\frac{1}{2}}U^T\) where \(\Sigma = U\Lambda U^T\) is the eigenvalue decomposition of \(\Sigma\). For square_root_type=='tri' or square_root_type=='chol', :maht:`L=C` where \(\Sigma=CC^T\) is the Cholesky decomposition of \(\Sigma\). For square_root_type=='kl', \(L=U\Lambda^{\frac{1}{2}}\) where \(\Sigma = U\Lambda U^T\) is the eigenvalue decomposition of \(\Sigma\) (this corresponds to the Karuenen-Loeve expansion). The eigenvalues and eigenvectors are ordered with \(\lambda_i\geq\lambda_{i+1}\). If the parameter square_root is provided, then the square_root_type attribute will be set user.

Note

The arguments covariance, precision and square_root are mutually exclusive.

property mu[source]
property covariance[source]
property sigma[source]
property precision[source]
property inv_sigma[source]
property square_root_covariance[source]
property square_root[source]
property sampling_mat[source]
property square_root_precision[source]
property square_root_type[source]
property log_det_covariance[source]
property log_det_square_root_covariance[source]
property log_det_precision[source]
property log_det_square_root_precision[source]
property log_det_sigma[source]
_square_root_covariance_from_covariance(square_root_type='sym')[source]

Factorizes the covariance and returns its square root

Kwargs:
square_root_type (str): type of square root.

For square_root_type=='sym', \(L=U\Lambda^{\frac{1}{2}}U^T\) where \(\Sigma = U\Lambda U^T\) is the eigenvalue decomposition of \(\Sigma\). For square_root_type=='tri' or square_root_type=='chol', :maht:`L=C` where \(\Sigma=CC^T\) is the Cholesky decomposition of \(\Sigma\). For square_root_type=='kl', \(L=U\Lambda^{\frac{1}{2}}\) where \(\Sigma = U\Lambda U^T\) is the eigenvalue decomposition of \(\Sigma\) (this corresponds to the Karuenen-Loeve expansion). The eigenvalues and eigenvectors are ordered with \(\lambda_i\geq\lambda_{i+1}\).

Returns:

\(L\) – square root of covariance

_square_root_precision_from_covariance(square_root_type='sym')[source]

Factorizes the covariance and returns the square root of the precision

Kwargs:
square_root_type (str): type of square root.

For square_root_type=='sym', \(L=U\Lambda^{\frac{1}{2}}U^T\) where \(\Sigma = U\Lambda U^T\) is the eigenvalue decomposition of \(\Sigma\). For square_root_type=='tri' or square_root_type=='chol', :maht:`L=C` where \(\Sigma=CC^T\) is the Cholesky decomposition of \(\Sigma\). For square_root_type=='kl', \(L=U\Lambda^{\frac{1}{2}}\) where \(\Sigma = U\Lambda U^T\) is the eigenvalue decomposition of \(\Sigma\) (this corresponds to the Karuenen-Loeve expansion). The eigenvalues and eigenvectors are ordered with \(\lambda_i\geq\lambda_{i+1}\).

Returns:

\(L^{-1}\) – square root of precision

_square_root_precision_from_precision(square_root_type='sym')[source]

Factorizes the precision and returns its square root

Parameters:

precision (ndarray [\(d,d\)]) – precision matrix \(\Sigma^{-1}\)

Kwargs:
square_root_type (str): type of square root.

For square_root_type=='sym', \(L=U\Lambda^{\frac{1}{2}}U^T\) where \(\Sigma = U\Lambda U^T\) is the eigenvalue decomposition of \(\Sigma\). For square_root_type=='tri' or square_root_type=='chol', :maht:`L=C` where \(\Sigma=CC^T\) is the Cholesky decomposition of \(\Sigma\). For square_root_type=='kl', \(L=U\Lambda^{\frac{1}{2}}\) where \(\Sigma = U\Lambda U^T\) is the eigenvalue decomposition of \(\Sigma\) (this corresponds to the Karuenen-Loeve expansion). The eigenvalues and eigenvectors are ordered with \(\lambda_i\geq\lambda_{i+1}\).

Returns:

\(L^{-1}\) – square root of the precision

_square_root_covariance_from_precision(square_root_type='sym')[source]

Factorizes the precision and returns the square root of the covariance

Parameters:

precision (ndarray [\(d,d\)]) – precision matrix \(\Sigma^{-1}\)

Kwargs:
square_root_type (str): type of square root.

For square_root_type=='sym', \(L=U\Lambda^{\frac{1}{2}}U^T\) where \(\Sigma = U\Lambda U^T\) is the eigenvalue decomposition of \(\Sigma\). For square_root_type=='tri' or square_root_type=='chol', :maht:`L=C` where \(\Sigma=CC^T\) is the Cholesky decomposition of \(\Sigma\). For square_root_type=='kl', \(L=U\Lambda^{\frac{1}{2}}\) where \(\Sigma = U\Lambda U^T\) is the eigenvalue decomposition of \(\Sigma\) (this corresponds to the Karuenen-Loeve expansion). The eigenvalues and eigenvectors are ordered with \(\lambda_i\geq\lambda_{i+1}\).

Returns:

\(L\) – square root of the covariance

solve_square_root_covariance(y)[source]

Solve \(\Sigma^{\frac{1}{2}}{\bf x} = {\bf y}\).

solve_square_root_covariance_transposed(y)[source]

Solve \(\Sigma^{\frac{\top}{2}}{\bf x} = {\bf y}\).

solve_square_root(y)[source]

Solve \(\Sigma^{\frac{1}{2}}{\bf x} = {\bf y}\).

solve_square_root_transpose(y)[source]

Solve \(\Sigma^{\frac{\top}{2}}{\bf x} = {\bf y}\).

solve_covariance(y)[source]

Solve \(\Sigma{\bf x} = {\bf y}\)

solve_sigma(y)[source]
solve_square_root_precision(y)[source]

Solve \(\Sigma^{-\frac{1}{2}}{\bf x} = {\bf y}\).

solve_square_root_precision_transposed(y)[source]

Solve \(\Sigma^{-\frac{\top}{2}}{\bf x} = {\bf y}\).

solve_precision(y)[source]

Solve \(\Sigma^{-1}{\bf x} = {\bf y}\)

mean_log_pdf()[source]

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

See also

Distribution.mean_log_pdf()

class TransportMaps.Distributions.FrozenDistributions.ChainGraphGaussianDistribution(dim, edge_strength=0.45)[source]

Bases: TransportMaps.Distributions.Deprecated.GaussianDistribution

Multivariate Gaussian distribution \(\pi\)

Parameters:
  • mu (ndarray [\(d\)]) – mean vector

  • sigma (ndarray [\(d,d\)]) – covariance matrix

  • precision (ndarray [\(d,d\)]) – precision matrix

property nonzero_idxs[source]
property graph[source]
property n_edges[source]
omega()[source]
sigma()[source]
rvs(m)[source]

Generate \(m\) samples from the distribution.

Parameters:

m (int) – number of samples

Returns:

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

See also

Distribution.rvs()

class TransportMaps.Distributions.FrozenDistributions.StarGraphGaussianDistribution(dim, edge_strength=0.45)[source]

Bases: TransportMaps.Distributions.Deprecated.GaussianDistribution

Multivariate Gaussian distribution \(\pi\)

Parameters:
  • mu (ndarray [\(d\)]) – mean vector

  • sigma (ndarray [\(d,d\)]) – covariance matrix

  • precision (ndarray [\(d,d\)]) – precision matrix

property nonzero_idxs[source]
property graph[source]
property n_edges[source]
omega()[source]
sigma()[source]
rvs(m)[source]

Generate \(m\) samples from the distribution.

Parameters:

m (int) – number of samples

Returns:

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

See also

Distribution.rvs()

class TransportMaps.Distributions.FrozenDistributions.GridGraphGaussianDistribution(dim, edge_strength=1.0)[source]

Bases: TransportMaps.Distributions.Deprecated.GaussianDistribution

Multivariate Gaussian distribution \(\pi\)

Parameters:
  • mu (ndarray [\(d\)]) – mean vector

  • sigma (ndarray [\(d,d\)]) – covariance matrix

  • precision (ndarray [\(d,d\)]) – precision matrix

property nonzero_idxs[source]
property graph[source]
property n_edges[source]
omega()[source]
zigzag(n)[source]
sigma()[source]
rvs(m)[source]

Generate \(m\) samples from the distribution.

Parameters:

m (int) – number of samples

Returns:

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

See also

Distribution.rvs()

class TransportMaps.Distributions.FrozenDistributions.LogNormalDistribution(s, mu, scale)[source]

Bases: FrozenDistribution_1d

[Abstract] Generic frozen distribution 1d

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

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`

grad_x_pdf(x, *args, **kwargs)[source]
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

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

class TransportMaps.Distributions.FrozenDistributions.LogisticDistribution(mu, s)[source]

Bases: FrozenDistribution_1d

[Abstract] Generic frozen distribution 1d

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

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`

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

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

class TransportMaps.Distributions.FrozenDistributions.GammaDistribution(kappa, theta)[source]

Bases: FrozenDistribution_1d

[Abstract] Generic frozen distribution 1d

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

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`

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

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

nabla3_x_log_pdf(x, *args, **kwargs)[source]
class TransportMaps.Distributions.FrozenDistributions.BetaDistribution(alpha, beta)[source]

Bases: FrozenDistribution_1d

[Abstract] Generic frozen distribution 1d

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

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`

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

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

nabla3_x_log_pdf(x, *args, **kwargs)[source]
class TransportMaps.Distributions.FrozenDistributions.UniformDistribution(dim=1)[source]

Bases: TransportMaps.Distributions.DistributionBase.Distribution

Abstract distribution \(\nu_\pi\).

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

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`

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

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

class TransportMaps.Distributions.FrozenDistributions.GumbelDistribution(mu, beta)[source]

Bases: FrozenDistribution_1d

[Abstract] Generic frozen distribution 1d

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

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`

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

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

nabla3_x_log_pdf(x, *args, **kwargs)[source]
class TransportMaps.Distributions.FrozenDistributions.WeibullDistribution(c, mu=0.0, sigma=1.0)[source]

Bases: FrozenDistribution_1d

[Abstract] Generic frozen distribution 1d

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

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`

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

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

class TransportMaps.Distributions.FrozenDistributions.CauchyDistribution(loc, scale)[source]

Bases: FrozenDistribution_1d

[Abstract] Generic frozen distribution 1d

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`

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

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

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

Sparse Grid Gauss-Hermite quadrature (qtype==4)

qparams: (list [\(d\)]) – orders for each dimension

See also

Distribution.quadrature()

class TransportMaps.Distributions.FrozenDistributions.StudentTDistribution(df, mu=0.0, sigma=1.0)[source]

Bases: FrozenDistribution_1d

[Abstract] Generic frozen distribution 1d

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

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`

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

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

class TransportMaps.Distributions.FrozenDistributions.BananaDistribution(a, b, mu, sigma2)[source]

Bases: TransportMaps.Distributions.TransportMapDistributions.PushForwardTransportMapDistribution

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