hyperiax.prebuilt.bffg.discrete_refine_anchor

hyperiax.prebuilt.bffg.discrete_refine_anchor()[source]

Build the discrete anchor-refinement down-sweep (Algorithm 3 §7.1).

Overwrites each non-root node’s anchor with the BFFG-implied posterior mean \(H^{-1} F\) derived from the canonical message (prec, ptnl) left by discrete_bf_sweep(). The root keeps its initial anchor (it is pinned at root_val).

Return type:

SweepFn

Returns:

A hyperiax.SweepFn that writes anchor at every non-root node. Typical usage interleaves with the backward filter for several iterations until the anchor — and thus the auxiliary linearisation — converges:

for _ in range(n_lin_iters):
    tree = bf(tree, params=theta)
    tree = refine(tree, params=theta)