TransportMaps.Distributions.Examples.BiochemicalOxygenDemand.BODDistributions

Module Contents

Classes

BODjoint

Abstract distribution \(\nu_\pi\).

JointDistribution

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

JointDistributionLogNormalPrior

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

PosteriorDistribution

Given a log-likelihood and a prior, assemble the posterior density

PosteriorDistributionLogNormalPrior

Given a log-likelihood and a prior, assemble the posterior density

Attributes

JointDistributionUniformPrior

PosteriorDistributionUniformPrior

class TransportMaps.Distributions.Examples.BiochemicalOxygenDemand.BODDistributions.BODjoint(numY, sigma=np.sqrt(0.001), a_range=(0.4, 1.2), b_range=(0.01, 0.31))[source]

Bases: TransportMaps.Distributions.DistributionBase.Distribution

Abstract distribution \(\nu_\pi\).

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, **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, params=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, **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.Examples.BiochemicalOxygenDemand.BODDistributions.JointDistribution(times, sigma2=0.001, amin=0.4, amax=1.2, bmin=0.01, bmax=0.31)[source]

Bases: TransportMaps.Distributions.FactorizedDistributionBase.FactorizedDistribution

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)
property times[source]
TransportMaps.Distributions.Examples.BiochemicalOxygenDemand.BODDistributions.JointDistributionUniformPrior[source]
class TransportMaps.Distributions.Examples.BiochemicalOxygenDemand.BODDistributions.JointDistributionLogNormalPrior(times, sigma2=0.001, muA=0.9, sigA=0.3, muB=0.16, sigB=0.3)[source]

Bases: TransportMaps.Distributions.FactorizedDistributionBase.FactorizedDistribution

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)
property times[source]
class TransportMaps.Distributions.Examples.BiochemicalOxygenDemand.BODDistributions.PosteriorDistribution(obs, times, sigma2=0.001, amin=0.4, amax=1.2, bmin=0.01, bmax=0.31)[source]

Bases: TransportMaps.Distributions.Inference.InferenceBase.BayesPosteriorDistribution

Given a log-likelihood and a prior, assemble the posterior density

Given the log-likelihood \(\log\pi({\bf y}\vert{\bf x})\) and the prior density \(\pi({\bf x})\), assemble the Bayes’ posterior density

\[\pi({\bf x}\vert {\bf y}) \propto \pi({\bf y}\vert{\bf x}) \pi({\bf x})\]
Parameters:
  • logL (LogLikelihood) – log-likelihood \(\log\pi({\bf y}\vert{\bf x})\)

  • prior (Distribution) – prior density \(\pi({\bf x})\)

TransportMaps.Distributions.Examples.BiochemicalOxygenDemand.BODDistributions.PosteriorDistributionUniformPrior[source]
class TransportMaps.Distributions.Examples.BiochemicalOxygenDemand.BODDistributions.PosteriorDistributionLogNormalPrior(obs, times, sigma2=0.001, muA=0.9, sigA=0.3, muB=0.16, sigB=0.3)[source]

Bases: TransportMaps.Distributions.Inference.InferenceBase.BayesPosteriorDistribution

Given a log-likelihood and a prior, assemble the posterior density

Given the log-likelihood \(\log\pi({\bf y}\vert{\bf x})\) and the prior density \(\pi({\bf x})\), assemble the Bayes’ posterior density

\[\pi({\bf x}\vert {\bf y}) \propto \pi({\bf y}\vert{\bf x}) \pi({\bf x})\]
Parameters:
  • logL (LogLikelihood) – log-likelihood \(\log\pi({\bf y}\vert{\bf x})\)

  • prior (Distribution) – prior density \(\pi({\bf x})\)