pyhgf.updates.vectorized.binary.vectorized_binary_prediction#
- pyhgf.updates.vectorized.binary.vectorized_binary_prediction(child_state, parent_state, weights, coupling_fn, parent_has_constant=False, precision_clipping_value=1e-06)[source]#
Predict expected mean and precision for a binary state node layer.
The expected mean is the sigmoid of the weighted, coupled parent predictions:
\[\hat{\mu}_b = \sigma\!\left( W \, g(\hat{\mu}_a) \right),\]and the expected precision is the Bernoulli variance:
\[\tilde{\pi}_b = \hat{\mu}_b \, (1 - \hat{\mu}_b).\]Note
The
expected_precisionfield actually stores the variance (i.e. the uncertainty) of the Bernoulli distribution. Reusing this name avoids the need for a separate posterior update step for binary nodes: the continuous parent’s posterior update can consume the binary prediction error directly. Binary leaves carry no AR-volatility random walk, so the conditional predicted precision \(\hat{\pi}_b\) (conditional_expected_precision) is set equal to \(\tilde{\pi}_b\) — matching the paper’s Limit 3 leaf convention used by the parent’s posterior-step (smoothing) update.- Parameters:
child_state (LayerState) – Current state of the binary child layer (being predicted).
parent_state (LayerState) – Current state of the parent layer (predictor).
weights (Array) – Weight matrix connecting child to parent, shape
(n_children, n_parents)or(n_children, n_parents + 1)when the parent layer includes a constant input node.coupling_fn (Callable) – Coupling function applied to parent means (default:
jax.numpy.tanh()).parent_has_constant (bool) – If True, the parent layer has a constant input node (mean = 1.0) appended to its activations; the corresponding column of weights carries the bias connections and is treated as linearly coupled (\(g(1) = 1\)).
precision_clipping_value (float)
- Returns:
Updated child layer state with binary expected values.
- Return type: