MatrixNormal#

class hybrid_aif.distributions.MatrixNormal[source]#

Bases: Module

W ~ MN(M, U, V) with shared column covariance; row structure external.

M is (..., d_obs, p) (p = dx + 1 for an augmented head); V_inv is (..., p, p), the column precision (V_inv += Σ E[x̃x̃ᵀ]). The row covariance is the noise, supplied by the consumer, and is not stored.

M: Array#

The posterior mean head, (..., d_obs, p).

V_inv: Array#

The column precision, (..., p, p).

M0: Array | None = None#

The decay anchor for M (design D7); required iff decay < 1.

V_inv0: Array | None = None#

The decay anchor for V_inv (design D7); required iff decay < 1.

classmethod from_head(head, strength=1.0, anchor=False)[source]#

Prior centred on a known head: point() reproduces it exactly; strength is the pseudo-observation count on the column precision.

point()[source]#

The posterior-mean head — what every probability-kind consumer takes.

stats(syx, sxx, count)[source]#

Package one tick’s (noise-whitened, responsibility-weighted) regression statistic: syx = Σ y x̃ᵀ (..., d_obs, p), sxx = Σ E[x̃x̃ᵀ] (..., p, p), and the responsibility mass.

absorb(stats, lr=1.0, decay=1.0)[source]#

Conjugate Bayesian-regression update in natural coordinates: V_inv += sxx and (M V_inv) += syx, then solve for M.

sample(key, row_chol)[source]#

One head draw M + L_row Z L_colᵀ; the row Cholesky is the noise factor, supplied by the caller (the class stores no row covariance).

__init__(M, V_inv, M0=None, V_inv0=None)#