Conditional#
- class hybrid_aif.Conditional[source]#
Bases:
ModuleAbstract base for conditional families: Markov kernels P(child | parents) with discrete parents.
A conditional holds one child distribution per parent configuration; the parent axes are model structure, not batch axes, and normalization is over the child axis only. The number of parent axes is the static field
parent_ndims;parent_shapegives their sizes andbatch_shapethe axes to their left.condition_on()takes unbatched parent level indices and returns the child distribution at that configuration (batch it withvmap).Tabular families (
ConditionalCategorical,ConditionalDirichlet) store the child axis first,(..., num_levels, *parent_shape)(the pymdp and SPM layout);ConditionalGaussianputs the parent axes before the Gaussian’s own trailing axes. Design: docs/design/conditional-families.md- abstract property batch_shape: tuple[int, ...]#
Leading (batch) axes: leaf shape minus parent and family structure.
- abstract property parent_shape: tuple[int, ...]#
Sizes of the parent axes (one per discrete parent).
- abstractmethod condition_on(parent_indices)[source]#
The child distribution at one parent configuration (unbatched indices).
- __init__()#