Distribution#

class hybrid_aif.Distribution[source]#

Bases: Module

Abstract base for every belief, message payload and preference object.

A Distribution is an equinox.Module whose leaves are jax.Array parameters (no callables, no shared mutable state), so it crosses any jit, vmap, scan or serialization boundary unchanged. Its family’s event and parameter structure occupies a fixed number of trailing axes, documented per class; batch_shape is everything to the left, and elementwise methods broadcast over it. Static structure (event dimension, number of levels, mixture size) is read off the leaf shapes.

Every subclass provides batch_shape, log_prob(), sample() (a JAX PRNG key and a static sample shape; discrete draws are int32), mean() (the moment view), and entropy() and kl_to(), which return an Interval: zero-width where a closed form exists, a bound pair otherwise (mixtures). Arrays are float32 unless a class says otherwise. The full contract is the docstring of hybrid_aif.distributions.base.

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

Leading (batch) axes: leaf shape minus the family’s fixed trailing structure.

abstractmethod log_prob(x)[source]#

Log density/mass at x; broadcasts over batch axes.

abstractmethod sample(key, sample_shape=())[source]#

Draw samples with shape sample_shape + batch_shape + event_shape.

abstractmethod mean()[source]#

Mean (moment view).

abstractmethod entropy()[source]#

Differential/discrete entropy as an Interval (zero-width when exact).

abstractmethod kl_to(other)[source]#

KL(self ‖ other) for other of the same family, as an Interval.

__init__()#