Skip to content

Interaction Groups¤

thrml.InteractionGroup ¤

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'.
__init__(interaction: PyTree, head_nodes: thrml.Block, tail_nodes: list[thrml.Block]) ¤

Create an InteractionGroup.

An InteractionGroup implements a group of directed interactions between nodes in a PGM sampling program.

Arguments:

  • interaction: A PyTree specifying the static information associated with the interaction. The first dimension of every Array in interaction must be equal to the length of head_nodes.
  • head_nodes: The nodes whose update is affected by the interaction.
  • tail_nodes: The groups of nodes whose state is required to update head_nodes. Each block in this list of blocks is intended to be parallel to head_nodes. i.e, to update the state of head_nodes[i] during sampling we need state info about tail_nodes[k][i] for all values of k.