Other Structural Nodes

Default Factor Node

class pysigma.graphical.basic_nodes.DFN(name, **kwargs)[source]

Default (Dummy) Factor Node.

No special computation. Simply relays message to one or multiple incident variable nodes. Requires that incident variable nodes share the same variables. Only admits one incoming link but can connect with multiple outgoing links.

Since all incident variable nodes should share the same variables, these variables will also be registered in the attributes.

Parameters

name (str) – Name of this node.

rel_vars

Tuple of relational variables.

Type

tuple of Variable

param_var

Parameter variable.

Type

Variable

index_vars

Tuple of indexing variables.

Type

tuple of Variable

ran_vars

Tuple of random variables.

Type

tuple of Variable

Checks that all variable nodes on the other side of the linkdata share the same set of variables. Infer attribute values from the connected variable nodes’ variables.

Note

Only one incoming linkdata can be registered.

Parameters

linkdata (LinkData) – The linkdata to be registered.

Raises
  • AssertionError – If attempting to register more than one incoming linkdata.

  • AssertionError – If the variable node on the other side of the specified linkdata do not share the same set of variables as other variable nodes in those linkdata that are already registered.

compute()[source]

Relay untempered message to downstream variable nodes.

Default Variable Node

class pysigma.graphical.basic_nodes.DVN(name, rel_var_list, param_var=None, index_var_list=None, ran_var_list=None, **kwargs)[source]

Default (Dummy) Variable Node.

No special computation. Simply relay message to one or multiple factor nodes. Only admits one incoming link but can connect with multiple outgoing links.

Parameters
  • name (str) – Name of this variable node.

  • rel_var_list (iterable of Variable) – Iterable of relational variables. Corresponds to the batch dimensions. Used to check b_shape attribute of incoming messages.

  • param_var (Variable, optional) – The parameter variable. Corresponds to the parameter dimension. Used to check p_shape attribute of incoming messages.

  • index_var_list (iterable of Variable, optional) – Iterable of indexing variables. Corresponds to the sample dimensions. Used to check s_shape attribute of incoming messages. Must specify if ran_var_list is specified.

  • ran_var_list (iterable of Variable, optional) – Iterable of random variables. Corresponds to the event dimensions. Used to check e_shape attribute of incoming messages. Must specify if index_var_list is specified.

Guarantees that no more than on incoming link is registered.

Parameters

linkdata (LinkData) – The linkdata to be registered.

Raises

AssertionError – If attempting to register more than one incoming linkdata.

compute()[source]

Relay untempered message to downstream factor nodes.