Replay#
- class hybrid_aif.Replay[source]#
Bases:
NamedTupleWhat
replay()returns. Every leaf carries a leading(T, …)axis, one entry per tick.Design: docs/design/zero-support-evidence.md Z2
- beliefs: dict[str, Categorical | Gaussian | MixtureGaussian]#
The posteriors at every tick, keyed by state factor name.
- priors: dict[str, Categorical | Gaussian | MixtureGaussian]#
The priors each posterior was inferred under, keyed by state factor name.
- q_pi: Categorical#
The counterfactual policy posterior.
- chosen: dict[str, Array]#
The model’s own deterministic choice, keyed by the action nodes’ names (
System.names.actions); under a policy module, the habit planner’s draw underkey.
- action_log_prob: Array | None#
log P(actions[t])under the policy posterior, summed over the policies sharing that first step:-infwhere no policy begins with it, the module’s log-density under a policy module, andNoneover a continuous action space with no module.
- log_evidence: Array | None#
-free_energy: the tick’s log evidence where its posterior is exact (every modality linear-Gaussian, or one categorical state factor) and a lower bound otherwise, so its sum over the valid ticks is the prequential description length of the record under the model as it stood at each tick.
- free_energy: Array | None#
The per-tick variational free energy (
InferenceDetail.free_energy);Noneon the amortized path.
- exercised: dict[str, Array] | None#
Each modality mapped to a bool: present on at least one valid tick (
Nonewithoutpresent).
- unsupported: dict[str, Array | None]#
Each state factor mapped to a
(T,)bool (Nonefor a continuous state factor; empty on the amortized path): under the beliefs held about its co-parents, no level was compatible with the tabular evidence. Co-parents of the contradicted state factor are flagged too.
- params: SystemParams | None#
The final parameters (containers keyed by name) under
learn=True, elseNone.
- learn_state: LearnState | None#
The final optimizer carry under
learn=True, elseNone.
- emitted: dict[str, Array]#
Each emission realised from the tick’s posterior and recorded action, keyed by emission name; empty when the System declares no emissions or runs on the amortized path.
- static __new__(
- _cls,
- beliefs,
- priors,
- q_pi,
- trees,
- chosen,
- action_log_prob,
- log_evidence,
- free_energy,
- valid,
- exercised,
- unsupported,
- params,
- learn_state,
- emitted={},
Create new instance of Replay(beliefs, priors, q_pi, trees, chosen, action_log_prob, log_evidence, free_energy, valid, exercised, unsupported, params, learn_state, emitted)