ConditionalGaussian#

class hybrid_aif.ConditionalGaussian[source]#

Bases: Conditional

Parent-indexed stack of Gaussians: P(x | parents) with discrete parents.

Parent axes lead the Gaussian’s trailing parameter axes (loc (..., *parent_shape, dim), chol (..., *parent_shape, dim, dim)). With parent_shape == (M,) it is the mode-indexed innovation family N(b_j, Q_j) that hybrid_aif.inference.mixture_rollout.propagate() consumes.

chol may instead omit the parent axes, (..., dim, dim) beside a loc that has them (shared_chol): one covariance factor shared by every parent configuration, the mean alone depending on the parents. The parent axes are read from loc; a chol carrying some of them is refused.

chol may also be a diagonal standard deviation per configuration, the shape of loc (diagonal): (..., *parent_shape, dim). With one parent whose level count equals dim that shape is also a shared full factor, and is read as one; a diagonal over such a parent is declared in the full (L, dim, dim) form, and a (dim, dim) array with entries above its diagonal is refused as neither.

loc: Array#

The means, (..., *parent_shape, dim); the parent axes are read from here.

chol: Array#

The lower-triangular Cholesky factors, (..., *parent_shape, dim, dim); or one shared factor, (..., dim, dim); or a diagonal standard deviation, the shape of loc.

parent_ndims: int#

The number of parent axes (a count, not their sizes).

property diagonal: bool#

Whether chol is a diagonal standard deviation per parent configuration, the shape of loc.

property shared_chol: bool#

Whether chol omits the parent axes: one covariance factor for every parent configuration.

property batch_shape: tuple[int, ...]#

Leading (batch) axes: leaf shape minus parent and family structure.

property parent_shape: tuple[int, ...]#

Sizes of the parent axes (one per discrete parent).

stacked_chol()[source]#

chol with the parent axes, (..., *parent_shape, dim, dim): a shared factor broadcast over them.

gaussians()[source]#

The whole family as one Gaussian with parent axes as trailing batch axes.

condition_on(parent_indices)[source]#

The child distribution at one parent configuration (unbatched indices).

__init__(loc, chol, parent_ndims)#