Next Article in Journal
Entropy-Based Greedy Algorithm for Decision Trees Using Hypotheses
Next Article in Special Issue
ABCDP: Approximate Bayesian Computation with Differential Privacy
Previous Article in Journal
Psychomotor Predictive Processing
Previous Article in Special Issue
Understanding the Variability in Graph Data Sets through Statistical Modeling on the Stiefel Manifold
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Variational Message Passing and Local Constraint Manipulation in Factor Graphs

1
Department of Electrical Engineering, Eindhoven University of Technology, 5600 MB Eindhoven, The Netherlands
2
GN Hearing, JF Kennedylaan 2, 5612 AB Eindhoven, The Netherlands
*
Author to whom correspondence should be addressed.
Entropy 2021, 23(7), 807; https://doi.org/10.3390/e23070807
Submission received: 19 May 2021 / Revised: 18 June 2021 / Accepted: 22 June 2021 / Published: 24 June 2021
(This article belongs to the Special Issue Approximate Bayesian Inference)

Abstract

:
Accurate evaluation of Bayesian model evidence for a given data set is a fundamental problem in model development. Since evidence evaluations are usually intractable, in practice variational free energy (VFE) minimization provides an attractive alternative, as the VFE is an upper bound on negative model log-evidence (NLE). In order to improve tractability of the VFE, it is common to manipulate the constraints in the search space for the posterior distribution of the latent variables. Unfortunately, constraint manipulation may also lead to a less accurate estimate of the NLE. Thus, constraint manipulation implies an engineering trade-off between tractability and accuracy of model evidence estimation. In this paper, we develop a unifying account of constraint manipulation for variational inference in models that can be represented by a (Forney-style) factor graph, for which we identify the Bethe Free Energy as an approximation to the VFE. We derive well-known message passing algorithms from first principles, as the result of minimizing the constrained Bethe Free Energy (BFE). The proposed method supports evaluation of the BFE in factor graphs for model scoring and development of new message passing-based inference algorithms that potentially improve evidence estimation accuracy.

1. Introduction

Building models from data is at the core of both science and engineering applications. The search for good models requires a performance measure that scores how well a particular model m captures the hidden patterns in a data set D. In a Bayesian framework, that measure is the Bayesian evidence p ( D | m ) , i.e., the probability that model m would generate D if we were to draw data from m. The art of modeling is then the iterative process of proposing new model specifications, evaluating the evidence for each model and retaining the model with the most evidence [1].
Unfortunately, Bayesian evidence is intractable for most interesting models. A popular solution to evidence evaluation is provided by variational inference, which describes the process of Bayesian evidence evaluation as a (free energy) minimization process, since the variational free energy (VFE) is a tractable upper bound on Bayesian (negative log-)evidence [2]. In practice, the model development process then consists of proposing various candidate models, minimizing VFE for each model and selecting the model with the lowest minimized VFE.
The difference between VFE and negative log-evidence (NLE) is equal to the Kullback–Leibler divergence (KLD) [3] from the (perfect) Bayesian posterior distribution to the variational distribution for the latent variables in the model. The KLD can be interpreted as the cost of conducting variational rather than Bayesian inference. Perfect (Bayesian) inference would lead to zero inference costs (KLD = 0 ), and the KLD increases as the variational posterior diverges further from the Bayesian posterior. As a result, model development in a variational inference context is a balancing act, where we search for models that have both large amounts of evidence for the data and small inference costs (small KLD). In other words, in a variational inference context, the researcher has two knobs to tune models. The first knob alters the model specification, which affects model evidence. The second knob relates to constraining the search space for the variational posterior, which may affect the inference costs.
In this paper, we are concerned with developing algorithms for tuning the second knob. How do we constrain the range of variational posteriors so as to make variational inferences both tractable and accurate (resulting in low KLD)? We present our framework in the context of a (Forney-style) factor graph representation of the model [4,5]. In that context, variational inference can be understood as an automatable and efficient message passing-based inference procedure [6,7,8].
Traditional constraints include mean-field [6] and Bethe approximations [9,10]. However, more recently it has become clear how alternative local constraints, such as posterior factorization [11], expectation and chance constraints [12,13], and local Laplace approximation [14], may impact both tractability and inference accuracy, and thereby potentially lead to lower VFE. The main contribution of the current work lies in unifying the various ideas on local posterior constraints into a principled method for deriving variational message passing-based inference algorithms. The proposed method derives existing message passing algorithms, but also supports the development of new message passing variants.
Section 2 reviews Forney-style Factor Graphs (FFGs) and variational inference by minimizing the Bethe Free Energy (BFE). This review is continued in Section 3, where we discuss BFE optimization from a Lagrangian optimization viewpoint. In Appendix A, we include an example to illustrate that the Bayes rule can be derived from Lagrangian optimization with data constraints. Our main contribution lies in Section 4, which provides a rigorous treatment of the effects of imposing local constraints on the BFE and the resulting message update rules. We build upon several previous works that describe how manipulation of (local) constraints and variational objectives can be employed to improve variational approximations in the context of message passing. For example, ref. [12] shows how inference algorithms can be unified in terms of hybrid message passing by Lagrangian constraint manipulation. We extend this view by bringing form (Section 4.2) and factorization constraints (Section 4.1) into a constrained optimization framework. In [15], a high-level recipe for generating message passing algorithms from divergence measures is described. We apply their general recipe in the current work, where we adhere to the view on local stationary points for region-based approximations on general graphs [16]. In Appendix B, we also show that locally stationary solutions are also the global stationary solutions. In Section 5, we develop an algorithm for VFE evaluation in an FFG. In previous work, ref. [17] describes a factor softening approach to evaluate the VFE for models with deterministic factors. We extend this work in Section 5, and show how to avoid factor softening for both free energy evaluation and inference of posteriors. We show an example of how to compute VFE for a deterministic node in Appendix C. A more detailed comparison to related work is given in Section 7.
In the literature, proofs and descriptions of message passing-based inference algorithms are scattered across multiple papers and varying graphical representations, including Bayesian networks [6,18], Markov random fields [16], bi-partite (Tanner) factor graphs [12,17,19] and Forney-style factor graphs (FFGs) [5,11]. In Appendix D, we provide first-principle proofs for a large collection of familiar message passing algorithms in the context of Forney-style factor graphs, which is the preferred framework in the information and communication theory communities [4,20].

2. Factor Graphs and the Bethe Free Energy

2.1. Terminated Forney-Style Factor Graphs

A Forney-style factor graph (FFG) is an undirected graph G = ( V , E ) with nodes V and edges E V × V . We denote the neighboring edges of a node a V by E ( a ) . Vice versa, for an edge i E , the notation V ( i ) collects all neighboring nodes. As a notational convention, we index nodes by a , b , c and edges by i , j , k , unless stated otherwise. We will mainly use a and i as summation indices and use the other indices to refer to a node or edge of interest.
In this paper, we will frequently refer to the notion of a subgraph. We define an edge-induced subgraph by G ( i ) = ( V ( i ) , i ) , and a node-induced subgraph by G ( a ) = ( a , E ( a ) ) . Furthermore, we denote a local subgraph by G ( a , i ) = ( V ( i ) , E ( a ) ) , which collects all local nodes and edges around i and a, respectively.
An FFG can be used to represent a factorized function,
f ( s ) = a V f a ( s a ) ,
where s a collects the argument variables of factor f a . We assumed that all the factors are positive. In an FFG, a node a V corresponds to a factor f a , and the neighboring edges E ( a ) correspond to the variables s a that are the arguments of f a .
As an example model, the following factorization (2), the corresponding FFG of which is shown in Figure 1.
f ( s 1 , , s 5 ) = f a ( s 1 ) f b ( s 1 , s 2 , s 3 ) f c ( s 2 ) f d ( s 3 , s 4 , s 5 ) f e ( s 5 ) .
The FFG of Figure 1 consists of five nodes V = { a , , e } , as annotated by their corresponding factor functions, and five edges E = { ( a , b ) , , ( d , e ) } as annotated by their corresponding variables. An edge that connects to only one node (e.g., the edge for s 4 ) is called a half-edge. In this example, the neighborhood E ( b ) = { ( a , b ) , ( b , c ) , ( b , d ) } and V ( ( b , c ) ) = { b , c } .
In the FFG representation, a node can be connected to an arbitrary number of edges, while an edge can only be connected to at most two nodes. Therefore, FFGs often contain “equality nodes” that constrain connected edges to carry identical beliefs, with the implication that these beliefs can be made available to more than two factors. An equality node has the factor function
f a ( s i , s j , s k ) = δ ( s j s i ) δ ( s j s k ) ,
for which the node-induced subgraph G ( a ) is drawn in Figure 2.
If every edge in the FFG has exactly two connected nodes (including equality nodes), then we designate the graph as a terminated FFG (TFFG). Since multiplication of a function f ( s ) by 1 does not alter the function, any FFG can be terminated by connecting any half-edge i to a node a that represents the unity factor f a ( s i ) = 1 .
In Section 4.2 we discuss form constraints on posterior distributions. If such a constraint takes on a Dirac-delta functional form, then we visualize the constraint on the FFG by a small circle in the middle of the edge. For example, the small shaded circle in Figure 11 indicates that the variable has been observed. In Section 4.3.2 we consider form constraints in the context of optimization, in which case the circle annotation will be left open (see, e.g., Figure 14).

2.2. Variational Free Energy

Given a model f ( s ) and a (normalized) probability distribution q ( s ) , we can define a Variational Free Energy (VFE) functional as
F [ q , f ] q ( s ) log q ( s ) f ( s ) d s .
Variational inference is concerned with finding solutions to the minimization problem
q * ( s ) = arg min q Q F [ q , f ] ,
where Q imposes some constraints on q.
If q is unconstrained, then the optimal solution is obtained for q * ( s ) = p ( s ) , with p ( s ) = 1 Z f ( s ) being the exact posterior, and Z = f ( s ) d s a normalizing constant that is commonly referred to as the evidence. The minimum value of the free energy then follows as the negative log-evidence (NLE),
F [ q * , f ] = log Z ,
which is also known as the surprisal. The NLE can be interpreted as a measure of model performance, where low NLE is preferred.
As an unconstrained search space for q grows exponentially with the number of variables, the optimization of (5) quickly becomes intractable beyond the most basic models. Therefore, constraints and approximations to the variational free energy (4) are often utilized. As a result, the constrained variational free energy with q * Q bounds the NLE by
F [ q * , f ] = log Z + q * ( s ) log q * ( s ) p ( s ) d s ,
where the latter term expresses the divergence from the (intractable) exact solution to the optimal variational belief.
In practice, the functional form of q ( s ) = q ( s ; θ ) is often parameterized, such that gradients of F can be derived w.r.t. the parameters θ . This effectively converts the variational optimization of F [ q , f ] to a parametric optimization of F ( θ ) as a function of θ . This problem can then be solved by a (stochastic) gradient descent procedure [21,22].
In the context of variational calculus, while form constraints may lead to interesting properties (see Section 4.2), they are generally not required. Interestingly, in a variational optimization context, the functional form of q is often not an assumption, but rather a result of optimization (see Section 4.3.1). An example of variational inference is provided in Appendix A.

2.3. Bethe Free Energy

The Bethe approximation enjoys a unique place in the landscape of Q , because the Bethe free energy (BFE) defines the fundamental objective of the celebrated belief propagation (BP) algorithm [17,23]. The origin of the Bethe approximation is rooted in tree-like approximations to subgraphs (possibly containing cycles) by enforcing local consistency conditions on the beliefs associated with edges and nodes [24].
Given a TFFG G = ( V , E ) for a factorized function f ( s ) = a V f a ( s a ) (1), the Bethe free energy (BFE) is defined as [25]:
F [ q , f ] a V q a ( s a ) log q a ( s a ) f a ( s a ) d s a F [ q a , f a ] + i E q i ( s i ) log 1 q i ( s i ) d s i H [ q i ]
such that the factorized beliefs
q ( s ) = a V q a ( s a ) i E q i ( s i ) 1
satisfy the following constraints:
q a ( s a ) d s a = 1 , for all a V
q a ( s a ) d s a i = q i ( s i ) , for all a V and all i E ( a ) .
Together, the normalization constraint (9a) and marginalization constraint (9b) imply that the edge marginals are also normalized:
q i ( s i ) d s i = 1 , for all i E .
The Bethe free energy (7) includes a local free energy term F [ q a , f a ] for each node a V , and an entropy term H [ q i ] for each edge i E . Note that the local free energy also depends on the node function f a , as specified in the factorization of f (1), whereas the entropy only depends on the local belief q i .
The Bethe factorization (8) and constraints are summarized by the local polytope [26]
L ( G ) = q a for all a V s . t . ( 9 a ) , and q i for all i E ( a ) s . t . ( 9 b ) ,
which defines the constrained search space for the factorized variational distribution (8).

2.4. Problem Statement

In this paper, the problem is to find the beliefs in the local polytope that minimize the Bethe free energy
q * ( s ) = arg min q L ( G ) F [ q , f ] ,
where q is defined by (8), and where q L ( G ) offers a shorthand notation for optimizing over the individual beliefs in the local polytope. In the following sections, we will follow the Lagrangian optimization approach to derive various message passing-based inference algorithms.

2.5. Sketch of Solution Approach

The problem statement of Section 2.4 defines a global minimization of the beliefs in the Bethe factorization. Instead of solving the global optimization problem directly, we employ the factorization of the variational posterior and local polytope to subdivide the global problem statement in multiple interdependent local objectives.
From the BFE objective (12) and local polytope of (11), we can construct the Lagrangian
L [ q , f ] = a V F [ q a , f a ] + a V ψ a q a ( s a ) d s a 1 + a V i E ( a ) λ i a ( s i ) q i ( s i ) q a ( s a ) d s a i d s i + i E H [ q i ] + i E ψ i q i ( s i ) d s i 1 ,
where the Lagrange multipliers ψ a , ψ i and λ i a enforce the normalization and marginalization constraints of (9). It can be seen that this Lagrangian contains local beliefs q a and q i , which are coupled through the λ i a Lagrange multipliers. The Lagrange multipliers λ i a are doubly indexed, because there is a multiplier associated with each marginalization constraint. The Lagrangian method then converts a constrained optimization problem of F [ q , f ] to an unconstrained optimization problem of L [ q , f ] . The total variation of the Lagrangian (13) can then be approached from the perspective of variations of the individual (coupled) local beliefs.
More specifically, given a locally connected pair b V , j E ( b ) , we can rewrite the optimization of (12) in terms of the local beliefs q b , q j , and the constraints in the local polytope
L ( G ( b , j ) ) = q b s . t . ( 9 a ) , and q j s . t . ( 9 b ) ,
that pertains to these beliefs. The problem then becomes finding local stationary solutions
{ q b * , q j * } = arg min L ( G ( b , j ) ) F [ q , f ] .
Using (13), the optimization of (15) can then be written in the Lagrangian form
q b * = arg min q b L b [ q b , f b ] ,
q j * = arg min q j L j [ q j ] ,
where the Lagrangians L b and L j include the local polytope of (14) to rewrite (13) as an explicit functional of beliefs q b and q j (see, e.g., Lemmas 1 and 2). The combined stationary solutions to the local objectives then also comprise a stationary solution to the global objective (Appendix B).
The current paper shows how to identify stationary solutions to local objectives of the form (15), with the use of variational calculus, under varying constraints as imposed by the local polytope (14). Interestingly, the resulting fixed-point equations can be interpreted as message passing updates on the underlying TFFG representation of the model. In the following Section 3 and Section 4, we derive the local stationary solutions under a selection of constraints and show how these relate to known message passing update rules (Table 1). It then becomes possible to derive novel message updates and algorithms by simply altering the local polytope.

