pyhgf.updates.vectorised.continuous.vectorised_continuous_prediction#
- pyhgf.updates.vectorised.continuous.vectorised_continuous_prediction(child_state, params, time_step, value_parent_state=None, weights=None, coupling_fn=None, volatility_parent_state=None, volatility_weights=None, is_static_leaf=False, mean_field_updates=False)[source]#
Predict expected mean and precisions for a layer of continuous nodes.
This is the vectorised equivalent of
pyhgf.updates.prediction.continuous.continuous_node_prediction(), applied to a whole layer at once with the value and volatility parents generalised to layers connected by matrices.The expected mean follows the standard HGF drift semantics,
\[\hat{\mu}_a^{(k)} = \lambda_a \mu_a^{(k-1)} + t^{(k)} \left( \rho_a + \sum_b W_{a,b} \, g(\hat{\mu}_b) \right),\]so the value parent nudges the child’s own autoregressive state rather than replacing it (contrast with
pyhgf.updates.vectorised.volatile.prediction.vectorised_layer_prediction(), where the parent’s prediction fully determines the child’s expected mean).The two predicted precisions follow the improved (piHGF) scheme of the nodalised backend, with the volatility parent’s moment-generating-function correction and the value parent’s first-order Laplace term:
\[\Omega_a^{(k)} = t^{(k)} \exp\!\left( \omega_a + \sum_j \left( \kappa_{a,j} \hat{\mu}_j + \frac{\kappa_{a,j}^2}{2 \tilde{\pi}_j} \right) \right), \qquad \hat{\pi}_a^{(k)} = \left( \frac{1}{\pi_a^{(k-1)}} + \Omega_a^{(k)} \right)^{-1},\]\[\frac{1}{\tilde{\pi}_a^{(k)}} = \frac{1}{\hat{\pi}_a^{(k)}} + \sum_b \frac{(t^{(k)} W_{a,b} \, g'(\hat{\mu}_b))^2}{\tilde{\pi}_b}, \qquad \gamma_a^{(k)} = \Omega_a^{(k)} \, \tilde{\pi}_a^{(k)}.\]Unlike the volatile-layer kernel, the Laplace value-coupling term carries the time step (the drift contribution to the mean is scaled by \(t^{(k)}\)), matching the nodalised backend exactly.
- Parameters:
child_state (LayerState) – Current state of the layer being predicted.
params (LayerParams) – The layer’s parameters;
tonic_volatility,tonic_driftandautoconnection_strengthmust be set (seepyhgf.typing.vectorised.LayerParams.create_continuous()).time_step (float) – Time step \(t^{(k)}\) for the prediction.
value_parent_state (LayerState | None) – State of the value-parent layer, or
Nonewhen the layer has no value parent (the drift is then \(\rho\) alone).weights (Array | None) – Value-coupling matrix connecting this layer to its value parent, shape
(n_self, n_parent). Required with value_parent_state.coupling_fn (Callable | None) – Coupling function applied elementwise to the value parent’s expected means. Required with value_parent_state.
volatility_parent_state (LayerState | None) – State of the volatility-parent layer, or
Nonewhen the layer’s volatility is tonic only.volatility_weights (Array | None) – Volatility-coupling matrix \(\kappa\), shape
(n_self, n_parent). Required with volatility_parent_state.is_static_leaf (bool) – If True, the layer is the clamped observation leaf without a volatility parent: it does not undergo a Gaussian random walk between observations, so both predicted precisions are held at the prior precision (the nodalised backend’s input-node convention). A leaf with a volatility parent does walk, so it takes the regular path and must be passed with
is_static_leaf=False. Distinct fromprecision_is_clamped, which holds for every clamped leaf.mean_field_updates (bool) – If
True, use the original mean-field prediction: the volatility parent’s MGF correction \(\kappa^2 / (2 \tilde{\pi})\) and the value parent’s Laplace variance term are both dropped, so the conditional and the marginal predicted precision coincide — matchingpyhgf.updates.prediction.continuous.predict_precision_mean_field().
- Returns:
Updated layer state with
expected_mean,expected_precision,conditional_expected_precisionandeffective_precisionpopulated.- Return type: