boltzkit.evaluation.density_based.evidence

Functions

get_elbo(log_weights)

Compute the Evidence Lower Bound (ELBO) using samples from q(x).

get_eubo(log_weights)

Compute the Evidence Upper Bound (EUBO) using samples from p(x).

get_nll(model_log_prob)

Compute the negative log-likelihood under q(x) using samples from p(x).

boltzkit.evaluation.density_based.evidence.get_elbo(log_weights: ndarray) float[source]

Compute the Evidence Lower Bound (ELBO) using samples from q(x).

For \(x \sim q(x)\),

\[\log w(x) = \log \tilde{p}(x) - \log q(x), \quad \mathrm{ELBO} = \mathbb{E}_q[\log w].\]
Parameters:

log_weights (np.ndarray) – Log weights, i.e., \(\log \tilde{p}(x) - \log q(x)\) for samples \(x \sim q(x)\).

Returns:

Estimate of the ELBO.

Return type:

float

boltzkit.evaluation.density_based.evidence.get_eubo(log_weights: ndarray) float[source]

Compute the Evidence Upper Bound (EUBO) using samples from p(x).

For \(x \sim p(x)\),

\[\log w(x) = \log \tilde{p}(x) - \log q(x), \quad \mathrm{EUBO} = \mathbb{E}_p[\log w].\]
Parameters:

log_weights (np.ndarray) – Log weights, i.e., \(\log \tilde{p}(x) - \log q(x)\) for samples \(x \sim p(x)\).

Returns:

Estimate of the EUBO.

Return type:

float

boltzkit.evaluation.density_based.evidence.get_nll(model_log_prob: ndarray) float[source]

Compute the negative log-likelihood under q(x) using samples from p(x).

For \(x \sim p(x)\),

\[\mathrm{NLL} = -\mathbb{E}_p[\log q(x)].\]
Parameters:

model_log_prob (np.ndarray) – Log-probabilities \(\log q(x)\) evaluated at samples \(x \sim p(x)\).

Returns:

Estimate of the negative log-likelihood.

Return type:

float