Skip to main content

Module general_graph

Module general_graph 

Source
Expand description

General-graph CRF training via loopy belief propagation.

Supports arbitrary pairwise factor graphs (not just linear chains). Inference uses sum-product message passing; MAP uses max-product.

Reference: Koller & Friedman 2009, “Probabilistic Graphical Models”, Chapter 11 (Belief Propagation).

Graph structure:

  • n_nodes variable nodes, each with n_labels possible states.
  • edges: Vec<(usize, usize)> — undirected pairwise edges.
  • Node potentials φ_i(y_i): [n_nodes × n_labels].
  • Edge potentials ψ_{ij}(y_i, y_j): [n_edges × n_labels × n_labels].

Loopy BP is approximate for graphs with cycles. Guaranteed exact for trees and linear chains.

Structs§

Edge
One undirected pairwise edge in the factor graph.
GeneralGraphCrf
General-graph pairwise CRF with loopy belief propagation inference.
GraphCrfConfig
Configuration for the general-graph CRF.