3. Bethe Lagrangian Optimization by Message Passing

3.1. Stationary Points of the Bethe Lagrangian

We wish to minimize the Bethe free energy under variations of the variational density. As the Bethe free energy factorizes over factors and variables (7), we first consider variations on separate node- and edge-induced subgraphs.
Lemma 1.
Given a TFFG G = ( V , E ) , consider the node-induced subgraph G ( b ) (Figure 3). The stationary points of the Lagrangian (16a) as a functional of q b ,
L b [ q b , f b ] = F [ q b , f b ] + ψ b q b ( s b ) d s b 1 + i E ( b ) λ i b ( s i ) q i ( s i ) q b ( s b ) d s b i d s i + C b ,
where C b collects all terms that are independent of q b , which are of the form
q b ( s b ) = f b ( s b ) i E ( b ) μ i b ( s i ) f b ( s b ) i E ( b ) μ i b ( s i ) d s b .
Proof. 
See Appendix D.1. □
The μ i b ( s i ) are any set of positive functions that makes (18) satisfy (9b), and will be identified in Theorem 1.
Lemma 2.
Given a TFFG G = ( V , E ) , consider an edge-induced subgraph G ( j ) (Figure 4). The stationary points of the Lagrangian (16b) as a functional of q j ,
L j [ q j ] = H [ q j ] + ψ j q j ( s j ) d s j 1 + a V ( j ) λ j a ( s j ) q j ( s j ) q a ( s a ) d s a j d s j + C j ,
where C j collects all terms that are independent of q j , are of the form
q j ( s j ) = μ j b ( s j ) μ j c ( s j ) μ j b ( s j ) μ j c ( s j ) d s j .
Proof. 
See Appendix D.2. □

3.2. Minimizing the Bethe Free Energy by Belief Propagation

We now combine Lemmas 1 and 2 to derive the sum-product message update.
Theorem 1
(Sum-Product Message Update). Given a TFFG G = ( V , E ) , consider the induced subgraph G ( b , j ) (Figure 5). Given the local polytope L ( G ( b , j ) ) of (14), then the local stationary solutions to (15) are given by
q b * ( s b ) = f b ( s b ) i E ( b ) μ i b * ( s i ) f b ( s b ) i E ( b ) μ i b * ( s i ) d s b
q j * ( s j ) = μ j b * ( s j ) μ j c * ( s j ) μ j b * ( s j ) μ j c * ( s j ) d s j ,
with messages μ j c * ( s j ) corresponding to the fixed points of
μ j c ( k + 1 ) ( s j ) = f b ( s b ) i E ( b ) i j μ i b ( k ) ( s i ) d s b j ,
with k representing an iteration index.
Proof. 
See Appendix D.3. □
The sum-product algorithm has proven to be useful in many engineering applications and disciplines. For example, it is widely used for decoding in communication systems [4,20,27]. Furthermore, for a linear Gaussian state space model, Kalman filtering and smoothing can be expressed in terms of sum-product message passing for state inference on a factor graph [28,29]. This equivalence has inspired applications ranging from localization [30] to estimation [31].
The sum-product algorithm with updates (22) obtains the exact Bayesian posterior when the underlying graph is a tree [24,25,32]. Application of the sum-product algorithm to cyclic graphs is not guaranteed to converge and might lead to oscillations in the BFE over iterations. Theorems 3.1 and 3.2 in [33] show that the BFE of a graph with a single cycle is convex, which implies that the sum-product algorithm will converge in this case. Moreover, ref. [19] shows that it is possible to obtain a double-loop message passing algorithm if the graph has a cycle such that the stable fixed points will correspond to local minima of the BFE.
Example 1.
A Linear Dynamical System Considering a Linear Gaussian state space model specified by the following factors:
g 0 ( x 0 ) = N ( x 0 | m x 0 , V x 0 )
g t ( x t 1 , z t , A t ) = δ ( z t A t x t 1 )
h t ( x t , z t , Q t ) = N ( x t | z t , Q t 1 )
n t ( x t , x t , x t ) = δ ( x t x t ) δ ( x t x t )
m t ( o t , x t , B t ) = δ ( o t B t x t )
r t ( y t , o t , R t ) = N ( y t | o t , R t 1 ) .
The FFG corresponding to the one time segment of the state space model is given in Figure 6. We assumed that we know the following matrices that are used to generate the data:
A ^ t = cos ( θ ) sin ( θ ) sin ( θ ) cos ( θ ) , Q ^ t 1 = 3 0.1 0.1 2 , B ^ t = 1 0 0 1 , R ^ t 1 = 10 2 2 20
with θ = π / 8 . Given a collection of observations y ^ = { y ^ 1 , , y ^ T } , we constrain the latent states x = { x 0 , , x T } by local marginalization and normalization constraints (for brevity we omit writing the normalization constraints explicitly) in accordance with Theorem 1, i.e.,
q ( x t 1 , z t , A t ) d x t 1 d z t = q ( A t ) , q ( x t 1 , z t , A t ) d A t = q ( z t | x t 1 ) q ( x t 1 )
q ( x t , z t , Q t ) d x t d z t = q ( Q t ) , q ( x t , z t , Q t ) d z t d Q t = q ( x t ) , q ( x t , z t , Q t ) d x t d Q t = q ( z t )
q ( x t , x t , x t ) = q ( x t ) δ ( x t x t ) δ ( x t x t )
q ( o t , x t , B t ) d o t , d x t = q ( B t ) , q ( o t , x t , B t ) d B t = q ( o t | x t ) q ( x t )
q ( o t , y t , R t ) d o t d y t = q ( R t ) , q ( o t , y t , R t ) d R t d o t = q ( y t ) , q ( o t , y t , R t ) d R t d y t = q ( o t )
Moreover, we use data constraints in accordance with Theorem 3 (explained in Section 4.2.1) for the observations, state transition matrices and precision matrices, i.e.,
q ( y t ) = δ ( y t y ^ t ) , q ( A t ) = δ ( A t A ^ t ) , q ( B t ) = δ ( B t B ^ t ) , q ( Q t ) = δ ( Q t Q ^ t ) , q ( R t ) = δ ( R t R ^ t ) .
Computation of sum-product messages by (22) is analytically tractable and detailed algebraic manipulation can be found in [31]. If the backwards messages are not passed, then the resulting sum-product message passing algorithm is equivalent to Kalman filtering and if both forward and backward messages are propagated, then the Rauch–Tung–Striebel smoother is obtained [34] (Ch. 8).
We generated T = 100 observations y ^ using the matrices specified in (24) and the initial condition x ^ 0 = [ 5 , 5 ] . Due to (23a), we have μ x 0 g 1 = N ( m x 0 , V x 0 ) . We chose V x 0 = 100 · I and m x 0 = x ^ 0 . Under these constraints, the results of sum-product message passing and Bethe free energy evaluation is given in Figure 6. As the underlying graph is a tree, sum-product message passing results are exact and the evaluated BFE corresponds to negative log-evidence. In the follow-up Example 2, we will modify the constraints and give a comparative free energy plot for the examples in Figures 10 and 16.

4. Message Passing Variations through Constraint Manipulation

For generic node functions with arbitrary connectivity, there is no guarantee that the sum-product updates can be solved analytically. When analytic solutions are not possible, there are two ways to proceed. One way is to try to solve the sum-product update equations numerically, e.g., by Monte Carlo methods. Alternatively, we can add additional constraints to the BFE that leads to simpler update equations at the cost of inference accuracy. In the remainder of the paper, we explore a variety of constraints that have proven to yield useful inference solutions.

4.1. Factorization Constraints

Additional factorizations of the variational density q a ( s a ) are often assumed to ease computation. In particular, we assumed a structured mean-field factorization such that
q b ( s b ) n l ( b ) q b n ( s b n ) ,
where n indicates a local cluster as a set of edges. To define a local cluster rigorously, let us first denote by P ( a ) the power set of an edge set E ( a ) , where the power set is the set of all subsets of E ( a ) . Then, a mean-field factorization l ( a ) P ( a ) can be chosen such that all elements in E ( a ) are included in l ( a ) exactly once. Therefore, l ( a ) is defined as a set of one or multiple sets of edges. For example, if E ( a ) = { i , j , k } , then l ( a ) = { { i } , { j , k } } is allowed, as is l ( a ) = { { i , j , k } } itself, but l ( a ) = { { i , j } , { j , k } } is not allowed, since the element j occurs twice. More formally, in (26), the intersection of the super- and subscript collects the required variables, see Figure 7 for an example. The special case of a fully factorized l ( b ) for all edges i E ( b ) is known as the naive mean-field factorization [11,24].
We will analyze the effect of a structured mean-field factorization (26) on the Bethe free energy (7) for a specific factor node b V . Substituting (26) in the local free energy for factor b yields
F [ q b , f b ] = F [ { q b n } , f b ] = n l ( b ) q b n ( s b n ) log q b n ( s b n ) d s b n n l ( b ) q b n ( s b n ) log f b ( s b ) d s b .
We are then interested in
q b m , * = arg min q b m L b m [ q b m , f b ] ,
where the Lagrangian L b m (Lemma 3) enforces the normalization and marginalization constraints
q b m ( s b m ) d s b m = 1 ,
q b m ( s b m ) d s b i m = q i ( s i ) , for all i m , m l ( b ) .
Lemma 3.
Given a terminated FFG G = ( V , E ) , consider a node-induced subgraph G ( b ) with a structured mean-field factorization l ( b ) (e.g., Figure 7). Then, local stationary solutions to the Lagrangian
L b m [ q b m ] = q b m ( s b m ) log q b m ( s b m ) d s b m n l ( b ) q b n ( s b n ) log f b ( s b ) d s b + ψ b m q b m ( s b m ) d s b m 1 + i m λ i b ( s i ) q i ( s i ) q b m ( s b m ) d s m i d s i + C b m ,
where C b m collects all terms independent of q b m , which are of the form
q b m ( s b m ) = f ˜ b m ( s b m ) i m μ i b ( s i ) f ˜ b m ( s b m ) i m μ i b ( s i ) d s b m ,
where
f ˜ b m ( s b m ) = exp n l ( b ) n m q b n ( s b n ) log f b ( s b ) d s b m .
Proof. 
See Appendix D.4. □

4.1.1. Structured Variational Message Passing

We now combine Lemmas 2 and 3 to derive the structured variational message passing algorithm.
Theorem 2.
Structured variational message passing: Given a TFFG G = ( V , E ) , consider the induced subgraph G ( b , j ) with a structured mean-field factorization l ( b ) P ( b ) , with local clusters n l ( b ) . Let m l ( b ) be the cluster where j m (see, e.g., Figure 8). Given the local polytope
L ( G ( b , j ) ) = q b n f o r a l l n l ( b ) s . t . ( 29 a ) , a n d q j s . t . ( 29 b ) ,
then local stationary solutions to
{ q b m , * , q j * } = arg min L ( G ( b , j ) ) F [ q , f ] ,
are given by
q b m , * ( s b m ) = f ˜ b m , * ( s b m ) i m μ i b * ( s i ) f ˜ b m , * ( s b m ) i m μ i b * ( s i ) d s b m
q j * ( s j ) = μ j b * ( s j ) μ j c * ( s j ) μ j b * ( s j ) μ j c * ( s j ) d s j ,
with messages μ j c * ( s j ) corresponding to the fixed points of
μ j c ( k + 1 ) ( s j ) = f ˜ b m , ( k ) ( s b m ) i m i j μ i b ( k ) ( s i ) d s b j m ,
with iteration index k, and where
f ˜ b m , ( k ) = exp n l ( b ) n m q b n , ( k ) ( s b n ) log f b ( s b ) d s b m .
Proof. 
See Appendix D.5. □
The structured mean-field factorization applies the marginalization constraint only to the local cluster beliefs, as opposed to the joint node belief. As a result, computation for the local cluster beliefs might become tractable [24] (Ch.5). The practical appeal of Variational Message Passing (VMP) based inference becomes evident when the underlying model is composed of conjugate factor pairs from the exponential family. When the underlying factors are conjugate exponential family distributions, the message passing updates (36) amounts to adding natural parameters [35] of the underlying exponential family distributions. Structured variational message passing is popular in acoustic signal modelling, e.g., [36], as it allows one to be able to keep track of correlations over time. In [37], a stochastic variant of structured variational inference is utilized for Latent Dirichlet Allocation. Structured approximations are also used to improve inference in auto-encoders. In [38], inference involving non-parametric Beta-Bernoulli process priors is improved by developing a structured approximation to variational auto-encoders. When the data being modelled are time series, structured approximations reflect the transition structure over time. In [39], an efficient structured black-box variational inference algorithm for fitting Gaussian variational models to latent time series is proposed.
Example 2.
Consider the linear Gaussian state space model of Example 1. Let us assume that the precision matrix for latent-state transitions Q t is not known and can not be constrained by data. Then, we can augment state space model by including a prior for Q t and try to infer a posterior over Q t from the observations. Since Q t is the precision of a normal factor, we chose a conjugate Wishart prior and assumed that Q t is time-invariant by adding the following factors
w 0 ( Q 0 , V , ν ) = W ( Q 0 | V , ν )
w t ( Q t 1 , Q t , Q t + 1 ) = δ ( Q t 1 Q t ) δ ( Q t Q t + 1 ) , f o r e v e r y t = 1 , , T .
It is certainly possible to assume a time-varying structure for Q t ; however, our purpose is to illustrate a change in constraints rather than analyzing time-varying properties. This is why we assume time-invariance.
In this setting, the sum-product equations around the factor h t are not analytically tractable. Therefore, we changed the constraints associated with h t (25b) to those given in Theorem 2 as follows
q ( x t , z t , Q t ) d x t d z t = q ( Q t ) , q ( x t , z t , Q t ) d Q t = q ( x t , z t )
q ( Q t ) d Q t = 1 , q ( x t , z t ) d x t d z t = 1 .
We removed the data constraint on q ( Q t ) and instead included data constraints on the hyper-parameters
q ( V ) = δ ( V V ^ ) , q ( ν ) = δ ( ν ν ^ ) .
With the new set of constraints ((39a) and (39b)), we obtained a hybrid of the sum-product and structured VMP algorithm, where structured messages around the factor h t are computed by (36) and the rest of the messages are computed by the sum-product (22). One time segment of the modified FFG along with the messages is given Figure 9. We used the same observations y ^ that were generated in Example 1 and the same initialization for the hidden states. For the hyper-parameters of the Wishart prior, we chose V ^ = 0.1 · I and ν ^ = 2 . Under these constraints, the result of structured variational message passing results along with the Bethe free energy evaluation is given in Figure 9.

