Gaussian#
- class hybrid_aif.Gaussian[source]#
Bases:
ExponentialFamilyA multivariate Gaussian with full covariance, batched over leading axes.
Stored as the mean
locand a lower-triangular Cholesky factorchol(log-determinants and solves read off the factor); the event shape is(dim,).from_cov()builds one from a covariance,covreturns it,kl_to()is the closed form (aMixtureGaussianother is handled through the mixture bounds), and the natural view iseta1 = Σ⁻¹ μ,eta2 = -0.5 Σ⁻¹.- chol: Array#
The lower-triangular Cholesky factor of the covariance,
(..., dim, dim). A preference over a modality may instead give a diagonal standard deviation, the shape ofloc(diagonal;dense()expands it).
- property batch_shape: tuple[int, ...]#
Leading (batch) axes: leaf shape minus the family’s fixed trailing structure.
- property diagonal: bool#
Whether
cholis a diagonal standard deviation(..., dim), the shape ofloc(a full factor has one trailing axis more). Only a preference over a modality reads it as such; every other method needsdense().
- sample(key, sample_shape=())[source]#
Draw samples with shape
sample_shape + batch_shape + event_shape.
- kl_to(other)[source]#
Closed-form Gaussian KL, computed via Cholesky solves.
A
MixtureGaussianotheris handled by promotingselfto a 1-component mixture and using the mixture bounds.
- __init__(loc, chol)#