pyhgf.updates.vectorized.binary.vectorized_binary_prediction_error#

pyhgf.updates.vectorized.binary.vectorized_binary_prediction_error(layer)[source]#

Compute prediction errors for a binary state node layer.

The value prediction error for binary nodes is scaled by the inverse of the expected precision (Bernoulli variance) so it can be consumed directly by the continuous parent’s posterior update without requiring a different update step:

\[\begin{split}\\delta_b = \\frac{\\mu_b - \\hat{\\mu}_b}{\\hat{\\pi}_b}\end{split}\]

The posterior precision of a binary node is set equal to the expected precision (there is no precision update for binary nodes).

Parameters:

layer (LayerState) – Current binary layer state with mean (observation) and expected_mean/expected_precision set by the prediction step.

Returns:

Updated layer state with value_prediction_error and precision.

Return type:

LayerState