4.1.2. Naive Variational Message Passing

As a corollary of Theorem 2, we can consider the special case of a naive mean-field factorization, which is defined for node b as
q b ( s b ) = i E ( b ) q i ( s i ) .
The naive mean-field constraint (41) transforms the local free energy into
F [ q b , f b ] = F [ { q i } , f b ] = i E ( b ) q i ( s i ) log q i ( s i ) d s i i E ( b ) q i ( s i ) log f b ( s b ) d s b .
Corollary 1.
Naive Variational Message Passing: Given a TFFG G = ( V , E ) , consider the induced subgraph G ( b , j ) with a naive mean-field factorization l ( b ) = { i such that for all i E ( b ) } . Let m l ( b ) be the cluster where j = m . Given the local polytope of (33), the local stationary solutions to (34) are given by
q b m , * ( s b m ) = q j * ( s j ) = μ j b * ( s j ) μ j c * ( s j ) μ j b * ( s j ) μ j c * ( s j ) d s j ,
where the messages μ j c * ( s j ) are the fixed points of the following iterations
μ j c ( k + 1 ) ( s j ) = exp i E ( b ) i j q i ( k ) ( s i ) log f b ( s b ) d s b j ,
where k is an iteration index.
Proof. 
See Appendix D.6. □
The naive mean-field factorization limits the search space of beliefs by imposing strict constraints on the variational posterior. As a result, the variational posterior also loses flexibility. To improve inference performance for sparse Bayesian learning, the authors of [40] proposes a hybrid mechanism by augmenting naive mean-field VMP with sum-product updates. This hybrid scheme reduces the complexity of the sum-product algorithm, while improving the accuracy of the naive VMP approach. In [41], naive VMP is applied to semi-parametric regression and allows for scaling of regression models to large data sets.
Example 3.
As a follow up on Example 2, we relaxed the constraints in ((39a) and (39b)) to the following constraints presented in Corollary 1 as
q ( x t , z t , Q t ) d x t d z t = q ( Q t ) , q ( x t , z t , Q t ) d Q t = q ( x t , z t ) = q ( x t ) q ( z t )
q ( Q t ) d Q t = 1 , q ( x t ) d x t = 1 , q ( z t ) d z t = 1 .
The FFG remains the same and we use identical data constraints as in Example 2. Together with constraint (44), we obtained a hybrid of naive variational message passing and sum-product message passing algorithm where the messages around the factor h t are computed by (43) and the rest of the messages by sum-product (22). Using the same data as in Example 1, the results for naive VMP are given in Figure 10 along with the evaluated Bethe free energy.

4.2. Form Constraints

Form constraints limit the functional form of the variational factors q a ( s a ) and q i ( s i ) . One of the most widely used form constraints, the data constraint, is also illustrated in Appendix A.

4.2.1. Data Constraints

A data constraint can be viewed as a special case of (9b), where the belief q j is constrained to be a Dirac-delta function [42], such that
q a ( s a ) d s a j = q j ( s j ) = δ ( s j s ^ j ) ,
where s ^ j is a known value, e.g., an observation.
Lemma 4.
Given a TFFG G = ( V , E ) , consider the node-induced subgraph G ( b ) (Figure 3). Then local stationary solutions to the Lagrangian
L b [ q b , f b ] = F [ q b , f b ] + ψ b q b ( s b ) d s b 1 + i E ( b ) i j λ i b ( s i ) q i ( s i ) q b ( s b ) d s b i d s i + λ j b ( s j ) δ ( s j s ^ j ) q b ( s b ) d s b j d s j + C b .
where C b collects all terms that are independent of q b , are of the form
q b ( s b ) = f b ( s b ) i E ( b ) μ i b ( s i ) f b ( s b ) i E ( b ) μ i b ( s i ) d s b .
Proof. 
See Appendix D.7. □
Theorem 3.
Data-Constrained Sum-Product: Given a TFFG G = ( V , E ) , consider the induced subgraph G ( b , j ) (Figure 11). Given the local polytope
L ( G ( b , j ) ) = { q b s . t . ( 45 ) } ,
the local stationary solutions to
q b * = arg min L ( G ( b , j ) ) F [ q , f ] ,
are of the form
q b * ( s b ) = f b ( s b ) i E ( b ) μ i b * ( s i ) f b ( s b ) i E ( b ) μ i b * ( s i ) d s b ,
with message
μ j b * ( s j ) = δ ( s j s ^ j ) .
Proof. 
See Appendix D.8. □
Note that the resulting message μ j b * ( s j ) to node b does not depend on messages from node c, as would be the case for a sum-product update. By the symmetry of Theorem 3 for the subgraph L { G ( c , j ) } , (A32) identifies
μ c j ( s j ) = f c ( s c ) i E ( c ) i j μ i c ( s i ) d s c j δ ( s j s ^ j ) .
This implies that messages incoming to a data constraint (such as μ c j ) are not further propagated through the data constraint. The data constraint thus effectively introduces a conditional independence between the variables of neighboring factors (conditioned on the shared constrained variable). Interestingly, this is similar to the notion of an intervention [43], where a decision variable is externally forced to a realization.
Data constraints allow information from data sets to be absorbed into the model. Essentially, (variational) Bayesian machine learning is an application of inference in a graph with data constraints. In our framework, data are a constraint, and machine learning via Bayes rule follows naturally from the minimization of the Bethe free energy (see also Appendix A).

4.2.2. Laplace Propagation

A second type of form constraint we consider is the Laplace constraint, see also [14]. Consider a second-order Taylor approximation on the local log-node function
L a ( s a ) = log f a ( s a ) ,
around an approximation point s ^ a , as
L ˜ a ( s a ; s ^ a ) = L a ( s ^ a ) + L a ( s ^ a ) s a s ^ a + 1 2 s a s ^ a 2 L a ( s ^ a ) s a s ^ a .
From this approximation, we define the Laplace-approximated node function as
f ˜ a ( s a ; s ^ a ) exp L ˜ a ( s a ; s ^ a ) ,
which is substituted in the local free energy to obtain the Laplace-encoded local free energy as
F [ q a , f ˜ a ; s ^ a ] = q a ( s a ) log q a ( s a ) f ˜ a ( s a ; s ^ a ) d s a .
It follows that the Laplace-encoded optimization of the local free energy becomes
q a * = arg min q a L a [ q a , f ˜ a ; s ^ a ] ,
where the Lagrangian L a imposes the marginalization and normalization constraints of (9) on (54).
Lemma 5.
Given a TFFG G = ( V , E ) , consider the node-induced subgraph G ( b ) (Figure 12). The stationary points of the Laplace-approximated Lagrangian (55) as a functional of q b ,
L b [ q b , f ˜ b ; s ^ b ] = F [ q b , f ˜ b ; s ^ b ] + ψ b q b ( s b ) d s b 1 + i E ( b ) λ i b ( s i ) q i ( s i ) q b ( s b ) d s b i d s i + C b ,
where C b collects all terms that are independent of q b , which are of the form
q b ( s b ) = f ˜ b ( s b ; s ^ b ) i E ( b ) μ i b ( s i ) f ˜ b ( s b ; s ^ b ) i E ( b ) μ i b ( s i ) d s b .
Proof. 
See Appendix D.9. □
We can now formulate Laplace propagation as an iterative procedure, where the approximation point s ^ b is chosen as the mode of the belief q b ( s b ) .
Theorem 4.
Laplace Propagation: Given a TFFG G = ( V , E ) , consider the induced subgraph G ( b , j ) (Figure 13) with the Laplace-encoded factor f ˜ b as per (53). We write the model (1) with the Laplace-encoded factor f ˜ b substituted for f b , as f ˜ . Given the local polytope L ( G ( b , j ) ) of (14), the local stationary solutions to
{ q b * , q j * } = arg min L ( G ( b , j ) ) F [ q , f ˜ ; s ^ b ] ,
are given by
q b * ( s b ) = f ˜ b ( s b ; s ^ b * ) i E ( b ) μ i b * ( s i ) f ˜ b ( s b ; s ^ b * ) i E ( b ) μ i b * ( s i ) d s b q j * ( s j ) = μ j b * ( s j ) μ j c * ( s j ) μ j b * ( s j ) μ j c * ( s j ) d s j ,
with s ^ b * and the messages μ j c * ( s j ) the fixed points of
s ^ b ( k ) = arg max s b log q b ( k ) ( s b ) q b ( k + 1 ) ( s b ) = f ˜ b ( s b ; s ^ b ( k ) ) i E ( b ) μ i b ( k ) ( s i ) f ˜ b ( s b ; s ^ b ( k ) ) i E ( b ) μ i b ( k ) ( s i ) d s b μ j c ( k + 1 ) ( s j ) = f ˜ b ( s b ; s ^ b ( k ) ) i E ( b ) i j μ i b ( k ) ( s i ) d s b j .
Proof. 
See Appendix D.10. □
A Laplace propagation is introduced in [14] as an algorithm that propagates mean and variance information when exact updates are expensive to compute. Laplace propagation has found applications in the context of Gaussian processes and support vector machines [14]. In the jointly normal case, Laplace propagation coincides with sum-product and expectation propagation [14,18].

4.2.3. Expectation Propagation

Expectation propagation can be derived in terms of constraint manipulation by relaxing the marginalization constraints to expectation constraints. Expectation constraints are of the form
q a ( s a ) T i ( s i ) d s a = q i ( s i ) T i ( s i ) d s i ,
for a given function (statistic) T i ( s i ) . Technically, the statistic T i ( s i ) can be chosen arbitrarily. Nevertheless, they are often chosen as sufficient statistics of an exponential family distribution. An exponential family distribution is defined by
q i ( s i ) = h ( s i ) exp η i T i ( s i ) log Z ( η i ) ,
where η i is the natural parameter, Z ( η i ) is the partition function, T i ( s i ) is the sufficient statistics and h ( s i ) is a base measure [24]. The reason T i ( s i ) is a sufficient statistic is because if there are observed values of the random variable s i , then the parameter η i can be estimated by using only the statistics T i ( s i ) . This means that the estimator of η i will depend only on the statistics.
The idea behind expectation propagation [18] is to relax the marginalization constraints with moment-matching constraints by choosing sufficient statistics from exponential family distributions [12]. Relaxation allows approximating the marginals of the sum-product algorithm with exponential family distributions. By keeping the marginals within the exponential family, the complexity of the resulting computations is reduced.
Lemma 6.
Given a TFFG G = ( V , E ) , consider the node-induced subgraph G ( b ) (Figure 3). The stationary points of the Lagrangian
L b [ q b , f b ] = F [ q b , f b ] + ψ b q b ( s b ) d s b 1 + i E ( b ) i j λ i b ( s i ) q i ( s i ) q b ( s b ) d s b i d s i +
η j b q j ( s j ) T j ( s j ) d s j q b ( s b ) T j ( s j ) d s b + C b ,
with sufficient statistics T j , and where C b collects all terms that are independent of q b , are of the form
q b ( s b ) = f b ( s b ) i E ( b ) μ i b ( s i ) f b ( s b ) i E ( b ) μ i b ( s i ) d s b ,
with incoming exponential family message
μ j b ( s j ) = exp η j b T j ( s j ) .
Proof. 
See Appendix D.11. □
Lemma 7.
Given a TFFG G = ( V , E ) , consider an edge-induced subgraph G ( j ) (Figure 4). The stationary solutions of the Lagrangian
L j [ q j ] = H [ q j ] + ψ j q j ( s j ) d s j 1 + a V ( j ) η j a q j ( s j ) T j ( s j ) d s j q a ( s a ) T j ( s j ) d s a + C j ,
with sufficient statistics T j ( s j ) , and where C j collects all terms that are independent of q j , are of the form
q j ( s j ) = exp [ η j b + η j c ] T j ( s j ) exp [ η j b + η j c ] T j ( s j ) d s j .
Proof. 
See Appendix D.12. □
Theorem 5.
Expectation Propagation: Given a TFFG G = ( V , E ) , consider the induced subgraph G ( b , j ) (Figure 5). Given the local polytope
L ( G ( b , j ) ) = q b s . t . ( 9 a ) , a n d q j s . t . ( 59 ) a n d ( 10 ) ,
and μ j b ( s j ) = exp η j b T j ( s j ) an exponential family message (from Lemma 6). Then, the local stationary solutions to (15) are given by
q b * ( s b ) = f b ( s b ) i E ( b ) μ i b * ( s i ) f b ( s b ) i E ( b ) μ i b * ( s i ) d s b
q j * ( s j ) = exp [ η j b * + η j c * ] T j ( s j ) exp [ η j b * + η j c * ] T j ( s j ) d s j ,
with η j b * , η j c * and μ j c * ( s j ) being the fixed points of the iterations
μ ˜ j c ( k ) ( s j ) = f b ( s b ) i E ( b ) i j μ i b ( k ) ( s i ) d s b j q ˜ j ( k ) ( s j ) = μ j b ( k ) ( s j ) μ ˜ j c ( k ) ( s j ) μ j b ( k ) ( s j ) μ ˜ j c ( k ) ( s j ) d s j .
By moment-matching on q ˜ j ( k ) ( s j ) , we obtain the natural parameter η ˜ j ( k ) . The message update then follows from
η j c ( k ) = η ˜ j ( k ) η j b ( k ) μ j c ( k + 1 ) ( s j ) = exp T j ( s j ) η j c ( k ) .
Proof. 
See Appendix D.13. □
Moment-matching can be performed by solving [24] (Proposition 3.1)
η j log Z j ( η j ) = q ˜ j ( s j ) T j ( s j ) d s j
for η j , where
Z j ( η j ) = exp η j T j ( s j ) d s j .
In practice, for a Gaussian approximation, the natural parameters can be obtained by converting the matched mean and variance of q ˜ j ( s j ) to the canonical form [18]. Computing the moments of q ˜ j ( s j ) is often challenging due to lack of closed form solutions of the normalization constant. In order to address the computation of moments in EP, Ref. [44] proposes to evaluate challenging moments by quadrature methods. For multivariate random variables, moment-matching by spherical radial cubature would be advantageous as it will reduce the computational complexity [45]. Another popular way of evaluating the moments is through importance sampling [46] (Ch. 7) and [47].
Expectation propagation has been utilized in various applications ranging from time series estimation with Gaussian processes [48] to Bayesian learning with stochastic natural gradients [49]. When the likelihood functions for Gaussian process classification are not Gaussian, EP is often utilized [50] (Chapter 3). In [51], a message passing-based expectation propagation algorithm is developed for models that involve both continuous and discrete random variables. Perhaps the most practical applications of EP are in the context of probabilistic programming [52], where it is heavily used in real-world applications.

4.3. Hybrid Constraints

In this section, we consider hybrid methods that combine factorization and form constraints, and formalize some well-known algorithms in terms of message passing.

4.3.1. Mean-Field Variational Laplace

