replay#
- hybrid_aif.replay.replay(
- system,
- params,
- observations,
- actions,
- *,
- present=None,
- valid=None,
- legal=None,
- priors=None,
- key=None,
- externals=None,
- metrics=True,
- learn=False,
- lr=1.0,
- prior=None,
- support_floor=-27.631021115928547,
- lr_by_slot=None,
Drive
(system, params)through a recorded trace (design:replay.mdR1–R7).observationsmaps each modality name to a(T, …)array, asSystem.infer_states()takes them plus a time axis;actionsmaps each action node’s name (System.names.actions) to its(T, …)column, asSystem.act()returns them plus a time axis; each clamps its control node at its tick (the efference copy).presentmaps a modality to a(T,)bool, whether it was observed at each tick (a modality left out was observed at every tick;None: all were; an unknown key raises);validis(T,)bool, the non-padding rows (an invalid tick leaves the carry untouched, its outputs unspecified).legalis the per-tick constraint ininfer_policies’ spellings with a leading time axis, applied tochosenandaction_log_prob: keyed by control node, each entry(T, levels)or(T, H, levels)(a node left out is unrestricted), or a(T, P)bool array over the policy set.priorsseeds the first tick, keyed by state factor (None: the initial priors).keydrives a stochastic planner and is split per tick; selection is deterministic.externalssuppliesexternal:<name>recognition inputs as(T, width)arrays.learn=TruerunsSystem.learn()between perception and action from the second tick and returns the final params (andLearnStatefor gradient slots); a modality absent at a tick (present, or a padded tick) teaches its likelihood slot nothing there; on the amortized pathSystem.learnraises (train withfit_world).prioris the model’s prior params, which a scheduled reduction (System.reduction_period) scores its merges against and returns a killed level to;Nonetakesparams, right when the replay starts from the prior and wrong whenparamswere already learned.lris the learning rate: a nonzero Python number is passed to the compiled scan as a float32 array, so a schedule of rates compiles once, and a Python0.0is static (it skips learning at trace time).lr_by_slotisSystem.learn()’s per-slot rates, passed to every tick’s learn step as given (a Python0.0freezes a slot at trace time;{"transition:z:noise": 1.0}learns one factor’s process noise alone, withlr=0.0for the rest).metrics=Falsedrops the per-tick term trees. On the amortized path the belief half is the per-tick faces (infer_states,update_empirical_prior).observationsis keyed by variable (System.infer_states()). A modality that observes an emission or an action node of the System (System.observes) may leave its variable out ofobservations, or giveNone: its datum is then the value of the previous tick, the emission realised from that tick’s posterior and recorded inReplay.emitted(a draw bysampletakes a key folded from the tick’skey, which every sampled emission needs; the kernel of an emission that has one lives inparams.emission) or that tick’s recorded action, and the modality is absent at the first tick. A datum the trace supplies wins.