TransportMaps.Distributions.Inference.InferenceBase

Module Contents

Classes

BayesPosteriorDistribution

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

class TransportMaps.Distributions.Inference.InferenceBase.BayesPosteriorDistribution(logL, prior)[source]

Bases: TransportMaps.Distributions.Distribution

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

property observations[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]
log_pdf(x, idxs_slice=slice(None, None, None), cache=None, **kwargs)[source]

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

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

  • 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, idxs_slice=slice(None, None, None), cache=None, **kwargs)[source]

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

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

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

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

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

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

  • 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}\vert{\bf y}), \nabla_{\bf x} \log \pi({\bf x}\vert{\bf y})\right)\)

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

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

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

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

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

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

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

  • dx (ndarray [\(m,d\)]) – direction on which to evaluate the Hessian

  • 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

\(\langle\nabla^2_{\bf x} \log \pi({\bf x}\vert{\bf y}), \delta{\bf x}\rangle\) at the x points.