Mean-field variational Laplace applies the mean-field factorization to the Laplace-approximated factor function. The appeal of this method is that all messages outbound from the Laplace-approximated factor can be represented by Gaussians.
Theorem 6.
Mean-field variational Laplace: Given a TFFG G = ( V , E ) , consider the induced subgraph G ( b , j ) (Figure 13) with the Laplace-encoded factor f ˜ b as per (53). We write the model (1) with substituted Laplace-encoded factor f ˜ b for f b , as f ˜ . Furthermore, assume a naive mean-field factorization l ( b ) = { { i } f o r a l l i E ( b ) } . Let m l ( b ) be the cluster where j = m . Given the local polytope of (33), the local stationary solutions to
{ q b m , * , q j * } = arg min L ( G ( b , j ) ) F [ q , f ˜ ; s ^ b ] ,
are given by
q b m , * ( s b m ) = q j * ( s j ) = μ j b * ( s j ) μ j c * ( s j ) μ j b * ( s j ) μ j c * ( s j ) d s j ,
where μ j c * represents the fixed points of the following iterations
μ j c ( k + 1 ) ( s j ) = exp i E ( b ) i j q i ( k ) ( s i ) log f ˜ b ( s b ; s ^ b ( k ) ) d s b j ,
with
s ^ b ( k ) = arg max s b log q b ( k ) ( s b ) .
Proof. 
See Appendix D.14. □
Conveniently, under these constraints, every outbound message from node b will be proportional to a Gaussian. Substituting the Laplace-approximated factor function, we obtain:
log μ j c ( k ) ( s j ) = i E ( b ) i j q i ( k ) ( s i ) L ˜ b ( s b ; s ^ b ( k ) ) d s b j + C .
Resolving this expectation yields a quadratic form in s j , which after completing the square leads to a proportionally Gaussian message μ j c ( s j )  . This argument holds for any edge adjacent to b, and therefore for all outbound messages from node b. Moreover, if the incoming messages are represented by Gaussians as well (e.g., because these are also computed under the mean-field variational Laplace constraint), then all beliefs on the adjacent edges to b will also be Gaussian. This significantly simplifies the procedure of computing the expectations, which illustrates the computational appeal of mean-field variational Laplace.
Mean-field variational Laplace is widely used in dynamic causal modeling [53] and more generally in cognitive neuroscience, partly because the resulting computations are deemed neurologically plausible [54,55,56].

4.3.2. Expectation Maximization

Expectation Maximization (EM) can be viewed as a hybrid algorithm that combines a structured variational factorization with a Dirac-delta constraint, where the constrained value itself is optimized. Given a structured mean-field factorization l ( a ) P ( a ) , with a single-edge cluster m = j , then expectation maximization considers local factorizations of the form
q a ( s a ) = δ ( s j θ j ) n l ( a ) n m q a n ( s a n ) ,
where the belief for s j is constrained by a Dirac-delta distribution, similar to Section 4.2.1. In (69), however, the variable s j represents a random variable with (unknown) value θ j R d , where d is the dimension of the random variable s j . We explicitly use the notation θ j (as opposed to s ^ j for the data constraint in Section 4.2.1) to clarify that this value is a parameter for the constrained belief over s j that will be optimized—that is, θ j does not represent a model parameter in itself. To make this distinction even more explicit, in the context of optimization, we will refer to Dirac-delta constraints as point-mass constraints.
The factor-local free energy F [ q a , f a ; θ j ] then becomes a function of the θ j parameter.
Theorem 7.
Expectation maximization: Given a TFFG G = ( V , E ) , consider the induced subgraph G ( b , j ) (Figure 14) with a structured mean-field factorization l ( b ) P ( b ) , with local clusters n l ( b ) . Let m l ( b ) be the cluster where j = m . Given the local polytope
L ( G ( b , j ) ) = q b n f o r a l l n l ( b ) s . t . ( 29 a ) ,
the local stationary solutions to
θ j * = arg min L ( G ( b , j ) ) F [ q , f ; θ j ] ,
are given by the fixed points of
μ b j ( k + 1 ) ( s j ) = exp n l ( b ) n m q b n , ( k ) ( s b n ) log f b ( s b ) d s b j
θ j ( k + 1 ) = arg max s j log μ b j ( k + 1 ) ( s j ) + log μ c j ( k + 1 ) ( s j ) .
Proof. 
See Appendix D.15. □
Expectation maximization was formulated in [57] as an iterative method that optimizes log-expectations of likelihood functions, where each EM iteration is guaranteed to increase the expected log-likelihood. Moreover, under some differentiability conditions, the EM algorithm is guaranteed to converge [57] (Theorem 3). A detailed overview of EM for exponential families is available in [24] (Ch. 6). A formulation of EM in terms of message passing is given by [58], where message passing for EM is applied in a filtering and system identification context. In [58], derivations are based on [57] (Theorem 1), whereas our derivations directly follow from variational principles.
Example 4.
Now suppose we do not know the angle θ for the state transition matrix A t in Example 2 and would like to estimate the value of θ . Moreover, further suppose that we are interested in estimating the hyper-parameters for the prior m x 0 and V x 0 , as well as the precision matrix for the state transitions Q t . For this purpose, we changed the constraints of (25a) into EM constraints in accordance with Theorem 7:
q ( x t 1 , z t , A t ( θ ) ) = δ ( A t ( θ ) A t ( θ ^ ) ) q ( z t | x t 1 , A t ( θ ) ) q ( x t 1 )
q ( x 0 , m x 0 , V x 0 ) = q ( x 0 ) δ ( m x 0 m ^ x 0 ) δ ( V x 0 V ^ x 0 ) ,
where we optimize θ ^ , V ^ x 0 and m ^ x 0 with EM ( V ^ x 0 is further constrained to be positive definite during the optimization procedure). With the addition of the new EM constraints, the resulting FFG is given in Figure 15. The hybrid message passing algorithm consists of structured variational messages around the factor h t , and sum-product messages around w t , n t , m t and r t , and EM messages around g 0 and g t . We used identical observations as in the previous examples. The results for the hybrid SVMP-EM-SP algorithm are given in Figure 16 along with the evaluated Bethe free energy over all iterations.

4.4. Overview of Message Passing Algorithms

In Section 4.1, Section 4.2 and Section 4.3, following a high-level recipe pioneered by [15], we presented first-principle derivations of some of the popular message passing-based inference algorithms by manipulating the local constraints of the Bethe free energy. The results are summarized in Table 1.
Crucially, the method of constrained BFE minimization goes beyond the reviewed algorithms. Through creating a new set of local constraints and following similar derivations based on variational calculus, one can obtain new message passing-based inference algorithms that better match the specifics of the generative model or application.

5. Scoring Models by Minimized Variational Free Energy

As discussed in Section 2.2, the variational free energy is an important measure of model performance. In Section 5.1 and Section 5.2, we discuss some problems that occur when evaluating the BFE on a TFFG. In Section 5.3, we propose an algorithm that evaluates the constrained BFE as a summation of local contributions on the TFFG.

5.1. Evaluation of the Entropy of Dirac-Delta Constrained Beliefs

For continuous variables, data and point-mass constraints, as discussed in Section 4.2.1 and Section 4.3.2 and Appendix A, collapse the information density to infinity, which leads to singularities in entropy evaluation [59]. More specifically, for a continuous variable s j , the entropies for beliefs of the form q j ( s j ) = δ ( s j s ^ j ) and q a ( s a ) = q a | j ( s a j | s j ) δ ( s j s ^ j ) both evaluate to .
In variational inference, it is common to define the VFE only with respect to the latent (unobserved) variables [2] (Section 10.1). In contrast, in this paper, we explicitly define the BFE in terms of an iteration over all nodes and edges (7), which also includes non-latent beliefs in the BFE definition. Therefore, we define
q j ( s j ) = δ ( s j s ^ j ) H [ q j ] 0 , q a ( s a ) = q a | j ( s a j | s j ) δ ( s j s ^ j ) H [ q a ] H [ q a j ] ,
where q a | j ( s a j | s j ) indicates the conditional belief and q a j ( s a j ) is the joint belief. These definitions effectively remove the entropies for observed variables from the BFE evaluation. Note that although q a j ( s a j ) is technically not a part of our belief set (7), it can be obtained by marginalization of q a ( s a ) (9b).

5.2. Evaluation of Node-Local Free Energy for Deterministic Nodes

Another difficulty arises with the evaluation of the node-local free energy F [ q a ] for factors of the form
f a ( s a ) = δ ( h a ( s a ) ) .
This type of node function reflects deterministic operations, e.g., h ( x , y , z ) = z x y corresponds to the summation z = x + y . In this case, directly evaluating F [ q a ] again leads to singularities.
There are (at least) two strategies available in the literature that resolve this issue. The first strategy “softens” the Dirac-delta by re-defining:
f a ( s a ) 1 2 π ϵ exp 1 2 ϵ h a ( s a ) 2 ,
with 0 < ϵ 1 [17]. A drawback of this approach is that it may alter the model definition in a numerically unstable way, leading to a different inference solution and variational free energy than originally intended.
The second strategy combines the deterministic factor f a with a neighboring stochastic factor f b into a new composite factor f c , by marginalizing over a shared variable s j , leading to [60]
f c ( s c ) δ ( h a ( s a ) ) f b ( s b ) d s j ,
where s c = { s a s b } s j . This procedure has drawbacks for models that involve many deterministic factors—namely, the convenient model modularity and resulting distributed compatibility are lost when large groups of factors are compacted in model-specific composite factors. We propose here a third strategy.
Theorem 8.
Let f a ( s a ) = δ ( h a ( s a ) ) , with h a ( s a ) = s j g a ( s a j ) , and node-local belief q a ( s a ) = q j | a ( s j | s a j ) q a j ( s a j ) . Then, the node-local free energy evaluates to
F [ q a , f a ] = H [ q a j ] i f q j | a ( s j | s a j ) = δ ( s j g a ( s a j ) ) o t h e r w i s e .
Proof. 
See Appendix D.16. □
An example that evaluates the node-local free energy for a non-trivial deterministic node can be found in Appendix C.
The equality node is a special case deterministic node, with a node function of the form (3). The argument of (Theorem 8) does not directly apply to this node. As the equality node function comprises two Dirac-delta functions, it can not be written in the form of Theorem 8. However, we can still reduce the node-local free energy contribution.
Theorem 9.
Let f a ( s a ) = δ ( s j s i ) δ ( s j s k ) , with node-local belief q a ( s a ) = q i k | j ( s i , s k | s j ) q j ( s j ) . Then, the node-local free energy evaluates to
F [ q a , f a ] = H [ q j ] i f q i k | j ( s i , s k | s j ) = δ ( s j s i ) δ ( s j s k ) o t h e r w i s e .
Proof. 
See Appendix D.17. □

5.3. Evaluating the Variational Free Energy

We propose here an algorithm that evaluates the BFE on a TFFG representation of a factorized model. The algorithm is based on the following results:
  • The definitions for the computation of data-constrained entropies ensure that only variables with associated stochastic beliefs count towards the Bethe entropy. This makes the BFE evaluation consistent with Theorems 3 and 7, where the single-variable beliefs for observed variables are excluded from the BFE definition;
  • We assume that a local mean-field factorization l ( a ) is available for each a V (Section 4.1). If the mean-field factorization is not explicitly defined, we assume l ( a ) = { a } is the unfactored set;
  • Deterministic nodes are accounted for by Theorem 8, which reduces the joint entropy to an entropy over the “inbound” edges. Although the belief over the “inbounds” q a j ( s a j ) is not a term in the Bethe factorization (8), it can simply be obtained by marginalization of q a ( s a ) ;
  • The equality node is a special case, where we let the node entropy discount the degree of the associated variable in the original model definition. While the BFE definition on a TFFG (7) does not explicitly account for edge degrees, this mechanism implicitly corrects for “double-counting” [17]. In this case, edge selection for counting is arbitrary, because all associated edges are (by definition) constrained to share the same belief (Section 2.1, Theorem 9).
The decomposition of (7) shows that the BFE can be computed by an iteration over the nodes and edges of the graph. As some contributions to the BFE might cancel each other, the algorithm first tracks counting numbers u a for the average energies
U a [ q a ] = q a ( s a ) log f a ( s a ) d s a ,
and counting numbers h k for the (joint) entropies
H [ q k ] = q k ( s k ) log q k ( s k ) d s k ,
which are ultimately combined and evaluated. We used an index k to indicate that the entropy computation may include not only the edges but a generic set of variables. We will give the definition of the set that k belongs to in Algorithm 1.
Algorithm 1 Evaluation of the Bethe free energy on a Terminated Forney-style factor graph.
  • given a TFFG G = ( V , E )
  • given a local mean-field factorization l ( a ) for all a V
  • define q j ( s j ) = δ ( s j s ^ j ) H [ q j ] 0            ▹ Ignore entropy of Dirac-delta constrained beliefs
  • define q a ( s a ) = q a | j ( s a j | s j ) δ ( s j s ^ j ) H [ q a ] H [ q a j ]  ▹ Reduce entropy of Dirac-delta constrained joint beliefs
  • define K = { a , a i , n , for all a V , i E ( a ) , n l ( a ) } the set of (joint) belief indices
  • initialize counting numbers u a = 0 for all a V , h k = 0 for all k K
  •  
  • for all nodes a V do
  •     if a is a stochastic node then
  •          u a + = 1                         ▹ Count the average energy
  •         for all clusters n l ( a ) do
  •             h n + = 1                         ▹ Count the (joint) cluster entropy
  •         end for
  •     else if a is an equality node then
  •         Select an edge j E ( a )
  •          h j + = 1                         ▹ Count the variable entropy
  •     else                        ▹ Deterministic node a
  •         Obtain the node function f a ( s a ) = δ ( s j g a ( s a j ) )
  •          h a j + = 1                         ▹ Count the (joint) entropy of the inbounds
  •     end if
  • end for
  •  
  • for all edges i E do
  •      h i = 1                         ▹ Discount the variable entropy
  • end for
  •  
  • U = a V u a U a [ q a ]
  • H = k K h k H [ q k ]
  • return F = U H

6. Implementation of Algorithms and Simulations

