Dirichlet#
- class hybrid_aif.Dirichlet[source]#
Bases:
ExponentialFamilyA Dirichlet distribution over the
num_levelssimplex, batched over leading axes.The learnable form of a categorical prior (a point
Categorical’s conjugate):point()gives the expected categorical,stats()andabsorb()are the count update,novelty()the novelty of the counts. Design: docs/design/parameter-learning.md D7; docs/design/structure-learning.md S3.- alpha0: Array | None = None#
The decay anchor a
decay < 1update relaxes toward: the prior’s own concentration, a scalar (uniform), orNone.
- growth: Array | None = None#
The growth propensity
αof a growable state factor, a scalar orNone: the pseudo-count the prior gives a level not yet live. A level with zero concentration is absent from the family whatevergrowthsays;growthis what lets such a level be woken, and without it the level stays absent.
- property batch_shape: tuple[int, ...]#
Leading (batch) axes: leaf shape minus the family’s fixed trailing structure.
- sample(key, sample_shape=())[source]#
Draw samples with shape
sample_shape + batch_shape + event_shape.
- expected_log_params()[source]#
E[log p] per level (digamma differences), averaging over the parameters.
Unnormalized as a log-prior, so an FPI prior takes
log(mean())viapoint()instead.
- point()[source]#
Posterior-mean probability vector as a
Categorical(the slot’s point form).
- stats(child_obs)[source]#
One tick’s sufficient statistic: onehot of an index, or a probability vector (e.g.
q(s_0)for an initial-prior count update) passed through.
- absorb(stats, lr=1.0, decay=1.0)[source]#
Absorb one tick’s statistic:
decay·α + (1−decay)·anchor + lr·stats.A static
decay=1.0is the exact conjugate update, bitwise; any other decay needsalpha0(see_absorbed).
- novelty()[source]#
Parameter-info-gain weights over the levels (exact
spm_wnorm, better-when-larger, zero counts masked).
- __init__(concentration, alpha0=None, growth=None)#