TransportMaps.Distributions.ConditionalDistributions

Module Contents

Classes

ConditionallyNormalDistribution

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

MeanConditionallyNormalDistribution

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

Attributes

ConditionallyGaussianDistribution

MeanConditionallyGaussianDistribution

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

Bases: TransportMaps.Distributions.ConditionalDistributionBase.ConditionalDistribution

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

property pi[source]
property mu[source]
property sigma[source]
property precision[source]
property muMap[source]
property sigmaMap[source]
property precisionMap[source]
property coeffs[source]
property grad_a_mu[source]
property grad_a_sigma[source]
property grad_a_precision[source]
get_ncalls_tree(indent='')[source]
get_nevals_tree(indent='')[source]
get_teval_tree(indent='')[source]
update_ncalls_tree(obj)[source]
update_nevals_tree(obj)[source]
update_teval_tree(obj)[source]
reset_counters()[source]
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

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.

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.

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

Bases: TransportMaps.Distributions.ConditionalDistributionBase.ConditionalDistribution

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

property pi[source]
property mu[source]
property sigma[source]
property precision[source]
property muMap[source]
property coeffs[source]
property grad_a_mu[source]
get_ncalls_tree(indent='')[source]
get_nevals_tree(indent='')[source]
get_teval_tree(indent='')[source]
update_ncalls_tree(obj)[source]
update_nevals_tree(obj)[source]
update_teval_tree(obj)[source]
reset_counters()[source]
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

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.

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.

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

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

  • cache (dict) – cache

Returns:

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

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

TransportMaps.Distributions.ConditionalDistributions.MeanConditionallyGaussianDistribution[source]