LowRankMixture#

class hybrid_aif.distributions.LowRankMixture[source]#

Bases: Module

Gaussian mixture whose component covariances are diagonal plus low rank, S_i = diag(D_i) + U_i U_iᵀ, with U_i of r columns in a p-dimensional space.

entropy() is the Kolchinsky-Tracey pair of MixtureGaussian.entropy(), computed without forming a p by p array: the matrix determinant lemma gives every log determinant and the Woodbury identity every trace and quadratic form, from r by r and 2r by 2r factorisations. The cost is O(N² p r²) for N components against O(N² p³) dense.

log_weights: Array#

The components’ log weights, (..., N).

means: Array#

The components’ means, (..., N, p).

diag: Array#

The positive diagonal D_i of each covariance, (..., N, p).

factors: Array#

The low-rank factors U_i, (..., N, p, r).

component_entropies()[source]#

H of each component, ½ log|2πe S_i|, shape (..., N).

pairwise_kl()[source]#

KL(component_i ‖ component_j), shape (..., N, N), an exact zero on the diagonal.

tr(S_j⁻¹ S_i) - p is formed from the differences D_i - D_j and Δ = U_i - U_j as tr(S_j⁻¹ (D_i - D_j)) + 2 tr(X_jᵀ Δ) + tr(Δᵀ S_j⁻¹ Δ), X_j = S_j⁻¹ U_j, which is small for near-coincident components, where subtracting the two traces tr(S_j⁻¹ S_i) and p loses all precision in single precision.

pairwise_bhattacharyya()[source]#

Bhattacharyya distance between components, shape (..., N, N), an exact zero on the diagonal.

entropy()[source]#

Kolchinsky-Tracey pairwise bounds, as MixtureGaussian.entropy().

__init__(log_weights, means, diag, factors)#