with_mirror

Contents

with_mirror#

hybrid_aif.composition.with_mirror(
system,
params,
*,
per_component=False,
lower=True,
param_key=None,
names=('model', 'world'),
)[source]#

system coupled with its own mirror: the closed System of a model and the world it models.

The coupling of names[0] (system as given) and names[1] (mirror(system, params, lower=lower, param_key=param_key), the world that generated what the model perceives): each modality of system that System.observes does not name is identified with the world’s emission of the same name, and each action node with the world’s control node it realises, which is then driven by it. Any System is accepted, a merged or coupled one included, and nothing is assumed of it; the result is a closed System, which run() steps with plan() for the model’s leaves and sample() for the world. A modality system feeds from its own emission is no in-port and gets no emission, as mirror() drops it.

lower=True (the default) gives the world each learnable declaration at its posterior mean, or at one draw under param_key; lower=False keeps the declarations as the model has them. per_component=True couples the System with the merge of one mirror per component (mirror_components()) in place of the mirror of the System whole: a state factor of one component that another reads is then fed to the reader as an identity emission of its owner, and each component of the world is a leaf that run() steps on its own.