Belief propagation, also known as sum–product message passing, is a message-passing algorithm for performing inference on graphical models, such as Bayesian networks and Markov random fields. It calculates the marginal distribution for each unobserved node (or variable), conditional on any observed nodes (or variables). Belief propagation is commonly used in artificial intelligence and information theory, and has demonstrated empirical success in numerous applications, including low-density parity-check codes, turbo codes, free energy approximation, and satisfiability.
The algorithm was first proposed by Judea Pearl in 1982,[1] who formulated it as an exact inference algorithm on trees, later extended to polytrees.[2] While the algorithm is not exact on general graphs, it has been shown to be a useful approximate algorithm.[3]
Given a finite set of discrete random variables
X1,\ldots,Xn
p
Xi
Xi
p | |
Xi |
(xi)=
\sum | |
x':x'i=xi |
p(x')
where
x'=(x'1,\ldots,x'n)
Xi
x':x'i=xi
x'
i
xi
X1,\ldots,X100
Xi
p
299 ≈ 6.34 x 1029
x'
p
Variants of the belief propagation algorithm exist for several types of graphical models (Bayesian networks and Markov random fields[4] in particular). We describe here the variant that operates on a factor graph. A factor graph is a bipartite graph containing nodes corresponding to variables
V
F
p(x)=\prodafa(xa)
where
xa
a
The algorithm works by passing real valued functions called messages along the edges between the hidden nodes. More precisely, if
v
a
v
\muv
v
a
\mua
a
v
\muv,\mua:\operatorname{Dom}(v)\toR
v
\operatorname{Dom}(v)
\muv:\operatorname{Dom}(v)\toR
v
a
xv\in\operatorname{Dom}(v)
N(v)
v
N(v)\setminus\{a\}
\muv(xv)
\operatorname{Dom}(v)
\mua:\operatorname{Dom}(v)\toR
a
v
v
xv\in\operatorname{Dom}(v)
N(a)
a
N(a)\setminus\{v\}
\mua(xv)=fa(xv)
xv=xa
In a typical run, each message will be updated iteratively from the previous value of the neighboring messages. Different scheduling can be used for updating the messages. In the case where the graphical model is a tree, an optimal scheduling converges after computing each message exactly once (see next sub-section). When the factor graph has cycles, such an optimal scheduling does not exist, and a typical choice is to update all messages simultaneously at each iteration.
Upon convergence (if convergence happened), the estimated marginal distribution of each node is proportional to the product of all messages from adjoining factors (missing the normalization constant):
p | |
Xv |
(xv)\propto\proda\mua(xv).
Likewise, the estimated joint marginal distribution of the set of variables belonging to one factor is proportional to the product of the factor and the messages from the variables:
p | |
Xa |
(xa)\proptofa(xa)\prodv\muv(xv).
In the case where the factor graph is acyclic (i.e. is a tree or a forest), these estimated marginal actually converge to the true marginals in a finite number of iterations. This can be shown by mathematical induction.
In the case when the factor graph is a tree, the belief propagation algorithm will compute the exact marginals. Furthermore, with proper scheduling of the message updates, it will terminate after two full passes through the tree. This optimal scheduling can be described as follows:
Before starting, the graph is oriented by designating one node as the root; any non-root node which is connected to only one other node is called a leaf.
In the first step, messages are passed inwards: starting at the leaves, each node passes a message along the (unique) edge towards the root node. The tree structure guarantees that it is possible to obtain messages from all other adjoining nodes before passing the message on. This continues until the root has obtained messages from all of its adjoining nodes.
The second step involves passing the messages back out: starting at the root, messages are passed in the reverse direction. The algorithm is completed when all leaves have received their messages.
Although it was originally designed for acyclic graphical models, the Belief Propagation algorithm can be used in general graphs. The algorithm is then sometimes called loopy belief propagation, because graphs typically contain cycles, or loops. The initialization and scheduling of message updates must be adjusted slightly (compared with the previously described schedule for acyclic graphs) because graphs might not contain any leaves. Instead, one initializes all variable messages to 1 and uses the same message definitions above, updating all messages at every iteration (although messages coming from known leaves or tree-structured subgraphs may no longer need updating after sufficient iterations). It is easy to show that in a tree, the message definitions of this modified procedure will converge to the set of message definitions given above within a number of iterations equal to the diameter of the tree.
The precise conditions under which loopy belief propagation will converge are still not well understood; it is known that on graphs containing a single loop it converges in most cases, but the probabilities obtained might be incorrect.[6] Several sufficient (but not necessary) conditions for convergence of loopy belief propagation to a unique fixed point exist.[7] There exist graphs which will fail to converge, or which will oscillate between multiple states over repeated iterations. Techniques like EXIT charts can provide an approximate visualization of the progress of belief propagation and an approximate test for convergence.
There are other approximate methods for marginalization including variational methods and Monte Carlo methods.
One method of exact marginalization in general graphs is called the junction tree algorithm, which is simply belief propagation on a modified graph guaranteed to be a tree. The basic premise is to eliminate cycles by clustering them into single nodes.
A similar algorithm is commonly referred to as the Viterbi algorithm, but also known as a special case of the max-product or min-sum algorithm, which solves the related problem of maximization, or most probable explanation. Instead of attempting to solve the marginal, the goal here is to find the values
x
\operatorname*{\argmax}xg(x).
An algorithm that solves this problem is nearly identical to belief propagation, with the sums replaced by maxima in the definitions.[8]
It is worth noting that inference problems like marginalization and maximization are NP-hard to solve exactly and approximately (at least for relative error) in a graphical model. More precisely, the marginalization problem defined above is
and maximization is NP-complete.
The memory usage of belief propagation can be reduced through the use of the Island algorithm (at a small cost in time complexity).
The sum-product algorithm is related to the calculation of free energy in thermodynamics. Let Z be the partition function. A probability distribution
P(X)=
1 | |
Z |
\prod | |
fj |
fj(xj)
(as per the factor graph representation) can be viewed as a measure of the internal energy present in a system, computed as
E(X)=-log
\prod | |
fj |
fj(xj).
The free energy of the system is then
F=U-H=\sumXP(X)E(X)+\sumXP(X)logP(X).
It can then be shown that the points of convergence of the sum-product algorithm represent the points where the free energy in such a system is minimized. Similarly, it can be shown that a fixed point of the iterative belief propagation algorithm in graphs with cycles is a stationary point of a free energy approximation.[9]
Belief propagation algorithms are normally presented as message update equations on a factor graph, involving messages between variable nodes and their neighboring factor nodes and vice versa. Considering messages between regions in a graph is one way of generalizing the belief propagation algorithm. There are several ways of defining the set of regions in a graph that can exchange messages. One method uses ideas introduced by Kikuchi in the physics literature,[10] [11] [12] and is known as Kikuchi's cluster variation method.[13]
Improvements in the performance of belief propagation algorithms are also achievable by breaking the replicas symmetry in the distributions of the fields (messages). This generalization leads to a new kind of algorithm called survey propagation (SP), which have proved to be very efficient in NP-complete problems like satisfiability[14] and graph coloring.
The cluster variational method and the survey propagation algorithms are two different improvements to belief propagation. The name generalized survey propagation (GSP) is waiting to be assigned to the algorithm that merges both generalizations.
Gaussian belief propagation is a variant of the belief propagation algorithm when the underlying distributions are Gaussian. The first work analyzing this special model was the seminal work of Weiss and Freeman.[15]
The GaBP algorithm solves the following marginalization problem:
P(xi)=
1 | |
Z |
\intj\exp(-\tfrac12xTAx+
Tx)dx | |
b | |
j |
where Z is a normalization constant, A is a symmetric positive definite matrix (inverse covariance matrix a.k.a. precision matrix) and b is the shift vector.
Equivalently, it can be shown that using the Gaussian model, the solution of the marginalization problem is equivalent to the MAP assignment problem:
\underset{x}{\operatorname{argmax}} P(x)=
1 | |
Z |
\exp(-\tfrac12xTAx+bTx).
This problem is also equivalent to the following minimization problem of the quadratic form:
\underset{x}{\operatorname{min}} 1/2xTAx-bTx.
Which is also equivalent to the linear system of equations
Ax=b.
Convergence of the GaBP algorithm is easier to analyze (relatively to the general BP case) and there are two known sufficient convergence conditions. The first one was formulated by Weiss et al. in the year 2000, when the information matrix A is diagonally dominant. The second convergence condition was formulated by Johnson et al.[16] in 2006, when the spectral radius of the matrix
\rho(I-|D-1/2AD-1/2|)<1
where D = diag(A). Later, Su and Wu established the necessary and sufficient convergence conditions for synchronous GaBP and damped GaBP, as well as another sufficient convergence condition for asynchronous GaBP. For each case, the convergence condition involves verifying 1) a set (determined by A) being non-empty, 2) the spectral radius of a certain matrix being smaller than one, and 3) the singularity issue (when converting BP message into belief) does not occur.[17]
The GaBP algorithm was linked to the linear algebra domain,[18] and it was shown that the GaBP algorithm can be viewed as an iterative algorithm for solving the linear system of equations Ax = b where A is the information matrix and b is the shift vector. Empirically, the GaBP algorithm is shown to converge faster than classical iterative methods like the Jacobi method, the Gauss - Seidel method, successive over-relaxation, and others.[19] Additionally, the GaBP algorithm is shown to be immune to numerical problems of the preconditioned conjugate gradient method[20]
The previous description of BP algorithm is called the codeword-based decoding, which calculates the approximate marginal probability
P(x|X)
X
P(e|s)
s
X
e
x=X+e
fa(Xa)
\forallxv\inDom(v), \muv(xv)=P(Xv)\prod
a*\inN(v)\setminus\{a\ |
}
\mu | |
a*\tov |
(xv).
where
P(Xv)
v
\forallxv\inDom(v), \mua(xv)=
\sum | |
x'a:x'v=xv |
\delta(syndrome({x}'v)={s})\prod
v*\inN(a)\setminus\{v\ |
This syndrome-based decoder doesn't require information on the received bits, thus can be adapted to quantum codes, where the only information is the measurement syndrome.
In the binary case,
xi\in\{0,1\}
2|\{v\|+|N(v)|}
Define log-likelihood ratio
lv=log
uv(xv=0) | |
uv(xv=1) |
La=log
ua(xv=0) | |
ua(xv=1) |
v\toa:lv=l
(0) | |
v |
+\sum | |
a*\inN(v)\setminus\{a\ |
a\tov:La=
sa | |
(-1) |
2\tanh-1
\prod | |
v*\inN(a)\setminus\{v\ |
where
(0) | |
l | |
v |
=log(P(xv=0)/P(xv=1))=const
The posterior log-likelihood ratio can be estimated as
lv=l
(0) | |
v |
+\suma(La)