viabel.all_diagnostics

viabel.all_diagnostics(log_weights, *, samples=None, moment_bound_fn=None, q_var=None, p_var=None, log_norm_bound=None)[source]

Compute all VI diagnostics.

Compute error and distance bounds between distribution p and q using samples from q. The distributions need not be normalized. Also compute the Pareto k-hat diagnostic.

Parameters:
log_weightsarray-like of int, shape (n_samples,)

log weights log p(x_i) - log q(x_i), where x_i is sampled from q and p may be an unnormalized distribution

samplesarray-like matrix, shape (n_samples, n_dimensions)

samples x_i associated with log weights

moment_bound_fnfunction

moment_bound_fn(p) should return a bound on \(\min_y \mathbb E[(x_i - y)^p]\). It must be provided if samples is None and it must support p = 2 and p = 4.

q_varfloat or array-like matrix

(Bound on) the (co)variance of q.

p_varfloat or array-like matrix

(Bound on) the (co)variance of p.

log_norm_boundfloat

Bound on the overall log normalization constant (the log marginal likelihood when p is the unnormalized log posterior)

Returns:
resultsdict

contains the following entries: mean_error, var_error, std_error, d2, W1, W2.