We have developed a probabilistic programming toolbox ForneyLab.jl in the Julia language [61,62]. The majority of algorithms that are reviewed in Table 1 have been implemented in ForneyLab along with variety of demos (https://github.com/biaslab/ForneyLab.jl/tree/master/demo, accessed on 23 June 2021). ForneyLab is extendable and supports postulating new local constraints of the BFE for the creation of custom message passing-based inference algorithms.
In order to limit the length of this paper, we refer the reader to the demonstration folder of ForneyLab and to several of our previous papers with code. For instance, our previous work in [63] implemented a mean-field variational Laplace propagation for the hierarchical Gaussian filter (HGF) [64]. In the follow-up work [65], inference results improved by changing to structured factorization and moment-matching local constraints. In that case, modification of local constraints created a hybrid EP-VMP algorithm that better suited the model. Moreover, in [13], we formulated the idea of chance constraints in the form of violation probabilities leading to a new message passing algorithm that supports goal-directed behavior within the context of active inference. A similar line of reasoning led to improved inference procedures for auto-regressive models [66].

7. Related Work

Our work is inspired by the seminal work [17], which discusses the equivalence between the fixed points of the belief propagation algorithm [32] and the stationary points of the Bethe free energy. This equivalence is established through a Lagrangian formalism, which allows for the derivation of Generalized Belief Propagation (GBP) algorithms by introducing region-based graphs and the region-based (Kikuchi) free energy [16].
Region graph-based methods allows for overlapping clusters (Section 4.1) and thus offer a more generic message passing approach. The selection of appropriate regions (clusters), however, proves to be difficult, and the resulting algorithms may grow prohibitively complex. In this context, Ref. [67] addresses how to manipulate regions and manage the complexity of GBP algorithms. Furthermore, Ref. [68] also establishes a connection between GBP and expectation propagation (EP) by introducing structured region graphs.
The inspirational work of [15] derives message passing algorithms by minimization of α -divergences. The stationary points of α -divergences are obtained by a fixed point projection scheme. This projection scheme is reminiscent of the minimization scheme of the expectation propagation (EP) algorithm [18]. Compared to [15], our work focuses on a single divergence objective (namely, the VFE). The work of [12] derives the EP algorithm by manipulating the marginalization and factorization constraints of the Bethe free energy objective (see also Section 4.2.3). The EP algorithm is, however, not guaranteed to converge to a minimum of the associated divergence metric.
To address the convergence properties of the algorithms that are obtained by region graph methods, the outstanding work of [33] derives conditions on the region counting numbers that guarantee the convexity of the underlying objective. In general, however, the constrained Bethe free energy is not guaranteed to be convex and therefore the derived message passing updates are not guaranteed to converge.

8. Discussion

The key message in this paper is that a (variational) Bayesian model designer may tune the tractability-accuracy trade-off for evidence and posterior evaluation through constraint manipulation. It is interesting to note that the technique to derive message passing algorithms is always the same. We followed the recipe pioneered in [15] to derive a large variety of message passing algorithms solely through minimizing constrained Bethe free energy. This minimization leads to local fixed-point equations, which we can interpret as message passing updates on a (terminated) FFG. The presented lemmas showed how the constraints affect the Lagrangians locally. The presented theorems determined the stationary solutions of the Lagrangians and obtained the message passing equations. Thus, if a designer proposes a new set of constraints, then the first place to start is to analyze the effect on the Lagrangian. Once the effect of the constraint on the Lagrangian is known, then variational optimization may result in stationary solutions that can be obtained by a fixed-point iteration scheme.
In this paper, we selected the Forney-style factor graph framework to illustrate our ideas. FFGs are mathematically comparable to the more common bi-partite factor graphs that associate round nodes with variables and square nodes with factors [20]. Bi-partite factor graphs require two distinct types of message updates (one leaving variable nodes and one leaving factor nodes), while message passing on a (T)FFG requires only a single type of message update [69]. The (T)FFG paradigm thus substantially simplifies the derivations and resulting message passing update equations.
The message passing update rules in this paper are presented without guarantees on convergence of the (local) minimization process. In practice, however, algorithm convergence can be easily checked by evaluating the BFE (Algorithm 1) after each belief update.
In future work, we plan on extending the treatment of constraints to formulate sampling-based algorithms such as importance sampling and Hamiltonian Monte Carlo in a message passing framework. While introducing SVMP, we have limited the discussion to local clusters that are not overlapping. We plan to extend variational algorithms to include local clusters that are overlapping without altering the underlying free-energy objective or the graph structure [16,67].

9. Conclusions

In this paper, we formulated a message-passing approach to probabilistic inference by identifying local stationary solutions of a constrained Bethe free energy objective (Section 3 and Section 4). The proposed framework constructs a graph for the generative model and specifies local constraints for variational optimization in a local polytope. The constraints are then imposed on the variational objective by a Lagrangian construct. Unconstrained optimization of the Lagrangian then leads to local expressions of stationary points, which can be obtained by iterative execution of the resulting fixed point equations, which we identify with message passing updates.
Furthermore, we presented an approach to evaluate the BFE on a (terminated) Forney-style factor graph (Section 5). This procedure allows an algorithm designer to readily assess the performance of algorithms and models.
We have included detailed derivations of message passing updates (Appendix D) and hope that the presented formulation inspires the discovery of novel and customized message passing algorithms.

Author Contributions

Conceptualization: İ.Ş., T.v.d.L. and B.d.V.; methodology: İ.Ş. and T.v.d.L.; formal analysis, İ.Ş. and T.v.d.L.; investigation: İ.Ş., T.v.d.L. and B.d.V.; software, İ.Ş. and D.B.; validation, İ.Ş.; resources: İ.Ş., T.v.d.L. and B.d.V.; writing—original draft preparation: İ.Ş. and T.v.d.L.; writing—review and editing: T.v.d.L., D.B. and B.d.V.; visualizations: İ.Ş., T.v.d.L. and B.d.V.; supervision: T.v.d.L. and B.d.V.; project administration, B.d.V. All authors have read and agreed to the published version of the manuscript.

Funding

This work was partly financed by GN Hearing A/S.

Acknowledgments

The authors would like to thank the BIASlab team members for many very interesting discussions.

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
BFEBethe Free Energy
BPBelief Propagation
DCData Constraint
EMExpectation Maximization
EPExpectation Propagation
FFGForney-style Factor Graph
GBPGeneralized Belief Propagation
LPLaplace Propagation
MFVLPMean-Field Variational Laplace
MFVMPMean-Field Variational Message Passing
NLENegative Log-Evidence
TFFGTerminated Forney-style Factor Graph
VFEVariational Free Energy
VMPVariational Message Passing
SVMPStructured Variational Message Passing
SPSum-Product

Appendix A. Free Energy Minimization by Variational Inference

In this section, we present a pedagogical example of inductive inference. After we establish an intuition, we apply the same principles to a more general context in the further sections. We follow Caticha [42,70], who showed that a constrained free energy functional can be interpreted as a principled objective measure for inductive reasoning, see also [71,72]. The calculus of variations offers a principled method for optimizing this free energy functional.
In this section, we assume an example model
f ( y , θ ) = f y ( y , θ ) f θ ( θ ) ,
with observed variables y and a single parameter θ .
We define the (variational) free energy (VFE) as
F [ q , f ] = q ( y , θ ) log q ( y , θ ) f ( y , θ ) d y d θ .
The goal is to find a posterior
q * = arg min q Q F [ q , f ]
that minimizes the free energy subject to some pre-specified constraints. These constraints may include form or factorization constraints on q (to be discussed later) or relate to observations of a signal y .
As an example, assume that we obtained some measurements y = y ^ and wish to obtain a posterior marginal belief q * ( θ ) over the parameter. We can then incorporate the data in the form of a data constraint
q ( y , θ ) d θ = δ ( y y ^ ) ,
where δ defines a Dirac-delta. The constrained free energy can be rewritten by including Lagrange multipliers as
L [ q , f ] = F [ q , f ] + γ q ( y , θ ) d y d θ 1 + λ ( y ) q ( y , θ ) d θ δ ( y y ^ ) d y ,
where the first term specifies the (to be minimized) free energy objective, the second term a normalization constraint, and the third term the data constraint. Optimization of (A5) can be performed using variational calculus.
Variational calculus considers the impact of a variation in q ( y , θ ) on the Lagrangian L [ q , f ] . We define the variation as
δ q ( y , θ ) = Δ ϵ ϕ ( y , θ ) ,
where ϵ 0 , and ϕ is a continuous and differentiable “test” function. The fundamental theorem of variational calculus states that the stationary solutions q * are obtained by setting δ L / δ q = 0 , where the functional derivative δ L / δ q is implicitly defined by Appendix D in [2]:
d L [ q + ϵ ϕ , f ] d ϵ | ϵ = 0 = δ L δ q ( y , θ ) ϕ ( y , θ ) d y d θ .
Equation (A6) provides a way to derive the functional derivative through ordinary differentiation. For example, we take the Lagrangian defined by (A5) and work out the left hand side of (A6):
d L [ q + ϵ ϕ , f ] d ϵ | ϵ = 0 = d F [ q + ϵ ϕ , f ] d ϵ | ϵ = 0 + d d ϵ γ q + ϵ ϕ d y d θ | ϵ = 0 + d d ϵ λ ( y ) q + ϵ ϕ d θ d y | ϵ = 0 = d d ϵ q + ϵ ϕ log ( q + ϵ ϕ ) f | ϵ = 0 d y d θ + γ d d ϵ q + ϵ ϕ | ϵ = 0 d y d θ
+ λ ( y ) d d ϵ q + ϵ ϕ | ϵ = 0 d θ d y
= [ log q ( y , θ ) f ( y , θ ) + 1 + γ + λ ( y ) δ L [ q , f ] / δ q ] ϕ ( y , θ ) d y d θ .
Note that, since (A7c) has been written in similar form as (A6), it is easy to identify the functional derivative. This procedure is one of many ways to obtain the functional derivatives [73].
Setting δ L [ q , f ] / δ q = 0 we find the stationary solution as
q * ( y , θ ) = exp ( 1 γ λ ( y ) ) f ( y , θ )
= 1 Z exp ( λ ( y ) ) f ( y , θ ) ,
with Z = exp ( λ ( y ) ) f ( y , θ ) d y d θ = exp ( γ + 1 ) . In order to determine the Lagrange multipliers γ and λ ( y ) , we must substitute the stationary solution (A8b) back into the constraints. The normalization constraint evaluates to
1 Z exp ( λ ( y ) ) f ( y , θ ) d y d θ = 1 .
We find that (A9) is always satisfied since Z = exp ( λ ( y ) ) f ( y , θ ) d y d θ by definition. Note, however, that the computation of the normalization constant still depends on the undetermined Lagrange multiplier λ ( y ) .
The data constraint evaluates to
q * ( y , θ ) d θ = 1 Z exp ( λ ( y ) ) f ( y , θ ) d θ = δ ( y y ^ )
which can be rewritten as
exp ( λ ( y ) ) Z = δ ( y y ^ ) f ( y , θ ) d θ .
Equation (A11) shows that λ ( y ) can satisfy this constraint only if it is proportional to δ ( y y ^ ) . Indeed, substitution of (A11) into (A8b) gives
q * ( y , θ ) = f ( y , θ ) f ( y , θ ) d θ δ ( y y ^ ) ,
and the posterior for the parameters evaluates to
q * ( θ ) = q * ( y , θ ) d y = f ( y , θ ) f ( y , θ ) d θ δ ( y y ^ ) d y = f ( y ^ , θ ) f ( y ^ , θ ) d θ = f y ( y ^ , θ ) f θ ( θ ) f y ( y ^ , θ ) f θ ( θ ) d θ ,
which we recognize as the Bayes rule.
Note that the Bayes rule was derived here as a special case of constrained variational free energy minimization when data constraints are present. This derivation of the Bayes rule seems unnecessarily tedious but the value of this approach to inductive inference is that the same principle applies when other (not data) constraints on q are present.

Appendix B. Lagrangian Optimization and the Dual Problem

With the addition of Lagrange multipliers to the Bethe functional, the resulting Lagrangian depends both on the variational distribution q ( s ) and the Lagrange multipliers Ψ ( s ) . Formally, the introduction of the Lagrange multipliers allows us to rewrite the constrained optimization on the local polytope as an unconstrained optimization. We follow [33], and write
min q L ( G ) F [ q ] = min q max Ψ L [ q , Ψ ] .
Weak duality [74] (Chapter 5) then states that
min q max Ψ L [ q , Ψ ] max Ψ min q L [ q , Ψ ] .
The minimization with respect to q then yields a solution that depends on the Lagrange multipliers, as
q * ( s ; Ψ ) = arg min q L [ q , Ψ ] .
For any given q the Lagrangian is concave in Ψ . Therefore, substituting q * in the Lagrangian, the maximization over L [ q * , Ψ ] yields the unique solution
Ψ * ( s ) = arg max Ψ L [ q * , Ψ ] .
Stationary solutions are then given by
q * ( s ; Ψ * ) = arg min q L ( G ) F [ q ] .
In the current paper, we consider factorized q’s (e.g., (8)), and consider variations with respect to the individual factors. We then need to show that the combined stationary points of the individual factors also constitute a stationary point of the total objective.
Consider a Lagrangian having multiple arguments, i.e.,
L [ q ] = L [ q 1 , , q n , , q N ]
q [ q 1 , , q N ] .
We want to determine the first total variation of the Lagrangian given by
δ L = L [ q + ϵ ϕ ] L [ q ]
ϕ ( s ) [ ϕ 1 ( s ) , , ϕ N ( s ) ] .
By a Taylor series expansion on ϵ we obtain [73] (A.14) and [75] (Equation (23.2))
L [ q + ϵ ϕ ] L [ q ] = k = 1 K 1 k ! d d ϵ k L k [ q + ϵ ϕ ] ϵ k + O ( ϵ K + 1 ) .
Omitting all terms higher than the first order, we obtain the first variation as
δ L = d d ϵ L [ q + ϵ ϕ ] ϵ .
Rearranging the terms and letting ϵ vanish, we obtain the following expression
lim ϵ 0 δ L ϵ = d d ϵ L [ q + ϵ ϕ ] | ϵ = 0 .
Let us assume that the Frechet derivative exists [73] such that we can obtain the following integral representation (It should be noted that this integral expression is not always possible for a generic Lagrangian. That is why we need to assume that the Frechet derivative exists)
d d ϵ L [ q + ϵ ϕ ] | ϵ = 0 = ϕ ( s ) δ L δ q d s
where δ L δ q is the variational derivative
δ L δ q = δ L δ q 1 , , δ L δ q N
δ q n = ϵ ϕ n ( s ) .
This means that (A19) can be written as [75] (Equation (22.5)) (Here, we use a more generic Lagrangian and our notation is different than in [75]; howeverm the expression is motivated again by a Taylor series expansion on ϵ )
lim ϵ 0 δ L ϵ = d d ϵ L [ q + ϵ ϕ ] | ϵ = 0 = n ϕ ( s ) δ L δ q n d s .
Fundamental theorem of variational calculus states that in order for a point to be stationary, the first variation needs to vanish. In order for the first variation to vanish, it is sufficient to have vanishing of the variational derivatives
δ L δ q n = 0 for every n = 1 , , N .
Vanishing of individual variational derivatives will mean that that the local stationary points will also correspond to a global stationary point.

Appendix C. Local Free Energy Example for a Deterministic Node

Theorem 8 tells us how to evaluate the node-local free energy for a deterministic node. As an example, consider the node function f a ( y , x ) = δ ( y sgn ( x ) ) , with y { 1 , 1 } and x R as depicted in Figure A1.
Figure A1. Messages around a “sign” node.
Figure A1. Messages around a “sign” node.
Entropy 23 00807 g0a1
Interestingly, there is information loss in this node because the “sign” mapping is not bijective. Given an incoming Bernoulli distributed message μ y a ( y ) = B e r ( y | p ) , the backward outgoing message is derived as
μ a x ( x ) = μ y a ( y ) δ ( y sgn ( x ) ) d y = p if x 0 1 p if x < 0 .
Given a Gaussian distributed incoming message μ x a ( x ) = N ( x | m , ϑ ) , the resulting belief then becomes
q x ( x ) = μ x a ( x ) μ a x ( x ) μ x a ( x ) μ a x ( x ) d x = p p + Φ 2 p Φ N ( x | m , ϑ ) if x 0 1 p p + Φ 2 p Φ N ( x | m , ϑ ) if x < 0 ,
with Φ = 0 N ( x | m , ϑ ) d x . We define a truncated Gaussian distribution as
T ( x | m , ϑ , a , b ) = 1 Φ ( a , b ; m , ϑ ) N ( x | m , ϑ ) if a x b , 0 otherwise ,
with Φ ( a , b ; m , ϑ ) = a b N ( x | m , ϑ ) d x . This leads to
q x ( x ) = p ( 1 Φ ) p + Φ 2 p Φ K T ( x | m , ϑ , , 0 ) + ( 1 p ) Φ p + Φ 2 p Φ 1 K T ( x | m , ϑ , 0 , ) ,
as a truncated Gaussian mixture.
The node-local free energy then evaluates to
F [ q a , f a ] = H [ q x ] = 0 q x ( x ) log q x ( x ) d x + 0 q x ( x ) log q x ( x ) d x = K H [ T ( m , ϑ , , 0 ) ] + K log K ( 1 K ) H [ T ( m , ϑ , 0 , ) ] + ( 1 K ) log ( 1 K ) = K H [ T ( m , ϑ , , 0 ) ] ( 1 K ) H [ T ( m , ϑ , 0 , ) ] H [ B e r ( K ) ] ,
as a weighted sum of entropies, which can be computed analytically.

Appendix D. Proofs

Appendix D.1. Proof of Lemma 1

Proof. 
We apply the variation ϵ ϕ b to q b and, as discussed in Appendix A, we can identify the functional derivative δ L b / δ q b through ordinary differentiation as
d L b [ q b + ϵ ϕ b , f b ] d ϵ | ϵ = 0 = ( log q b ( s b ) f b ( s b ) + 1 + ψ b i E ( b ) λ i b ( s i ) δ L b / δ q b ) ϕ b ( s b ) d s b .
Setting the functional derivative to zero and identifying
μ i b ( s i ) = exp λ i b ( s i )
ψ b = log f b ( s b ) i E ( b ) μ i b ( s i ) d s b 1
yields the stationary solutions (18) in terms of Lagrange multipliers that are to be determined. □

Appendix D.2. Proof of Lemma 2

Proof. 
We follow the same procedure as in Appendix D.1, where we apply a variation ϵ ϕ j to q j (instead of q b ), and identify the functional derivative δ L j / δ q j through
d L j [ q j + ϵ ϕ j ] d ϵ | ϵ = 0 = ( log q j ( s j ) 1 + ψ j + a V ( j ) λ j a ( s j ) δ L j / δ q j ) ϕ j ( s j ) d s j .
As the TFFG is terminated, each edge has 2 degrees and the node-induced edge set has only 2 factors, which we denote by f b and f c . Then, setting the functional derivative to zero and identifying
μ j a ( s j ) = exp λ j a ( s j )
ψ j = log μ j b ( s j ) μ j c ( s j ) d s j + 1
yields the stationary solution of (20) in terms of the Lagrange multipliers. □

Appendix D.3. Proof of Theorem 1

Proof. 
The local polytope of (14) constructs the Lagrangians of (17) and (19). Substituting the stationary solutions from Lemmas 1 and 2 in the marginalization constraint,
q j ( s j ) = q b ( s b ) d s b j ,
we obtain the following relation
μ j b ( s j ) μ j c ( s j ) Z j = 1 Z b f b ( s b ) i E ( b ) μ i b ( s i ) d s b j ,
where we defined the following normalization constants to ensure that the computed marginals are normalized:
Z j = μ j b ( s j ) μ j c ( s j ) d s j Z b = f b ( s b ) i E ( b ) μ i b ( s i ) d s b .
Extracting μ j b from the integral
μ j b ( s j ) μ j c ( s j ) Z j = μ j b ( s j ) Z b f b ( s b ) i E ( b ) i j μ i b ( s i ) d s b j , μ j c ( s j ) = Z j Z b f b ( s b ) i E ( b ) i j μ i b ( s i ) d s b j
and cancelling μ j b on both sides then yields the condition on the functional form of the message μ j c .
We now need to show that the fixed points of (22) satisfy (A28). Let us assume that the fixed points exist, such that μ j c ( k ) = μ j c ( k + 1 ) for some k. Then, we want to show that at the fixed points the following equality holds:
μ j c ( k ) ( s j ) = Z j ( k ) Z b ( k ) f b ( s b ) i E ( b ) i j μ i b ( k ) ( s i ) d s b j .
Substituting (22), we need to show that
μ j c ( k ) ( s j ) = Z j ( k ) Z b ( k ) μ j c ( k + 1 ) ( s j ) .
Since μ j c ( k ) = μ j c ( k + 1 ) , we can rearrange
μ j c ( k ) 1 Z j ( k ) Z b ( k ) = 0 .
From Z b , we obtain
Z b ( k ) = μ j b ( k ) ( s j ) f b ( s b ) i E ( b ) i j μ i b ( k ) ( s i ) d s b j d s j = μ j b ( k ) ( s j ) μ j c ( k + 1 ) ( s j ) d s j = μ j b ( k ) ( s j ) μ j c ( k ) ( s j ) d s j = Z j ( k ) ,
which implies that the fixed points satisfy the desired condition. This proves that the stationary solutions to the BFE within the local polytope can be obtained as fixed points of the sum-product update equations. □

Appendix D.4. Proof of Lemma 3

Proof. 
Substituting the definition of (32), we can re-write the second term of Lagrangian (30) as
n l ( b ) q b m ( s b m ) log f b ( s b ) d s b = q b m ( s b m ) n l ( b ) n m q b n ( s b n ) log f b ( s b ) d s b m d s b m = q b m ( s b m ) log f ˜ b m ( s b m ) d s b m .
We apply the variation ϵ ϕ b m to q b m and identify the functional derivative δ L b m / δ q b m , as
d L b m [ q b m + ϵ ϕ b m ] d ϵ | ϵ = 0 = log q b m ( s b m ) f ˜ b m ( s b m ) + 1 + ψ b m i m λ i b ( s i ) δ L b m / δ q b m ϕ b m ( s b m ) d s b m ,
whose functional form we recognize from Appendix D.1. Setting the functional derivative to zero and again identifying μ i b ( s i ) = exp λ i b ( s i ) , yields the stationary solutions of (31). □

Appendix D.5. Proof of Theorem 2

Proof. 
The local polytope of (33) constructs the Lagrangians L b m and L j as (30) and (19), respectively. We substitute the stationary solutions of Lemmas 2 and 3 in the local marginalization constraint (29b), which yields
q j ( s j ) = q b m ( s b m ) d s b j m .
Following the structure of the proof in Appendix D.3, we obtain the following condition for the stationary solutions in terms of messages:
μ j b ( s j ) μ j c ( s j ) Z j = μ j b ( s j ) Z b m f ˜ b m ( s b m ) i m i j μ i b ( s i ) d s b j m μ j c ( s j ) Z j = 1 Z b m f ˜ b m ( s b m ) i m i j μ i b ( s i ) d s b j m .
Now we want to show that the fixed points of the message updates (36) satisfy (A29). Let us assume that the fixed points exists for some k such that μ j c ( k + 1 ) = μ j c ( k ) . Then, we will show that the fixed points satisfy
μ j c ( k ) ( s j ) Z j ( k ) = 1 Z b m , ( k ) f ˜ b m , ( k ) ( s b m ) i m i j μ i b ( k ) ( s i ) d s b j m .
Similar to Appendix D.3, it will suffice to show that Z b m , ( k ) = Z j ( k ) at the fixed points. Arranging the order of integration in normalization constant Z b m , ( k ) , we obtain
Z b m , ( k ) = μ j b ( k ) ( s j ) f ˜ b m , ( k ) ( s b m ) i m i j μ i b ( k ) ( s i ) d s b j m d s j = μ j b ( k ) ( s j ) μ j c ( k + 1 ) ( s j ) d s j = μ j b ( k ) ( s j ) μ j c ( k ) ( s j ) d s j = Z j ( k ) .
By the same line of reasoning as in Appendix D.3, this shows that the fixed points of the message updates (36) leads to stationary distributions of the Bethe free energy with structured factorization constraints. □

Appendix D.6. Proof of Corollary 1

Proof. 
For a fully factorized local variational distribution (41), the augmented node function f ˜ b m ( s b m ) of (32) reduces to
f ˜ j ( s j ) = exp i E ( b ) i j q i ( s i ) log f b ( s b ) d s b j .
The message of (36) then reduces to
μ j c ( s j ) = f ˜ j ( s j ) ,
which, after substitution, recovers (43). □

Appendix D.7. Proof of Lemma 4

Proof. 
When we apply the variation ϵ ϕ b to q b and identify the functional derivative δ L b / δ q b , we recover the result from Appendix D.1, which leads to a solution of the form (47). □

Appendix D.8. Proof of Theorem 3

Proof. 
We construct the Lagrangian of (46), which by Lemma 4 leads to a solution of the form (47). Substituting this solution in the constraint of (45) leads to
f b ( s b ) i E ( b ) i j μ i b ( s i ) d s b j μ b j ( s j ) μ j b ( s j ) = δ ( s j s ^ j ) .
This equation is then satisfied by (50), which proves the theorem. □

Appendix D.9. Proof of Lemma 5

Proof. 
The proof follows directly from Appendix D.1, with f ˜ b ( s b ; s ^ b ) substituted for f b ( s b ) . □

Appendix D.10. Proof of Theorem 4

Proof. 
Given the result of Lemma 5, the proof follows Appendix D.3, where Laplace propagation chooses the expansion point to be the fixed point s ^ b = arg max log q b ( s b ) .
For all second-order fixed points of the Laplace iterations, it holds that s ^ b is a fixed point if and only if it is a local optimum of q b . The proof is then concluded by Lemma 1 in [76]. □

Appendix D.11. Proof of Lemma 6

Proof. 
We note that the Lagrange multiplier η j b does not depend on s j because the expectation removes all the functional dependencies on s j . Furthermore, the expectations of T j ( s j ) have the same dimension as the function T j ( s j ) . This means that the dimension of η j b needs to be compatible with that of T j ( s j ) so that we can write the constraint as an inner product.
We apply the variation ϵ ϕ b to q b and identify the functional derivative δ L b / δ q b , as
d L b [ q b + ϵ ϕ b , f b ] d ϵ | ϵ = 0 = log q b ( s b ) f b ( s b ) + 1 + ψ b i E ( b ) i j λ i b ( s i ) η j b T j ( s j ) δ L b / δ q b ϕ b ( s b ) d s b .
Setting the functional derivative to zero and identifying μ i b ( s i ) = exp λ i b ( s i ) for i j and identifying μ j b ( s j ) = exp η j b T j ( s j ) yields the functional form of the stationary solution as (62). □

Appendix D.12. Proof of Lemma 7

Proof. 
We follow a similar procedure as in Appendix D.11 and apply the variation ϵ ϕ j to q j , which identifies the functional derivative δ L j / δ q j , as
d L [ q j + ϵ ϕ j ] d ϵ | ϵ = 0 = log q j ( s j ) 1 + ψ j + a V ( j ) η j a T j ( s j ) δ L j / δ q j ϕ j ( s j ) d s j .
Setting the functional derivative to zero and following the same procedure as in Appendix D.2 yields (64). □

Appendix D.13. Proof of Theorem 5

Proof. 
By substituting the stationary solutions given by Lemmas 6 and 7 into the moment-matching constraint (59), we obtain the following condition:
T j ( s j ) q j ( s j ) d s j = T j ( s j ) q b ( s b ) d s b 1 Z j T j ( s j ) exp [ η j b + η j c ] T j ( s j ) d s j = 1 Z ˜ j T j ( s j ) exp η j b T j ( s j ) μ j b ( s j ) f b ( s b ) i E ( b ) i j μ i b ( s i ) d s b j μ ˜ j c ( s j ) d s j = T j ( s j ) q ˜ j ( s j ) d s j ,
where we recognize the sum-product message μ ˜ j c ( s j ) , which we multiply by the incoming exponential family message μ j b ( s j ) and normalize to obtain q ˜ j ( s j ) . By defining η j = η j b + η j c , normalization constants are given by
Z j ( η j ) = exp η j T j ( s j ) d s j Z ˜ j = exp η j b T j ( s j ) μ ˜ j c ( s j ) d s j .
Computing the moments allows us to determine the exponential family parameter by solving the following equation [24] (Proposition 3.1)
η j log Z j ( η j ) = q ˜ j ( s j ) T j ( s j ) d s j .
Suppose you obtain a solution to this equation denoted by η ˜ j , this allows us to approximate the sum-product message μ ˜ j c ( s j ) by an exponential family message whose parameter is given by
η j c = η ˜ j η j b .
Now let us assume that the fixed points of the sum-product iterations μ ˜ j c ( k ) ( s j ) = μ ˜ j c ( k + 1 ) ( s j ) and the incoming exponential family messages μ j b ( k ) ( s j ) = μ j b ( k + 1 ) ( s j ) exist for some k. Then, we need to show that the existence of these fixed points implies the existence of the fixed points of μ j c ( k + 1 ) = μ j c ( k ) .
By moment-matching, we have
η j c ( k + 1 ) = η ˜ j ( k + 1 ) η j b ( k + 1 ) = η ˜ j ( k ) η j b ( k ) = η j c ( k ) ,
which proves the existence of the fixed point of μ j c if μ ˜ j c and μ j b ( s j ) have fixed points. □

Appendix D.14. Proof of Theorem 6

Proof. 
The proof follows directly from substituting the Laplace-approximated factor-function (53) in the naive mean-field result of Corollary 1. □

Appendix D.15. Proof of Theorem 7

Proof. 
In order to obtain the optimal parameter value θ j * , we view the free energy as a function of θ j . As there are two node-local free energies that depend upon θ j , this leads to
θ j * = arg min θ j F [ q b , f b ; θ j ] + F [ q c , f c ; θ j ] = arg max θ j δ ( s j θ j ) n l ( b ) n m q b n ( s b n ) log f b ( s b ) d s b + δ ( s j θ j ) n l ( c ) n m q c n ( s c n ) log f c ( s c ) d s c = arg max θ j n l ( b ) n m q b n ( s b n ) log f b ( s b j , θ j ) d s b j + n l ( c ) n m q c n ( s c n ) log f c ( s c j , θ j ) d s c j = arg max s j log μ b j ( s j ) + log μ c j ( s j ) ,
where in the last step we replaced θ j with s j for convenience. Here, we recognize μ b j and μ c j as the structured variational updates of Theorem 2. Identification of the fixed points can then be obtained by [57] (Corollary 2). For a rigorous discussion on convergence of the EM algorithm, we refer to [77] (Corollary 32), [24] (Chapter 6) and [57] (Section 3). □

Appendix D.16. Proof of Theorem 8

Proof. 
Substituting for q a ( s a ) , the node-local free energy becomes
F [ q a , f a ] = q a ( s a ) log q a ( s a ) f a ( s a ) d s a = q a ( s a ) log q j | a ( s j | s a j ) f a ( s a ) d s a + q a ( s a ) log q a j ( s a j ) d s a = q a j ( s a j ) q j | a ( s j | s a j ) log q j | a ( s j | s a j ) f a ( s a ) d s a + q a j ( s a j ) q j | a ( s j | s a j ) log q a j ( s a j ) d s a = q a j ( s a j ) q j | a ( s j | s a j ) log q j | a ( s j | s a j ) f a ( s a ) d s j d s a j + q a j ( s a j ) log q a j ( s a j ) d s a j = E q a j D q j | a f a H [ q a j ] ,
where the first term expresses an expected Kullback–Leibler divergence, and the second term is a negative entropy. The only possibility for the local free energy to becomes finite, is when q j | a ( s j | s a j ) = f a ( s a ) = δ ( s j g a ( s a j ) ) . We then have:
F [ q a , f a ] = H [ q a j ] if q j | a ( s j | s a j ) = δ ( s j g a ( s a j ) ) otherwise .

Appendix D.17. Proof of Theorem 9

Proof. 
The proof is similar to Appendix D.16. Substituting for q a ( s a ) , the node-local free energy becomes
F [ q a , f a ] = q a ( s a ) log q a ( s a ) f a ( s a ) d s a = q a ( s i , s j , s k ) log q i k | j ( s i , s k | s j ) f a ( s i , s j , s k ) d s i d s j d s k + q j ( s j ) log q j ( s j ) d s j = E q j D q i k | j f a H [ q j ] .
In contrast to Appendix D.16, here we have a joint belief within the divergence with a single conditioning variable. Conditioning on s j (or by symmetry s i or s k ) determines the realization of the other variables. Therefore, we have:
F [ q a , f a ] = H [ q j ] if q i k | j ( s i , s k | s j ) = δ ( s j s i ) δ ( s j s k ) otherwise .

References

  1. Blei, D.M. Build, Compute, Critique, Repeat: Data Analysis with Latent Variable Models. Annu. Rev. Stat. Appl. 2014, 1, 203–232. [Google Scholar] [CrossRef] [Green Version]
  2. Bishop, C.M. Pattern Recognition and Machine Learning; Springer: New York, NY, USA, 2006. [Google Scholar]
  3. Kullback, S.; Leibler, R.A. On Information and Sufficiency. Ann. Math. Stat. 1951, 22, 79–86. [Google Scholar] [CrossRef]
  4. Forney, G. Codes on graphs: Normal realizations. IEEE Trans. Inf. Theory 2001, 47, 520–548. [Google Scholar] [CrossRef]
  5. Loeliger, H.A. An introduction to factor graphs. IEEE Signal Process. Mag. 2004, 21, 28–41. [Google Scholar]
  6. Winn, J.; Bishop, C.M. Variational message passing. J. Mach. Learn. Res. 2005, 6, 661–694. [Google Scholar]
  7. Yedidia, J.S.; Freeman, W.T.; Weiss, Y. Understanding Belief Propagation and Its Generalizations; Mitsubishi Electric Research Laboratories, Inc.: Cambridge, MA, USA, 2001. [Google Scholar]
  8. Cox, M.; van de Laar, T.; de Vries, B. A factor graph approach to automated design of Bayesian signal processing algorithms. Int. J. Approx. Reason. 2019, 104, 185–204. [Google Scholar] [CrossRef] [Green Version]
  9. Yedidia, J.S. An Idiosyncratic Journey beyond Mean Field Theory. In Advanced Mean Field Methods; The MIT Press: Cambridge, MA, USA, 2000; pp. 37–49. [Google Scholar]
  10. Yedidia, J.S.; Freeman, W.T.; Weiss, Y. Bethe Free Energy, Kikuchi Approximations, and Belief Propagation Algorithms; Mitsubishi Electric Research Laboratories, Inc.: Cambridge, MA, USA, 2001; p. 24. [Google Scholar]
  11. Dauwels, J. On Variational Message Passing on Factor Graphs. In Proceedings of the IEEE International Symposium on Information Theory, Nice, France, 24–29 June 2007; pp. 2546–2550. [Google Scholar] [CrossRef] [Green Version]
  12. Zhang, D.; Wang, W.; Fettweis, G.; Gao, X. Unifying Message Passing Algorithms under the Framework of Constrained Bethe Free Energy Minimization. arXiv 2017, arXiv:1703.10932. [Google Scholar]
  13. van de Laar, T.; Şenöz, I.; Özçelikkale, A.; Wymeersch, H. Chance-Constrained Active Inference. arXiv 2021, arXiv:2102.08792. [Google Scholar]
  14. Smola, A.J.; Vishwanathan, S.V.N.; Eskin, E. Laplace propagation. In NIPS; The MIT Press: Cambridge, MA, USA, 2004; pp. 441–448. [Google Scholar]
  15. Minka, T. Divergence Measures and Message Passing. Available online: https://www.microsoft.com/en-us/research/publication/divergence-measures-and-message-passing/ (accessed on 24 June 2021).
  16. Yedidia, J.S. Generalized Belief Propagation and Free Energy Minimization. Available online: http://cba.mit.edu/events/03.11.ASE/docs/Yedidia.pdf (accessed on 24 June 2021).
  17. Yedidia, J.S.; Freeman, W.; Weiss, Y. Constructing free-energy approximations and generalized belief propagation algorithms. IEEE Trans. Inf. Theory 2005, 51, 2282–2312. [Google Scholar] [CrossRef]
  18. Minka, T.P. Expectation Propagation for Approximate Bayesian Inference. In Proceedings of the Seventeenth Conference on Uncertainty in Artificial Intelligence, Seattle, WA, USA, 2–5 August 2001; Morgan Kaufmann Publishers Inc.: San Francisco, CA, USA, 2001; pp. 362–369. [Google Scholar]
  19. Heskes, T. Stable fixed points of loopy belief propagation are local minima of the bethe free energy. In Advances in Neural Information Processing Systems; The MIT Press: Cambridge, MA, USA, 2003; pp. 359–366. [Google Scholar]
  20. Kschischang, F.R.; Frey, B.J.; Loeliger, H.A. Factor graphs and the sum-product algorithm. IEEE Trans. Inf. Theory 2001, 47, 498–519. [Google Scholar]
  21. Hoffman, M.; Blei, D.M.; Wang, C.; Paisley, J. Stochastic Variational Inference. arXiv 2012, arXiv:1206.7051. [Google Scholar]
  22. Archer, E.; Park, I.M.; Buesing, L.; Cunningham, J.; Paninski, L. Black box variational inference for state space models. arXiv 2015, arXiv:1511.07367. [Google Scholar]
  23. Pearl, J. Probabilistic Reasoning in Intelligent Systems: Networks of Plausible Inference; Morgan Kaufmann Publishers Inc.: San Francisco, CA, USA, 1988. [Google Scholar]
  24. Wainwright, M.J.; Jordan, M.I. Graphical Models, Exponential Families, and Variational Inference. Found. Trends® Mach. Learn. 2008, 1, 1–305. [Google Scholar] [CrossRef] [Green Version]
  25. Chertkov, M.; Chernyak, V.Y. Loop Calculus in Statistical Physics and Information Science. Phys. Rev. E 2006, 73. [Google Scholar] [CrossRef] [Green Version]
  26. Weller, A.; Tang, K.; Jebara, T.; Sontag, D.A. Understanding the Bethe approximation: When and how can it go wrong? In Proceedings of the 30th Conference on Uncertainty in Artificial Intelligence, Quebec City, QC, Canada, 23–27 July 2014; pp. 868–877. [Google Scholar]
  27. Sibel, J.C. Region-Based Approximation to Solve Inference in Loopy Factor Graphs: Decoding LDPC Codes by Generalized Belief Propagation. Available online: https://hal.archives-ouvertes.fr/tel-00905668 (accessed on 24 June 2021).
  28. Minka, T. From Hidden Markov Models to Linear Dynamical Systems; Technical Report 531; VIsion and Modeling Group, Media Lab, MIT: Cambridge, MA, USA, 1999. [Google Scholar]
  29. Loeliger, H.A.; Dauwels, J.; Hu, J.; Korl, S.; Ping, L.; Kschischang, F.R. The Factor Graph Approach to Model-Based Signal Processing. Proc. IEEE 2007, 95, 1295–1322. [Google Scholar] [CrossRef] [Green Version]
  30. Loeliger, H.A.; Bolliger, L.; Reller, C.; Korl, S. Localizing, forgetting, and likelihood filtering in state-space models. In Proceedings of the 2009 Information Theory and Applications Workshop, La Jolla, CA, USA, 8–13 February 2009; pp. 184–186. [Google Scholar] [CrossRef] [Green Version]
  31. Korl, S. A Factor Graph Approach to Signal Modelling, System Identification and Filtering. Ph.D. Thesis, Swiss Federal Institute of Technology, Zurich, Switzerland, 2005. [Google Scholar]
  32. Pearl, J. Reverend Bayes on Inference Engines: A Distributed Hierarchical Approach. In Proceedings of the Second AAAI Conference on Artificial Intelligence, Pittsburgh, PA, USA, 18–20 August 1982; AAAI Press: Pittsburgh, PA, USA, 1982; pp. 133–136. [Google Scholar]
  33. Heskes, T. Convexity arguments for efficient minimization of the Bethe and Kikuchi free energies. J. Artif. Intell. Res. 2006, 26, 153–190. [Google Scholar]
  34. Särkkä, S. Bayesian Filtering and Smoothing; Cambridge University Press: London, UK; New York, NY, USA, 2013. [Google Scholar]
  35. Khan, M.E.; Lin, W. Conjugate-Computation Variational Inference: Converting Variational Inference in Non-Conjugate Models to Inferences in Conjugate Models. arXiv 2017, arXiv:1703.04265. [Google Scholar]
  36. Logan, B.; Moreno, P. Factorial HMMs for acoustic modeling. In Proceedings of the 1998 IEEE International Conference on Acoustics, Speech and Signal Processing, Seattle, WA, USA, 15 May 1998; Volume 2, pp. 813–816. [Google Scholar] [CrossRef] [Green Version]
  37. Hoffman, M.D.; Blei, D.M. Structured Stochastic Variational Inference. arXiv 2014, arXiv:1404.4114. [Google Scholar]
  38. Singh, R.; Ling, J.; Doshi-Velez, F. Structured Variational Autoencoders for the Beta-Bernoulli Process. In Proceedings of the 31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA, 4–9 December 2017; p. 9. [Google Scholar]
  39. Bamler, R.; Mandt, S. Structured Black Box Variational Inference for Latent Time Series Models. arXiv 2017, arXiv:1707.01069. [Google Scholar]
  40. Zhang, C.; Yuan, Z.; Wang, Z.; Guo, Q. Low Complexity Sparse Bayesian Learning Using Combined BP and MF with a Stretched Factor Graph. Signal Process. 2017, 131, 344–349. [Google Scholar] [CrossRef] [Green Version]
  41. Wand, M.P. Fast Approximate Inference for Arbitrarily Large Semiparametric Regression Models via Message Passing. J. Am. Stat. Assoc. 2017, 112, 137–168. [Google Scholar] [CrossRef]
  42. Caticha, A. Entropic Inference and the Foundations of Physics. In Proceedings of the 11th Brazilian Meeting on Bayesian Statistics, Amparo, Brazil, 18–22 March 2012. [Google Scholar]
  43. Pearl, J. A Probabilistic Calculus of Actions. Available online: https://arxiv.org/ftp/arxiv/papers/1302/1302.6835.pdf (accessed on 24 June 2021).
  44. Zoeter, O.; Heskes, T. Gaussian Quadrature Based Expectation Propagation. In Proceedings of the Tenth International Workshop on Artificial Intelligence and Statistics, Bridgetown, Barbados, 6–8 January 2005; p. 9. [Google Scholar]
  45. Arasaratnam, I.; Haykin, S. Cubature Kalman Filters. IEEE Trans. Autom. Control 2009, 54, 1254–1269. [Google Scholar] [CrossRef] [Green Version]
  46. Sarkka, S. Bayesian Estimation of Time-Varying Systems: Discrete-Time Systems. Available online: https://users.aalto.fi/~ssarkka/course_k2011/pdf/course_booklet_2011.pdf (accessed on 24 June 2021).
  47. Gelman, A.; Vehtari, A.; Jylänki, P.; Robert, C.; Chopin, N.; Cunningham, J.P. Expectation propagation as a way of life. arXiv 2014, arXiv:1412.4869. [Google Scholar]
  48. Deisenroth, M.P.; Mohamed, S. Expectation Propagation in Gaussian Process Dynamical Systems: Extended Version. arXiv 2012, arXiv:1207.2940. [Google Scholar]
  49. Teh, Y.W.; Hasenclever, L.; Lienart, T.; Vollmer, S.; Webb, S.; Lakshminarayanan, B.; Blundell, C. Distributed Bayesian Learning with Stochastic Natural-gradient Expectation Propagation and the Posterior Server. arXiv 2015, arXiv:1512.09327. [Google Scholar]
  50. Rasmussen, C.E.; Williams, C.K.I. Gaussian Processes for Machine Learning; MIT Press: Cambridge, MA, USA, 2006. [Google Scholar]
  51. Cox, M. Robust Expectation Propagation in Factor Graphs Involving Both Continuous and Binary Variables. In Proceedings of the 26th European Signal Processing Conference (EUSIPCO), Rome, Italy, 3–7 September 2018; p. 5. [Google Scholar]
  52. Minka, T.; Winn, J.; Guiver, J.; Webster, S.; Zaykov, Y.; Yangel, B.; Spengler, A.; Bronskill, J. Infer.NET 2.6. 2014. Available online: http://research.microsoft.com/infernet (accessed on 23 June 2021).
  53. Friston, K.J.; Harrison, L.; Penny, W. Dynamic causal modelling. Neuroimage 2003, 19, 1273–1302. [Google Scholar]
  54. Mathys, C.D.; Daunizeau, J.; Friston, K.J.; Klaas, S.E. A Bayesian foundation for individual learning under uncertainty. Front. Hum. Neurosci. 2011, 5. [Google Scholar] [CrossRef] [Green Version]
  55. Friston, K.; Kilner, J.; Harrison, L. A free energy principle for the brain. J. Physiol. 2006, 100, 70–87. [Google Scholar] [CrossRef] [Green Version]
  56. Friston, K. The free-energy principle: A rough guide to the brain? Trends Cogn. Sci. 2009, 13, 293–301. [Google Scholar] [CrossRef]
  57. Dempster, A.P.; Laird, N.M.; Rubin, D.B. Maximum Likelihood from Incomplete Data via the EM Algorithm. J. R. Stat. Soc. Ser. B Methodol. 1977, 39, 1–38. [Google Scholar]
  58. Dauwels, J.; Eckford, A.; Korl, S.; Loeliger, H.A. Expectation maximization as message passing—Part I: Principles and gaussian messages. arXiv 2009, arXiv:0910.2832. [Google Scholar]
  59. Bouvrie, P.; Angulo, J.; Dehesa, J. Entropy and complexity analysis of Dirac-delta-like quantum potentials. Phys. A Stat. Mech. Appl. 2011, 390, 2215–2228. [Google Scholar] [CrossRef]
  60. Dauwels, J.; Korl, S.; Loeliger, H.A. Expectation maximization as message passing. In Proceedings of the International Symposium on Information Theory 2005, (ISIT 2005), Adelaide, Australia, 4–9 September 2005; pp. 583–586. [Google Scholar] [CrossRef] [Green Version]
  61. Cox, M.; van de Laar, T.; de Vries, B. ForneyLab.jl: Fast and flexible automated inference through message passing in Julia. In Proceedings of the International Conference on Probabilistic Programming, Boston, MA, USA, 4–6 October 2018. [Google Scholar]
  62. Bezanson, J.; Edelman, A.; Karpinski, S.; Shah, V. Julia: A Fresh Approach to Numerical Computing. SIAM Rev. 2017, 59, 65–98. [Google Scholar] [CrossRef] [Green Version]
  63. Şenöz, I.; de Vries, B. Online Variational Message Passing in the Hierarchical Gaussian Filter. In Proceedings of the 2018 IEEE 28th International Workshop on Machine Learning for Signal Processing (MLSP), Aalborg, Denmark, 17–20 September 2018; pp. 1–6. [Google Scholar] [CrossRef]
  64. Mathys, C.D. Uncertainty, Precision, and Prediction Errors; UCL Computational Psychiatry Course; UCL: London, UK, 2014. [Google Scholar]
  65. Şenöz, I.; de Vries, B. Online Message Passing-based Inference in the Hierarchical Gaussian Filter. In Proceedings of the 2020 IEEE International Symposium on Information Theory (ISIT), Los Angeles, CA, USA, 21–26 June 2020; pp. 2676–2681. [Google Scholar] [CrossRef]
  66. Podusenko, A.; Kouw, W.M.; de Vries, B. Online Variational Message Passing in Hierarchical Autoregressive Models. In Proceedings of the 2020 IEEE International Symposium on Information Theory (ISIT), Los Angeles, CA, USA, 21–26 June 2020; pp. 1337–1342. [Google Scholar] [CrossRef]
  67. Welling, M. On the Choice of Regions for Generalized Belief Propagation. arXiv 2012, arXiv:1207.4158. [Google Scholar]
  68. Welling, M.; Minka, T.P.; Teh, Y.W. Structured Region Graphs: Morphing EP into GBP. arXiv 2012, arXiv:1207.1426. [Google Scholar]
  69. Loeliger, H.A. Factor Graphs and Message Passing Algorithms—Part 1: Introduction. 2007. Available online: http://www.crm.sns.it/media/course/1524/Loeliger_A.pdf (accessed on 3 April 2019).
  70. Caticha, A. Relative Entropy and Inductive Inference. AIP Conf. Proc. 2004, 707, 75–96. [Google Scholar] [CrossRef]
  71. Ortega, P.A.; Braun, D.A. A Minimum Relative Entropy Principle for Learning and Acting. J. Artif. Intell. Res. 2010, 38, 475–511. [Google Scholar]
  72. Shore, J.; Johnson, R. Axiomatic derivation of the principle of maximum entropy and the principle of minimum cross-entropy. IEEE Trans. Inf. Theory 1980, 26, 26–37. [Google Scholar] [CrossRef] [Green Version]
  73. Engel, E.; Dreizler, R.M. Density Functional Theory: An Advanced Course; Theoretical and Mathematical Physics; Springer: Berlin/Heidelberg, Germany, 2011. [Google Scholar] [CrossRef] [Green Version]
  74. Boyd, S.P.; Vandenberghe, L. Convex Optimization; Cambridge University Press: Cambridge, UK; New York, NY, USA, 2004. [Google Scholar]
  75. Lanczos, C. The Variational Principles of Mechanics; Courier Corporation: North Chelmsford, MA, USA, 2012. [Google Scholar]
  76. Ahn, S.; Chertkov, M.; Shin, J. Gauging Variational Inference. Available online: https://dl.acm.org/doi/10.5555/3294996.3295048 (accessed on 24 June 2021).
  77. Tran, V.H. Copula Variational Bayes inference via information geometry. arXiv 2018, arXiv:1803.10998. [Google Scholar]
Figure 1. Example Forney-style factor graph for the model of (2).
Figure 1. Example Forney-style factor graph for the model of (2).
Entropy 23 00807 g001
Figure 2. Visualization of the node-induced subgraph for an equality node. If the node function f a is known, a symbol representing the node function is often substituted within the node (“=” in this case).
Figure 2. Visualization of the node-induced subgraph for an equality node. If the node function f a is known, a symbol representing the node function is often substituted within the node (“=” in this case).
Entropy 23 00807 g002
Figure 3. The subgraph around node b with indicated messages. Ellipses indicate an arbitrary (possibly zero) amount of edges.
Figure 3. The subgraph around node b with indicated messages. Ellipses indicate an arbitrary (possibly zero) amount of edges.
Entropy 23 00807 g003
Figure 4. An edge-induced subgraph G ( j ) with indicated messages.
Figure 4. An edge-induced subgraph G ( j ) with indicated messages.
Entropy 23 00807 g004
Figure 5. Visualization of a subgraph with indicated sum-product messages.
Figure 5. Visualization of a subgraph with indicated sum-product messages.
Entropy 23 00807 g005
Figure 6. (Left) One time segment of the FFG corresponding to the linear Gaussian state space model specified in Example 1, with the sum-product messages computed according to (22). The three small dots at both sides of the graph indicate identical continuation of the graph over time. (Right) The small dots indicate the noisy observations that are synthetically generated by the linear state space model of (23) using parameter matrices as specified in (24). The posterior distribution for the hidden states are inferred by sum-product message passing and are drawn with shaded regions, indicating plus and minus the variance. The Bethe free energy evaluates to F [ q , f ] = 580.698 .
Figure 6. (Left) One time segment of the FFG corresponding to the linear Gaussian state space model specified in Example 1, with the sum-product messages computed according to (22). The three small dots at both sides of the graph indicate identical continuation of the graph over time. (Right) The small dots indicate the noisy observations that are synthetically generated by the linear state space model of (23) using parameter matrices as specified in (24). The posterior distribution for the hidden states are inferred by sum-product message passing and are drawn with shaded regions, indicating plus and minus the variance. The Bethe free energy evaluates to F [ q , f ] = 580.698 .
Entropy 23 00807 g006
Figure 7. A node-induced subgraph G ( b ) with shaded sections that enclose the edges of an exemplary structured mean-field factorization l ( b ) = { m , n , r } . Note that, in this example, the cluster n only encompasses the single edge j, such that q b n ( s b n ) = q j ( s j ) . In general, the assignment and number of edges in a cluster can be arbitrary.
Figure 7. A node-induced subgraph G ( b ) with shaded sections that enclose the edges of an exemplary structured mean-field factorization l ( b ) = { m , n , r } . Note that, in this example, the cluster n only encompasses the single edge j, such that q b n ( s b n ) = q j ( s j ) . In general, the assignment and number of edges in a cluster can be arbitrary.
Entropy 23 00807 g007
Figure 8. An example subgraph corresponding to G ( b , j ) . Dashed ellipses enclose the edges of an exemplary exact cover l ( b ) = { m , n , r } . In general, the assignment and number of edges in a cluster can be arbitrary.
Figure 8. An example subgraph corresponding to G ( b , j ) . Dashed ellipses enclose the edges of an exemplary exact cover l ( b ) = { m , n , r } . In general, the assignment and number of edges in a cluster can be arbitrary.
Entropy 23 00807 g008
Figure 9. (Left) One time segment of the FFG corresponding to the linear Gaussian state space model specified in Example 2 with the sum-product messages computed according to (36). (Right) The small dots indicate the noisy observations that are synthetically generated by the linear state space model of (23) using matrices specified in (24). The posterior distribution of the hidden states inferred by structured variational message passing is depicted with shaded regions representing plus and minus one variances. The minimum of the evaluated Bethe free energy over all iterations is F [ q , f ] = 586.178 (compared to F [ q , f ] = 580.698 in Example 1). The posterior distribution for the precision matrix is given by Q W 0.00266 0.000334 0.00034 0.00670 , 102.0 .
Figure 9. (Left) One time segment of the FFG corresponding to the linear Gaussian state space model specified in Example 2 with the sum-product messages computed according to (36). (Right) The small dots indicate the noisy observations that are synthetically generated by the linear state space model of (23) using matrices specified in (24). The posterior distribution of the hidden states inferred by structured variational message passing is depicted with shaded regions representing plus and minus one variances. The minimum of the evaluated Bethe free energy over all iterations is F [ q , f ] = 586.178 (compared to F [ q , f ] = 580.698 in Example 1). The posterior distribution for the precision matrix is given by Q W 0.00266 0.000334 0.00034 0.00670 , 102.0 .
Entropy 23 00807 g009
Figure 10. (Left) The small dots indicate the noisy observations that were synthetically generated by the linear state space model of (23) using matrices specified in (24). The posterior distribution for the hidden states inferred by naive variational message passing is depicted with shaded regions representing plus and minus one variances. The minimum of the evaluated Bethe free energy over all iterations is F [ q , f ] = 617.468 , which is more than for the less-constrained Example 2 (with F [ q , f ] = 586.178 ) and Example 1 (with F [ q , f ] = 580.698 ). The posterior for the precision matrix is given by Q W 0.00141 6.00549 e 5 6.00549 e 5 0.00187 , 102.0 . (Right) A comparison of the Bethe free energies for sum-product, structured and naive variational message passing algorithms for the data generated in Example 1.
Figure 10. (Left) The small dots indicate the noisy observations that were synthetically generated by the linear state space model of (23) using matrices specified in (24). The posterior distribution for the hidden states inferred by naive variational message passing is depicted with shaded regions representing plus and minus one variances. The minimum of the evaluated Bethe free energy over all iterations is F [ q , f ] = 617.468 , which is more than for the less-constrained Example 2 (with F [ q , f ] = 586.178 ) and Example 1 (with F [ q , f ] = 580.698 ). The posterior for the precision matrix is given by Q W 0.00141 6.00549 e 5 6.00549 e 5 0.00187 , 102.0 . (Right) A comparison of the Bethe free energies for sum-product, structured and naive variational message passing algorithms for the data generated in Example 1.
Entropy 23 00807 g010
Figure 11. Visualization of a subgraph G ( b , j ) with indicated messages, where the dark circled delta indicates a data constraint—i.e., the variable s j is constrained to have a distribution of the form δ ( s j s ^ j ) .
Figure 11. Visualization of a subgraph G ( b , j ) with indicated messages, where the dark circled delta indicates a data constraint—i.e., the variable s j is constrained to have a distribution of the form δ ( s j s ^ j ) .
Entropy 23 00807 g011
Figure 12. The subgraph around a Laplace-approximated node b with indicated messages.
Figure 12. The subgraph around a Laplace-approximated node b with indicated messages.
Entropy 23 00807 g012
Figure 13. Visualization of a subgraph with indicated Laplace propagation messages. The node function f b is denoted by f ˜ b according to (53).
Figure 13. Visualization of a subgraph with indicated Laplace propagation messages. The node function f b is denoted by f ˜ b according to (53).
Entropy 23 00807 g013
Figure 14. Visualization of a subgraph G ( b , j ) with indicated messages. The open circle indicates a point-mass constraint of the form δ ( s j θ j ) , where the value θ j is optimized.
Figure 14. Visualization of a subgraph G ( b , j ) with indicated messages. The open circle indicates a point-mass constraint of the form δ ( s j θ j ) , where the value θ j is optimized.
Entropy 23 00807 g014
Figure 15. The FFG of the linear Gaussian state space model augmented with the EM constraints in Example 4.
Figure 15. The FFG of the linear Gaussian state space model augmented with the EM constraints in Example 4.
Entropy 23 00807 g015
Figure 16. (Left) The small dots indicate the noisy observations that are synthetically generated by the linear state space model of (23) using matrices specified in (24). The posterior distribution of the hidden states inferred by structured variational message passing is depicted with shaded regions representing plus and minus one variances. The minimum of the evaluated Bethe free energy over iterations is F [ q , f ] = 583.683 . Moreover, the posterior distribution for the precision matrix is given by Q W 0.00286 0.00038 0.00038 0.0 . 00691 , 102.0 . The EM estimates are θ = π / 7.821 , m ^ x 0 = [ 7.23 , 7.016 ] and V ^ x 0 = 11.028 1.926 1.926 10.918 . (Right) Free energy plots of the 4 algorithms discussed in Examples 1–4 on the same data set.
Figure 16. (Left) The small dots indicate the noisy observations that are synthetically generated by the linear state space model of (23) using matrices specified in (24). The posterior distribution of the hidden states inferred by structured variational message passing is depicted with shaded regions representing plus and minus one variances. The minimum of the evaluated Bethe free energy over iterations is F [ q , f ] = 583.683 . Moreover, the posterior distribution for the precision matrix is given by Q W 0.00286 0.00038 0.00038 0.0 . 00691 , 102.0 . The EM estimates are θ = π / 7.821 , m ^ x 0 = [ 7.23 , 7.016 ] and V ^ x 0 = 11.028 1.926 1.926 10.918 . (Right) Free energy plots of the 4 algorithms discussed in Examples 1–4 on the same data set.
Entropy 23 00807 g016
Table 1. Relation between local constraints and derived message updates. The rows refer to different constraints that relate to factor–variable combinations, factors, and variables, respectively. Note that each message passing algorithm combines a set of constraints. Abbreviations: Sum-Product (SP), Structured Variational Message Passing (SVMP), Mean-Field Variational Message Passing (MFVMP), Data Constraint (DC), Laplace Propagation (LP), Mean-Field Variational Laplace (MFVLP), Expectation Maximization (EM), and Expectation Propagation (EP).
Table 1. Relation between local constraints and derived message updates. The rows refer to different constraints that relate to factor–variable combinations, factors, and variables, respectively. Note that each message passing algorithm combines a set of constraints. Abbreviations: Sum-Product (SP), Structured Variational Message Passing (SVMP), Mean-Field Variational Message Passing (MFVMP), Data Constraint (DC), Laplace Propagation (LP), Mean-Field Variational Laplace (MFVLP), Expectation Maximization (EM), and Expectation Propagation (EP).
Local ConstraintSPSVMPMFVMPDCLPMFVLPEMEP
Normalization
Marginalization
Moment-Matching
Structured Mean-Field
Naive Mean-Field
Laplace Approximation
Dirac-delta
Estimation
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Şenöz, İ.; van de Laar, T.; Bagaev, D.; de Vries, B. Variational Message Passing and Local Constraint Manipulation in Factor Graphs. Entropy 2021, 23, 807. https://doi.org/10.3390/e23070807

AMA Style

Şenöz İ, van de Laar T, Bagaev D, de Vries B. Variational Message Passing and Local Constraint Manipulation in Factor Graphs. Entropy. 2021; 23(7):807. https://doi.org/10.3390/e23070807

Chicago/Turabian Style

Şenöz, İsmail, Thijs van de Laar, Dmitry Bagaev, and Bert de Vries. 2021. "Variational Message Passing and Local Constraint Manipulation in Factor Graphs" Entropy 23, no. 7: 807. https://doi.org/10.3390/e23070807

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop