THRML

Interaction groups

An interaction group is the compiled, array-friendly form of a factor's interactions, ready for block Gibbs.

InteractionGroupclass
InteractionGroup(interaction: PyTree, head_nodes: Block, tail_nodes: list[Block])

Defines computational dependencies for conditional sampling updates.

An InteractionGroup specifies information that is required to update the state of some subset of the nodes of a PGM during a block sampling routine.

More concretely, when the state of the node at head_nodes[i] is being updated, the sampler will receive the current state of the nodes at tail_nodes[k][i] for all k, and the ith element of each array in the Interaction PyTree (sliced along the first dimension).

Attributes:

  • head_nodes: these are the nodes whose conditional updates should be affected by this InteractionGroup.
  • tail_nodes: these are the nodes whose state information is required to update head_nodes.
  • interaction: this specifies the parametric (independent of the state of the sampling program) required to update 'head_nodes'.