Link#
- class hybrid_aif.composition.Link[source]#
Bases:
NamedTupleAn arc of the graphical model of the whole:
sourcetotarget.sourceis a node, or a tuple of nodes where the link states the complete parent list of its target (a structural link).targetis a modality, a control node, or"terminal:<factor>"(a state factor’s terminal target). What the link means follows from its two ends andrealise:from an action node to a control node (
Link("agent.a_v", "world.u_v")): the identification of the two ports,Identify("agent.a_v", "world.u_v"). The control node is driven: it stays in its own component, carries the driver’s one realised value (control-states.md C13), and has no action node of its own, so no planner chooses it. Ajoint_planner()over a node holding both collapses it into the driver’s: every state factor that read the driven node reads the driver’s, and the driven node leaves the planning problem. Level counts (or, for continuous nodes, widths) must agree. A decision is not a belief, so no belief of the driven component is identified with the driver’s, and the link is blanket-shaped at the driven component’s boundary. The link takes norealise, and a control node as the source is refused, naming its action node;from a state factor to a control node (
Link("agent.location", "world.u_location")): the relay. The state becomes aB_depsparent of the one state factor reading the node, in its place, read a step later, the table’s control axis re-read as that parent and a no-op axis of size 1 appended. The state’s level count must equal the node’s. Structural: it identifies a latent outright;from state factors to a modality, with no ``realise`` (
Link(("a.x", "b.y"), "a.obs")): structural. The sources are the modality’s complete new parent list, unchanged parents included, in its likelihood’s axis order, with messages both ways. Arity and per-axis support must match the declared likelihood’s parent axes. One link per modality;from one state factor to a modality, with ``realise`` (
Link("rover.x", "mission.cell_obs", realise="mode", kernel=grid)): a belief read, one way. It is the pair of an emission and an observation: the source’s component gains the emissionrover.cell_obs(named by the modality’s local name under the source’s component),Emission(("rover.x",), realise, kernel)withkernel="identity"whenkernelisNoneor"identity", or aGrid, the indicator of its cells over a continuous source, and the composite’sobservesmaps the modality to it ({"mission.cell_obs": "rover.cell_obs"}). A second read of the same source with the same kernel and realisation under the same name reuses the emission (one out-port, many in-ports); a name that is already another variable of the composite is refused. The modality’s datum each round is the emission realised from the source’s posterior ("sample","mode"or"stats"; seeEmission), which a belief read must give.subsystem()leaves the modality an ordinary observation of the reading component’s view, andrun()supplies it each round from the emission the source component’s step realised, as it stands at the reader’s turn. The source and the modality lie in different components (a read inside one is an emission andSystem.observes). A level count that is not the source’s under the identity kernel, nor the grid’s cell count under an indicator, a categorical modality reading a continuous source with no grid and"stats"of a Gaussian source are refused;from state factors to ``”terminal:<factor>”`` (
Link(("a.x", "b.y"), "terminal:a.z"), the spellingterminal:agent.zunder a prefix): the terminal target of the state factor, already aConditionalCategoricalin the component’sterminal_targets, resolved against the sources’ final predicted beliefs (itsH_deps). Structural.
A link from a realised port (an action node, or an emission) into a modality is a coupling’s, and a
mergerefuses it, namingcouple(). A port is realised once, by its own kernel, so a link from it takes norealise, and akernelwithoutrealiseis refused. Design: nesting-and-coupling.md N2, N3, N7, N8; engine-consolidation.md.- source: str | tuple[str, ...]#
A node, or a tuple of nodes where the link states the complete parent list of its target.
- realise: str | None#
For a belief read only: how the source’s posterior is realised,
"sample","mode"or"stats";Nonefor every other link.
- kernel: str | Grid | None#
For a belief read only:
Noneor"identity"(the identity kernel), or aGrid(the indicator of its cells over a continuous source).
- static __new__(_cls, source, target, realise=None, kernel=None)#
Create new instance of Link(source, target, realise, kernel)