Interaction Groups#
An InteractionGroup binds a set of nodes to a factor, defining which
variables participate in a particular energy term.
hamon.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 updatehead_nodes.interaction: this specifies the parametric (independent of the state of the sampling program) required to update 'head_nodes'.
__init__(interaction: PyTree, head_nodes: Block, tail_nodes: list[hamon.block_management.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 ofhead_nodes.head_nodes: The nodes whose update is affected by the interaction.tail_nodes: The groups of nodes whose state is required to updatehead_nodes. Each block in this list of blocks is intended to be parallel tohead_nodes. i.e, to update the state ofhead_nodes[i]during sampling we need state info abouttail_nodes[k][i]for all values ofk.