hyperiax.prebuilt.bffg.init_discrete_tree¶
- hyperiax.prebuilt.bffg.init_discrete_tree(tree, leaf_obs, obs_var, *, d, root_val=None, anchor_init=None)[source]¶
Seed a discrete-edge BFFG tree with leaf observations and initial anchors.
Writes leaves’ canonical-form message
(prec, ptnl, log_norm)from the isotropic-Gaussian likelihood \(y \sim \mathcal N(x, \tau^2 I)\) and seeds every node’sanchor(leaves at their observation, others atanchor_init). Optionally pins the root state.- Parameters:
tree (
Tree) – Empty tree with the schema returned bydiscrete_schema().leaf_obs (
Array) –(n_leaves, d)leaf observations in BFS leaf order.obs_var (
float|Array) – Scalar observation variance \(\tau^2\).d (
int) – State dimension.root_val (
Array|None) – Optional(d,)value to pin at the root (writes thevalfield). Required by samplers that condition on a fixed root.anchor_init (
Array|None) – Optional(d,)initial anchor for non-leaf nodes (defaults toroot_valif given, else zeros).
- Return type:
- Returns:
Tree with leaf canonical messages set, anchors seeded, and (optionally) the root pinned.