InverseGamma#

class hybrid_aif.distributions.InverseGamma[source]#

Bases: Module

Independent inverse-Gamma posteriors over per-dimension noise variances.

alpha/beta are (*parent_shape, d_obs): one (shape, rate) pair per observation dimension per parent configuration. Isotropic noise is the d_obs = 1 case.

alpha: Array#

The shape parameters, (..., d_obs).

beta: Array#

The rate parameters, (..., d_obs).

alpha0: Array | None = None#

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

beta0: Array | None = None#

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

classmethod from_R_chol(R_chol, strength=1.0, anchor=False)[source]#

Prior centred on a known noise level: point() reproduces R_chol exactly, and strength counts pseudo-observations (α = strength/2). anchor=True stores the initial parameters as the decay anchors.

expected_precision()[source]#

E[1/σ²] = α/β per dimension — what mean-field conditioning consumes.

point()[source]#

R_chol under the expected-precision substitution: diag(sqrt(β/α)).

Not the mean covariance (mean()): conditioning consumes a precision.

mean()[source]#

E[σ²] = β/(α−1) per dimension (α > 1) — diagnostic, not consumed.

stats(scatter, count)[source]#

Package one tick’s statistic: the responsibility-weighted residual scatter diagonal (..., d_obs) and the responsibility mass (...,) (the degrees-of-freedom increment).

sample(key)[source]#

One noise draw as an R_chol array: σ² ~ InvGamma(α, β) per dim.

__init__(alpha, beta, alpha0=None, beta0=None)#