Skip to main content
Ctrl+K
hybrid-aif hybrid-aif
  • Declaring a model

    • System and SystemParams
      • System
      • SystemParams
      • LearnState
      • Ports
      • Subsystem
      • PartParams
    • Model components
      • States and transitions
        • LinearGaussianTransition
        • NonlinearGaussianTransition
        • Deterministic
      • Observations and likelihoods
        • LinearGaussianObservation
        • gaussian_emission
        • NoiseMap
        • GridNoiseMap
        • Grid
        • cell_mass
      • Initial state priors
        • DerivedInitial
        • LearnedVector
      • Preferences
        • accumulated_target
      • Controls and actions
        • Box
    • Shared parameters, emissions and recognition models
      • Parameter
      • Emission
      • Recognition
    • Distributions
      • Distribution
      • ExponentialFamily
      • Learnable
      • Conditional
      • Categorical
      • JointCategorical
      • Gaussian
      • MixtureGaussian
      • TruncatedGaussian
      • Dirichlet
      • ConditionalCategorical
      • ConditionalGaussian
      • ConditionalDirichlet
      • MLPCategorical
      • MLPConditional
      • MLPPredictor
      • PredictorHead
      • LearnedVector
      • MatrixNormal
      • InverseGamma
      • InverseWishart
      • LowRankMixture
      • GRUCell
  • Composing and running

    • Composing systems
      • merge
      • couple
      • black_box
      • with_mirror
      • nested
      • subsystem
      • subsystem_states
      • write_back
      • Link
      • Identify
      • Clamp
      • namespaced_key
      • driven_nodes
      • is_black_box
      • resolved_epistemic
      • joint_planner
    • Running a system
      • run
      • plan
      • sample
      • env_step
      • Trajectory
      • Trace
      • MindCarry
      • discretise
      • compose
  • Inference, learning and planning

    • State inference
      • fpi
      • InferenceDetail
      • condition
      • DiagonalNoise
      • condition_mixture
      • predict
      • propagate
      • rollout_reduced
      • rollout_gpb1
    • Learning
      • update_likelihood_dirichlet
      • log_evidence
      • absorbed_count
      • Evidence
      • fit_world
      • world_loss
      • WorldBatch
      • WorldLosses
      • assemble
      • posterior_states
      • imagine
      • roll_batch
      • rollout_returns
      • lambda_return
      • perc_ema
      • init_retnorm
      • term_value
      • ImagineMetrics
      • ReturnEstimates
      • Rollout
      • fit_ensemble
      • ensemble_loss
      • transitions
      • EnsembleBatch
      • EnsembleLosses
      • Episode
      • ColumnSpec
      • episode
      • as_episode
      • episode_columns
      • stack_episodes
      • fit_length
      • ReplayBuffer
      • StaticBuffer
      • StreamBuffer
      • add
      • extend
      • sample
      • sample_windows
    • Planning
      • Planner
      • PlannerContext
      • register_planner
      • get_planner
      • planner_needs_key
      • planner_branches
      • planner_legal_depth
      • planner_takes_init
      • enumeration_planner
      • enumerate_policies
      • evaluate_policies
      • evaluate_policy_tree
      • evaluate_policy_tree_total
      • expand_level
      • policy_posterior
      • action_marginals
      • sample_action
      • control_steps
      • cem_planner
      • make_cem_planner
      • cem_plan
      • CEMResult
      • gradient_planner
      • make_gradient_planner
      • gradient_plan
      • GradientResult
      • PlanPosterior
      • mean_action
      • mixed_planner
      • make_mixed_planner
      • mixed_plan
      • MixedResult
      • habit_planner
      • habit_action
      • sophisticated_planner
      • make_sophisticated_planner
      • sophisticated_plan
      • evaluate_branching_tree
      • branching_tree_memory
      • BranchingTreeMemory
  • Objectives

    • Objectives
      • total
      • merge
      • map_leaves
      • register_term
      • Interval
  • Records and descriptions

    • Logging and replay
      • Trajectory
      • Trace
      • MindCarry
      • replay
      • replay_document
      • Replay
      • stack_traces
    • Model documents and description length
      • describe
      • build
      • schema
      • Description
      • DescriptionError
      • describe_parameters
      • ParameterRecord
      • register_transition
      • registered_transitions
      • save
      • load
      • check_observation_support
      • check_joint_support
      • DescriptionLength
    • Saving runs
      • load_dataset
      • detect_format
      • Dataset
      • Writer
      • Format
      • Reader
  • Environments

    • Environments
      • Env
      • GenerativeEnv
      • GenerativeEnvParams
      • make
      • broadcast_params
  • Reference models

    • Reference models
      • MountainCar
      • tmaze
    • R-AIF
      • hybrid_aif.reference.raif.world
      • hybrid_aif.reference.raif.agent
      • hybrid_aif.reference.raif.crspp
      • hybrid_aif.reference.raif.revise
      • hybrid_aif.reference.raif.metrics
      • hybrid_aif.reference.raif.columns
      • hybrid_aif.reference.raif.seed
      • hybrid_aif.reference.raif.run
  • .rst

Link

Contents

  • Link
    • Link.source
    • Link.target
    • Link.realise
    • Link.kernel
    • Link.__new__()

Link#

class hybrid_aif.composition.Link[source]#

Bases: NamedTuple

An arc of the graphical model of the whole: source to target.

source is a node, or a tuple of nodes where the link states the complete parent list of its target (a structural link). target is a modality, a control node, or "terminal:<factor>" (a state factor’s terminal target). What the link means follows from its two ends and realise:

  • 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. A joint_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 no realise, 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 a B_deps parent 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 emission rover.cell_obs (named by the modality’s local name under the source’s component), Emission(("rover.x",), realise, kernel) with kernel="identity" when kernel is None or "identity", or a Grid, the indicator of its cells over a continuous source, and the composite’s observes maps 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"; see Emission), which a belief read must give. subsystem() leaves the modality an ordinary observation of the reading component’s view, and run() 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 and System.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 spelling terminal:agent.z under a prefix): the terminal target of the state factor, already a ConditionalCategorical in the component’s terminal_targets, resolved against the sources’ final predicted beliefs (its H_deps). Structural.

A link from a realised port (an action node, or an emission) into a modality is a coupling’s, and a merge refuses it, naming couple(). A port is realised once, by its own kernel, so a link from it takes no realise, and a kernel without realise is 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.

target: str#

A modality, a control node, or "terminal:<factor>" (a state factor’s terminal target).

realise: str | None#

For a belief read only: how the source’s posterior is realised, "sample", "mode" or "stats"; None for every other link.

kernel: str | Grid | None#

For a belief read only: None or "identity" (the identity kernel), or a Grid (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)

previous

write_back

next

Identify

Contents
  • Link
    • Link.source
    • Link.target
    • Link.realise
    • Link.kernel
    • Link.__new__()

By Noumenal Labs

© Copyright Noumenal Labs.