pyhgf.utils.beliefs_propagation#
- pyhgf.utils.beliefs_propagation(attributes: Dict[int | str, Dict], inputs: Tuple[Array | ndarray | bool_ | number | bool | int | float | complex, ...], update_sequence: Tuple[Tuple[Tuple[int, Callable], ...], Tuple[Tuple[int, Callable], ...]], edges: Tuple[AdjacencyLists, ...], input_idxs: Tuple[int]) Tuple[Dict, Dict] [source]#
Update the network’s parameters after observing new data point(s).
This function performs the beliefs propagation step. Belief propagation consists in: 1. A prediction sequence, from the leaves of the graph to the roots. 2. The assignation of new observations to target nodes (usually the roots of the network) 3. An inference step alternating between prediction errors and posterior updates, starting from the roots of the network to the leaves. This function returns a tuple of two new parameter_structure (i.e. the carryover and the accumulated in the context of
jax.lax.scan()
).- Parameters:
- attributes
The dictionaries of nodes’ parameters. This variable is updated and returned after the beliefs propagation step.
- inputs
A tuple of n by time steps arrays containing the new observation(s), the time steps as well as a boolean mask for observed values. The new observations are a tuple of array, with length equal to the number of input nodes. Each input node can receive observations The time steps are the last column of the array, the default is unit incrementation.
- update_sequence
The sequence of updates that will be applied to the node structure.
- edges
Information on the network’s edges.
- input_idxs
List input indexes.
- Returns:
- attributes, attributes
A tuple of parameters structure (carryover and accumulated).