Categorical#
- class hybrid_aif.Categorical[source]#
Bases:
ExponentialFamilyA categorical distribution over
num_levelsoutcomes, batched over leading axes.Stored as
logits; the event shape is(): a sample or alog_probargument is an integer level index.probsandlog_probsgive the normalised table,from_probs()builds one from probabilities,mean()is the probability vector, andnatural()pins the last level’s logit to zero (the gauge choice).- logits: Array#
Unnormalized log-probabilities,
(..., num_levels): the natural parameters up to an additive gauge constant per batch entry. The trailing axis is the level axis.
- 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.
- __init__(logits)#