pyhgf.updates.vectorized.volatile.vectorized_posterior_update_precision_value_level#
- pyhgf.updates.vectorized.volatile.vectorized_posterior_update_precision_value_level(layer, child, weights, coupling_fn, child_is_input_layer=False)[source]#
Update the precision of the value level for all nodes in a layer.
This is the vectorized equivalent of
pyhgf.updates.posterior.volatile.posterior_update_value_level.posterior_update_precision_value_level().Implements the posterior-step (smoothing) correction of the relaxed HGF on value-coupling edges, in its fully-corrected form that pairs with the prediction-step (marginal-precision) correction. Lifting the mean-field delta-collapse approximation \(q(x_a, x_b) = q(x_a)\,q(x_b)\) to a structured Gaussian on the value-coupling edge and applying the Schur complement to the joint precision matrix replaces the canonical child-precision factor by the harmonic combination
\[\hat{\pi}_a^{(k)} \,\longmapsto\, \frac{\hat{\pi}_a^{(k)} \, \pi_y}{\hat{\pi}_a^{(k)} + \pi_y}, \qquad \pi_y = \pi_a^{(k)} - \tilde{\pi}_a^{(k)},\]in the value-coupling contribution to \(\pi_b^{(k)}\). Here \(\hat{\pi}_a\) is the child’s conditional predicted precision (own variance plus volatility, without the parent-uncertainty bleed-through term \(\alpha^2 g'^2 / \hat{\pi}_b\)), stored as
child.conditional_expected_precision, and \(\tilde{\pi}_a\) is its marginal predicted precision stored aschild.expected_precision. The two coincide in the canonical limit (no prediction-step correction); once the prediction-step correction is in play they diverge, and the Schur complement acts on the conditional. Substituting the marginal here would double-count parent uncertainty.The same harmonic combination scales both the \((\kappa g')^2\) and the \(\kappa g'' \, \delta_a\) contributions. Reduces to the canonical formula when the child is fully observed (\(\pi_y \to \infty\)); returns no contribution when the child gained no bottom-up information (\(\pi_y = 0\)).
Note
Unlike the standard continuous-state posterior updates elsewhere in the toolbox, the volatile-state updates evaluate coupling function derivatives at the expected mean (i.e. the prediction) rather than the posterior mean. This choice is made to better suit deep learning networks where the prediction serves as the natural reference point for computing updates.
- Parameters:
layer (LayerState) – Current state of the parent layer (being updated).
child (LayerState) – Current state of the child layer (providing prediction errors).
weights (Array) – Weight matrix connecting child to parent, shape
(n_children, n_parents).coupling_fn (Callable) – Coupling function. First and second derivatives are computed inline via
jax.grad.child_is_input_layer (bool) – If True, the child is a clamped observation leaf (binary or continuous output). The paper’s Limit 3 (\(\pi_a \to \infty\)) applies and the smoothing correction reduces to the canonical predicted-precision factor. We short-circuit to
child.conditional_expected_precision(which equalschild.expected_precisionfor a leaf): pyhgf’s leaf convention sets \(\pi_a = \tilde{\pi}_a\) for the binary PE and never updates \(\pi_a\) for a continuous leaf, so \(\pi_y = 0\) and the harmonic-combination form would incorrectly zero out the contribution. Defaults toFalse(interior child, full smoothing correction).
- Returns:
Posterior precision for each node in the parent layer.
- Return type:
jnp.ndarray