hyperiax.prebuilt.bffg.discrete_fg_sweep

hyperiax.prebuilt.bffg.discrete_fg_sweep(mean_fn, covar_fn, prxy_scale_fn, prxy_shift_fn, prxy_covar_fn)[source]

Build the discrete-edge forward-guided down-sweep (Theorem 14 §6.1).

For each non-root node, samples the guided proposal \(X_t^\circ \sim \mathcal N^{\mathrm{can}}(F + Q(x)^{-1}\mu(x),\ H + Q(x)^{-1})\) using the parent state parent.val, the node’s canonical message (prec, ptnl), the true kernel (mean_fn, covar_fn), and the noise node.z. Writes the importance log-weight

\[\log w = \log\varphi(H^{-1}F;\ \mu(x),\ Q(x)+H^{-1}) - \log\varphi(H^{-1}F;\ \Phi x+\beta,\ Q_{\mathrm{aux}}+H^{-1})\]

to log_corr (Theorem 14 step 3). Sum log_corr over non-root nodes to get the path’s importance correction.

Parameters:
  • covar_fn (mean_fn /) – True kernel (x_parent, params) -> array.

  • prxy_covar_fn (prxy_scale_fn / prxy_shift_fn /) – Auxiliary kernel (anchor, params) -> array (same callables fed to discrete_bf_sweep()).

Return type:

SweepFn

Returns:

A hyperiax.SweepFn that writes (val, log_corr) at every non-root node. Run discrete_bf_sweep() first to populate the canonical messages.