pyhgf.utils.get_update_sequence#

pyhgf.utils.get_update_sequence(network: Network, update_type: str) Tuple[Tuple[Tuple[int, Callable], ...], Tuple[Tuple[int, Callable], ...]][source]#

Generate an update sequence from the network’s structure.

This function return an optimized update sequence considering the edges of the network. The function ensures that the following principles apply: 1. all children have computed prediction errors before the parent is updated. 2. all children have been updated before the parent compute the prediction errors.

Parameters:
network

A neural network, instance of pyhgf.model.network.Network.

update_type

The type of update to perform for volatility coupling. Can be “eHGF” (defaults) or “standard”. The eHGF update step was proposed as an alternative to the original definition in that it starts by updating the mean and then the precision of the parent node, which generally reduces the errors associated with impossible parameter space and improves sampling.

Returns:
prediction_sequence

The sequence of prediction update.

update_sequence

The sequence of prediction error and posterior updates.