    # Finding Non-overlapping Clusters for Generalized Inference Over Graphical Models

Graphical models use graphs to compactly capture stochastic dependencies amongst a collection of random variables. Inference over graphical models corresponds to finding marginal probability distributions given joint probability distributions. In general, this is computationally intractable, which has led to a quest for finding efficient approximate inference algorithms. We propose a framework for generalized inference over graphical models that can be used as a wrapper for improving the estimates of approximate inference algorithms. Instead of applying an inference algorithm to the original graph, we apply the inference algorithm to a block-graph, defined as a graph in which the nodes are non-overlapping clusters of nodes from the original graph. This results in marginal estimates of a cluster of nodes, which we further marginalize to get the marginal estimates of each node. Our proposed block-graph construction algorithm is simple, efficient, and motivated by the observation that approximate inference is more accurate on graphs with longer cycles. We present extensive numerical simulations that illustrate our block-graph framework with a variety of inference algorithms (e.g., those in the libDAI software package). These simulations show the improvements provided by our framework.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## I Introduction

A graphical model is a probability distribution defined on a graph such that each node represents a random variable (or multiple random variables), and edges in the graph represent conditional independencies111In a graphical model over a graph , for each edge , is conditionally independent of given , where indexes all the nodes in the graph. We can also say that for each , is dependent on given , for all such that .

. The underlying graph structure in a graphical model leads to a factorization of the joint probability distribution. Graphical models are used in many applications such as sensor networks, image processing, computer vision, bioinformatics, speech processing, social network analysis, and ecology

[1, 2, 3], to name a few. Inference over graphical models corresponds to finding the marginal distribution for each random variable given the joint probability distribution . It is well known that inference over graphical models is computationally tractable for only a small class of graphical models (graphs with low treewidth ), which has led to much work to derive efficient approximate inference algorithms.

### I-a Summary of Contributions

Our main contribution in this paper is a framework that can be used as a wrapper for improving the accuracy of approximate inference algorithms. Instead of applying an inference algorithm to the original graph, we apply the inference algorithm to a block-graph, defined as a graph in which the nodes are non-overlapping clusters of nodes from the original graph. This results in marginal estimates of a cluster of nodes of the original graph, which we further marginalize to get the marginal estimates of each node. Larger clusters, in general, lead to more accurate inference algorithms at the cost of increased computational complexity. Fig. 1 illustrates our proposed block-graph framework for generalized inference.

The key component in our framework is to construct a block-graph. It has been empirically observed that approximate inference is more accurate on graphs with longer cycles . This motivates our proposed block-graph construction algorithm where we first find non-overlapping clusters such that the graph over the clusters is a tree. We refer to the resulting block-graph as a block-tree. The block-tree construction algorithm runs in linear time by using two passes of breadth-first search over the graph. The second step in our block-graph construction algorithm is to split large clusters222For discrete graphical models, the complexity of inference is exponential in the maximum cluster size, which is why using the block-tree directly for inference may not be computationally tractable if the maximum cluster size is large. in the block-tree. Using numerical simulations, we show how our proposed algorithm for splitting large clusters leads to superior inference algorithms when compared to an algorithm that randomly splits large clusters in the block-tree and an algorithm that uses graph partitioning to find non-overlapping clusters .

As an example, consider applying our block-graph framework to belief propagation (BP) , which finds the marginal distribution at each node by iteratively passing messages between nodes. If the graph is a tree, BP computes the exact marginal distributions, however, for general graphs with cycles, BP only approximates the true marginal distribution. Our framework for inference (see Fig. 1) generalizes BP so that message passing occurs between clusters of nodes, where the clusters are non-overlapping. The estimates of the marginal distribution at each node can be computed by marginalizing the approximate marginal distribution of each cluster. Our framework is not limited to BP and can be used as a wrapper for any inference algorithm on graphical models as we show in Section V. Using numerical simulations, we show how our block-graph framework improves the marginal distribution estimates computed by current inference algorithms in the literature: BP , conditioned belief propagation (CBP) , loop corrected belief propagation (LC) [9, 10], tree-structured expectation propagation (TreeEP), iterative join-graph propagation (IJGP) , and generalized belief propagation (GBP) [12, 13, 14, 15].

### I-B Related Work

There has been significant work in extending the BP algorithm of message passing between nodes to message passing between clusters. It is known that the true marginal distributions of a graphical model minimize the Gibbs free energy . In [12, 17], the authors show that the fixed points of the BP algorithm minimize the Bethe free energy, which is an approximation to the Gibbs free energy. This motivated the generalized belief propagation (GBP) algorithm that minimizes the Kikuchi free energy , a better approximation to the Gibbs free energy. In GBP, message passing is between clusters of nodes that are overlapping. A more general approach to GBP is proposed in  using region graphs and in  using the cluster variation method (CVM). References [19, 20] propose some guidelines for choosing clusters in GBP. Reference  proposes a framework for GBP, called iterative join-graph propagation (IJGP), that first constructs a junction tree, a tree-structured representation of a graph with overlapping clusters, and then splits larger clusters in the junction tree to perform message passing over a set of overlapping clusters.

In the original paper describing GBP , the authors give an example of how non-overlapping clusters can be used for GBP, since, when applying the block-graph framework to BP, the resulting inference algorithm (B-BP, where is the cluster size) becomes a class of GBP algorithms where the set of overlapping clusters corresponds to cliques in the block-graph. Our numerical simulations identify cases where B-BP leads to superior marginal estimates when compared to a GBP algorithm that uses overlapping clusters. Moreover, since our framework can be applied to any inference algorithm, we show that the marginal estimates computed by GBP based algorithms can be improved by applying the GBP based algorithm to a block-graph. Our block-graph framework is not limited to generalizing BP and we show this in our numerical simulations where we generalize conditioned belief propagation (CBP) and loop corrected belief propagation (LC). Both these algorithms have been shown to empirically perform better than GBP for certain graphical models [10, 8]. In [21, 6], the authors propose using graph partitioning algorithms for finding non-overlapping clusters for generalizing the mean field algorithm for inference . Our numerical results show that our algorithm for finding non-overlapping clusters leads to superior marginal estimates.

We note that our work differs from some other works on studying graphical models defined over graphs with non-overlapping clusters. For example,  consider the problem of learning a Gaussian graphical model defined over some block-graph. Similar efforts have been made in  for discrete valued graphical models. In , the author analyzes properties of a graphical model defined on a block-tree. In all of the above works, the underlying graphical model is assumed to be block-structured. In our work, we assume a graphical model defined on an arbitrary graph and then find a representation of the graphical model on a block-graph to enable more accurate inference algorithms.

This paper is motivated by our earlier work in studying tree structures for Markov random fields (MRFs) indexed over continuous indices . In , we have shown that a natural tree-like representation for such MRFs exists over non-overlapping hypersurfaces within the continuous index set. Using this representation, we derived extensions of the Kalman-Bucy filter  and the Rauch-Tung-Striebel smoother  to Gaussian MRFs indexed over continuous indices.

### I-C Paper Organization

Section II reviews graphical models and the inference problem. Section III outlines our proposed algorithm for constructing block-trees, a tree-structured graph over non-overlapping clusters. Section IV presents our algorithm for splitting larger clusters in a block-tree to construct a block-graph. Section V outlines our block-graph framework for generalizing inference algorithms. Section VI presents extensive numerical results evaluating our framework on various inference algorithms. Section VII summarizes the paper and outlines some future research directions.

## Ii Background: Graphical Models and Inference

A graphical model is defined using a graph , where the nodes index a collection of random variables and the edges encode statistical independencies [29, 3]

. The set of edges can be directed, undirected, or both. Since directed graphical models, also known as Bayesian networks, can be mapped to undirected graphical models by moralizing the graph, in this paper, we only consider undirected graphical models, also known as Markov random fields or Markov networks.

The edges in a graphical model imply Markov properties about the collection of random variables. The local Markov property states that is independent of given , where is the set of neighbors of . For example, in Fig. 2, is independent of given . The global Markov property, which is equivalent to the local Markov property for non-degenerate probability distributions, states that, for a collection of disjoint nodes , , and , if separates and , is independent of given . An example of the sets , , and is shown in Fig. 2. From the Hammersley-Clifford theorem , the Markov property leads to a factorization of the joint probability distribution over cliques (fully connected subsets of nodes) in the graph,

 p(x1,x2,…,xp)=1Z∏C∈CψC(xC), (1)

where is the set of all cliques in the graph , are potential functions defined over cliques, and is the partition function, a normalization constant.

Inference in graphical models corresponds to finding marginal distributions, say , given the probability distribution for . This problem is of extreme importance in many domains. A classical example is in estimation when we are given noisy observations of

and we want to estimate the underlying random vector. To find the minimum mean square error (mmse) estimate, we need to marginalize the conditional probability distribution

to find the marginals . An algorithm for marginalizing can be used for marginalizing . In general, exact inference is computationally intractable, however, there has been significant progress in deriving efficient approximate inference algorithms. The main contribution in this paper is the block-graph framework for generalizing inference algorithms (see Fig. 1) so that the performance of approximate inference algorithms can be improved.

## Iii Block-Trees: Finding Trees Over Non-overlapping Clusters

Section III-A outlines our algorithm for constructing block-trees. Section III-B defines the notion of optimal block-trees by using connections between block-trees and junction trees. Section III-C outlines greedy algorithms for finding optimal block-trees.

### Iii-a Main Algorithm

###### Definition 1 (Block-Graph and Block-Tree)

For a graph , a block-graph is a graph over clusters of nodes in such that each node in is associated with only one cluster in . In other words, the clusters in are non-overlapping. If the edge set is tree-structured, we call the block-graph a block-tree.

Algorithm 1 outlines our construction of a block-tree given an arbitrary graph . Without loss in generality, we assume that is connected, i.e., there exists a path between all non adjacent nodes. The original graph and a set of nodes are the input. The output is the block-tree . We refer to as the root cluster. The algorithm first finds an initial set of clusters and then splits these clusters to find the final block-tree. We explain the steps of the algorithm.

Forward step: Find clusters using breadth-first search (BFS) so that . These clusters serve as initial clusters for the block-tree. During the BFS step, split each cluster into its connected components using the subgraph , which denotes the graph only over the nodes in (Line 2).

Backwards step: We now merge the clusters in each to find the final block-tree. The key intuition in this step is that each cluster should be connected to a single cluster in . If this is not the case, we merge clusters in accordingly. Starting at , for each , find all clusters in that are connected to (Line 6). Combine all clusters in into a single cluster and update the clusters in accordingly. Repeat the above steps for all the clusters in .

The first part of Algorithm 1 finds successive non-overlapping neighbors of the root cluster. This leads to an initial estimate of the block-tree graph. In the backwards step, we split clusters to form a block-tree. We illustrate Algorithm 1 with examples.

Example: Consider the grid graph of Fig. 3(a). Choosing , we get the initial estimates of the clusters as shown in Fig. 3(a). Running the backwards step to identify the final clusters (see Fig. 3(b)), we get the block-tree in Fig. 3(c).

Example: In the previous example, the initial estimates of the clusters matched the final estimates and the final block-tree was a chain-structured graph. We now consider an example where the final block-tree will in fact be tree-structured. Consider the partial grid graph of Fig. 4(a). Choosing , we get the initial estimates of the clusters in Fig. 4(a). We now run the backwards step of the algorithm. Since is connected to and , . Thus, become a single cluster. We now find neighbors of in . It is clear that only are connected to , so become a single cluster. In this way, we have split into two clusters: and . Continuing the algorithm, we find the remaining clusters as shown in Fig. 4(b). The final block-tree is shown in Fig. 4(c).

The following proposition characterizes the time complexity and correctness of Algorithm 1.

###### Proposition 1

Algorithm 1 runs in time and always outputs a block-tree.

###### Proof:

Both the forward step and the backwards step involve a breadth first search, which has complexity . Algorithm 1 always outputs a block-tree since each cluster in is only connected to a single cluster in .

Block-trees are closely related to junction trees. In the next Section, we explore this connection to define optimal block-trees.

### Iii-B Optimal Block-Trees

Junction trees, also known as clique trees or join trees, are tree-structured representations of graphs using a set of overlapping clusters [31, 32]. The width of a graph is the maximum cardinality of a cluster in the junction tree minus one. The treewidth of a graph is the minimum width of a graph over all possible junction tree representations. It is well known that several graph related problems that are computationally intractable in general can be solved efficiently when the graph has low treewidth. For the problem of inference over graphical models,  showed how junction trees can be used for exact inference over graphical models defined over graphs with small treewidth.

Given a block-tree , an equivalent junction tree representation can be easily computed by combining all clusters connected along edges into a single cluster. For example, the junction tree representation for the block-trees in Fig. 3(c) and Fig. 4(c) are given in Fig. 5(a) and Fig. 5(b), respectively. Using this junction tree, we can derive exact inference algorithms for graphical models parameterized by block-trees.

It is easy to see that the complexity of inference using block-trees will depend on the maximum sum of cluster sizes of adjacent clusters in the block-tree (since this will correspond to the width of the equivalent junction tree). Thus, an optimal block-tree can be defined as a block-tree for which is minimized. From Algorithm 1, the construction of the block-tree depends on the choice of the root cluster . Thus, finding an optimal block-tree is equivalent to finding an optimal root cluster. This problem is computationally intractable since we need to search over all possible combinations of root clusters .

As an example illustrating how the choice of alters the block-tree, consider finding a block-tree for the partial grid in Fig. 4(a). In Fig. 4(c), we constructed a block-tree using as the root cluster. The maximum sum of adjacent cluster sizes in Fig. 4(c) is four. Instead of choosing , let . The initial estimate of the clusters are shown in Fig. 6(a). The final block-tree is shown in Fig. 6(c). Since the clusters and are adjacent, the maximum sum of adjacent clusters is five.

### Iii-C Greedy Algorithms for Finding Optimal Block-Trees

In the previous Section, we saw that finding optimal block-trees is computationally intractable. In this Section, we propose three greedy algorithms for finding optimal block-trees that have varying degrees of computational complexity.

Minimal degree node - : In this approach, which we call , we find the node with minimal degree and use that node as the root cluster. The intuition behind this is that the minimal degree node may lead to the smallest number of nodes being added in the clusters. The complexity of this approach is , where is the number of nodes in the graph.

The next two algorithms are based on the relationship between junction trees and block-trees outlined in Section III-B. Recall that for every block-tree, we can find a junction tree. This means that an optimal junction tree (a junction tree with minimal width) may be used to find an approximate optimal block-tree. Further, finding optimal junction trees corresponds to finding optimal elimination orders in graphs . Thus, we can make use of greedy algorithms for finding optimal elimination orders to find optimal block-trees.

Using an elimination order - : One of the simplest algorithms for finding an approximate optimal elimination order is known as [34, 35], where the elimination order corresponds to the sorted list of nodes in increasing degree. The complexity of is since we just need to sort the nodes. Using the elimination order, we triangulate333A graph is triangulated if each cycle of length four or more has an edge connecting non adjacent nodes. the graph to find the cliques. These cliques correspond to the set of clusters in the junction tree representation. We search over a constant number of cliques to find an optimal root cluster.

Using an elimination order - : Another popular greedy algorithm is to find an optimal elimination order such that at each step in the triangulation algorithm, we choose a node that adds a minimal number of extra edges in the graph. This is known as  and has polynomial complexity. Thus, is in general slower than , but does lead to slightly better elimination orders on average. To find the block-tree, we again search over a constant number of cliques over the triangulated graph.

We now evaluate the three different greedy algorithms, , , and , for finding optimal block-trees in Fig. 7. To do this, we create clusters of size such that the total number of nodes is (one cluster may have less than nodes). We then form a tree over the clusters and associate a clique between two clusters connected to each other. We then remove a certain fraction of edges over the graph (not the block-tree), but make sure that the graph is still connected. By construction, the width of the graph constructed is at most . Fig. 7 shows the performance of , , and over graphs with different number of nodes and different values of . We clearly see that both and compute widths that are close to optimal. The main idea in this Section is that we can use various known algorithms for finding optimal junction trees to find optimal block-trees. Fig. 7: Plot showing the performance of three different greedy heuristics for finding optimal block-trees.

### Iii-D Exact Inference Using Block-Trees

In the literature, exact inference over graphical models using non-overlapping clusters is referred to as the Pearl’s clustering algorithm . In  and , the authors use non-overlapping clustering for some particular directed graphical models for an application in medical diagnostics. For lattices, [39, 40, 41] derive inference algorithms by scanning the lattice horizontally (or vertically). Our block-tree construction algorithm provides a principled way of finding non-overlapping clusters over arbitrary graphs.

Inference over graphical models defined on block-trees can be done by extending the belief propagation (BP) algorithm . The computational complexity of BP will depend on . On the other hand, the computational complexity of exact inference using other frameworks that use overlapping clusters depends on the width of the graph [4, 42, 43, 44], which is in general less than or equal to . The main advantage of using block-trees for exact inference is that the complexity of constructing block-trees is , whereas the complexity of constructing tree-decompositions for inference using frameworks that use overlapping clusters is worse than [33, 44, 45]. Thus, block-trees are suitable for exact inference over time-varying graphical models [46, 47] such that the clusters in the block-tree are small.

## Iv Block-Graph: Splitting Clusters in a Block-Tree

In this Section, we outline a greedy algorithm for splitting large clusters in a block-tree to form a block-graph. This is an important step in our proposed framework (see Fig. 1) for generalizing inference algorithms since we apply the inference algorithm to the block-graph as opposed to the original graph. Note that we can use the block-tree itself for inference; however, for many graphs this is computationally intractable since the complexity of inference for discrete graphical models using a block-tree is exponential in . Thus, when the size of one cluster in the block-tree is large, exact inference using block-trees will be computationally intractable444Our algorithm for finding optimal block-trees uses the junction tree construction algorithm, so even if is large and the treewidth of the graph is small, we can detect this and use junction trees for inference..

We modify Algorithm 1 for constructing block-trees to construct block-graphs such that all clusters have cardinality at most .

1. Using an initial cluster of nodes , find clusters using breadth-first search (BFS) such that . While doing the BFS, write as the set of all connected components in the subgraph . Thus, is a set of clusters.

2. For , if there exists any cluster that has cardinality greater than , partition those components. Let be the final set of clusters.

3. Perform the next steps for each , starting at . Let be the set of all clusters that have cardinality greater than . Partition all clusters in into appropriate size clusters of size at most .

4. Merge the clusters in the set . The idea used in merging clusters is that if two clusters are connected to the same cluster in , by merging these two clusters, we reduce one edge in the final block-graph. Further, if two clusters in are not connected to the same cluster in , we do not merge these two clusters, since the number of edges in the final block-graph will remain the same. The final clusters constructed using the above rules is denoted as .

5. The block-graph is given by the clusters and the set of edges between clusters.

The key step in the above algorithm is Step 4, where we cluster nodes appropriately. Fig. 8 explains the intuition behind merging clusters with an example. Suppose, we use the block-graph construction algorithm up to Step 3 and now we want to merge clusters in . If we ignore Step 4 and merge clusters randomly, we might get the block-graph in Fig. 8(b) on merging nodes and . If we use Step 4, since nodes and are connected to the same node, we merge these to get the block-graph in Fig. 8(c). The graph in Fig. 8(c) has a single cycle with five edges, whereas the graph in Fig. 8(b) has two cycles of size four and three. It has been observed that inference over graphs with longer cycles is more accurate than inference over graphs with shorter cycles . Thus, our proposed algorithm leads to block-graphs that are favorable for inference.

## V Inference Using Block-Graphs

Define a graphical model on a graph using a collection of random variables , where each takes values in , where . Let be a block-graph representation of the graph . To derive inference algorithms over the block-graph, we need to define appropriate potentials (or factors) associated with each clique in the block-graph. This can be done by mapping the potentials from the original graph to the block-graph. As an example, let be the graph in Fig. 9(a) and let the probability distribution over be given by

 p(x)=1Zψ1,2(x1,x2)ψ1,4(x1,x4)ψ1,3(x1,x3)ψ2,4,5(x2,x4,x5)ψ4,5,6,7(x4,x5,x6,x7)ψ3,6(x3,x6). (2)

Let the clusters in the block-graph representation of in Fig. 9(b) be , , , and . The probability distribution in (2) can be written in terms of the block-graph as follows:

 p(x)=1ZΨ1,2(xV1,xV2)Ψ1,3(xV1,xV3)Ψ2,4(xV2,xV4)Ψ2,4(xV2,xV4)ψ3,4(xV3,xV4), (3)

where

 Ψ1,2(xV1,xV2) =ψ1,2(x1,x2)ψ1,4(x1,x4)ψ2,4,5(x2,x4,x5) (4) Ψ1,3(xV1,xV3) =ψ1,3(x1,x3) (5) Ψ2,4(xV2,xV4) =ψ4,5,6,7(x4,x5,x6,x7) (6) Ψ2,4(xV3,xV4) =ψ3,6(x3,x6). (7)

Let be an algorithm for inference over graphical models. Inference over the graph can be performed using with inputs being the potentials in (2). Inference over the block-graph can be performed using with input being the potentials in (4)-(7). To get the marginal distributions from the block-graph, we need to further marginalize the joint probability distribution over each cluster.

###### Remark 1

Both the representations (2) and (3) are equivalent, so we are not making any approximations when parameterizing the graphical model using block-graphs.

###### Remark 2

There is a trade-off in choosing the size of the clusters in the block-graph. Generally, as observed in our numerical simulations, larger clusters lead to better estimates at the cost of more computations.

###### Remark 3

We presented the block-graph framework using undirected graphical models. The results can be easily generalized to settings where the probability distribution is represented as a factor graph .

## Vi Numerical Simulations

In this Section, we provide numerical simulations to show how our proposed block-graph framework for generalizing inference algorithms can be used to improve the performance of current approximate inference algorithms that have been proposed in the literature. Throughout this Section, we assume and the probability distribution over factorizes as

 p(x)=1Zp∏i=1ϕi(xi)∏(i,j)∈Eψij(xi,xj). (8)

The node potentials are given by , where and the edge potentials are given by

 Repulsive (REP): ψij(xi,xj) =exp(−|bij|xixj) (9) Attractive (ATT): ψij(xi,xj) =exp(|bij|xixj) (10) Mixed (MIX): ψij(xi,xj) =exp(−bijxixj), (11)

where and is the interaction strength. For distributions with attractive (repulsive) potentials, neighboring random variables are more likely to take the same (opposite) value. For distributions with mixed potentials, some neighbors are attractive, whereas some are repulsive. We study several approximate inference algorithms that have been proposed in the literature: Belief Propagation (BP) , Iterative Join-Graph Propagation (IJGP-) , Generalized Belief Propagation (GBP-) [13, 14], Conditioned Belief Propagation (CBP-) , Loop Corrected Belief Propagation (LC) , Tree-Structured Expectation Propagation (TreeEP) . In IJGP- and GBP-, the integer refers to the maximum size of the clusters, where the clusters in these algorithms are overlapping. The clusters in GBP- are selected by finding cycles of length in the graph. In CBP-, is an integer that refers to the number of clamped variables when performing inference: larger in general leads to more accurate marginal estimates. We use the libDAI software package  for all the inference algorithms except for IJGP, where we use the software provided by the authors at . For an inference algorithm Alg, we refer to the generalized inference algorithm as B-Alg, where the is an integer denoting the maximum size of the cluster in the block-graph.

We consider two types of graphs: (i) grid graphs and (ii) random regular graphs, where each node in the graph has the same degree and the edges are chosen randomly. Both these graphs have been used extensively in the literature for evaluating inference algorithms [10, 8]. We compare inference algorithms using the mean absolute error:

 Error=1pp∑s=1∑xs∈{−1,+1}|ˆps(xs)−ps(xs)|, (12)

where is the marginal estimate computed by an approximate inference algorithm and is the true marginal distribution. To evaluate the computational complexity, we measure the time taken in running the inference algorithms on a 2.66GHz Intel(R) Xeon(R) X5355 processor with 32 GB memory. Since all the approximate inference algorithms we considered are iterative algorithms, we set the maximum number of iterations to be 1000 and stopped the inference algorithm when the mean absolute difference between the new and old marginal estimates is less than . All the code and graphical models used in the numerical simulations can be downloaded from http://www.ima.umn.edu/~dvats/GeneralizedInference.html.

### Vi-a Evaluating the Block-Graph Construction Algorithm

We first evaluate our proposed algorithm for constructing block-graphs (see Section IV) where we split large clusters in a block-tree. Fig. 10 shows the results of applying our block-graph framework to generalize BP, CBP, LC, and TreeEP on a grid graph. We compare our algorithm to an algorithm that randomly splits the clusters in a block-tree and an algorithm proposed in  that uses graph partitioning to find non-overlapping clusters. In Fig. 10, the solid lines correspond to our algorithm (see legend B2-BP), the dashed lines correspond to random splitting of clusters (see legend RandB2-BP), and the dotted lines correspond to graph partitioning (see legend GP-B2-BP). The results reported are averages over trials.

###### Remark 4

It is clear that the graph partitioning approach performs the worst amongst the three different algorithms (the dotted line is above the solid and dashed line). For TreeEP, we observe that the graph partitioning approach performs worse than the original algorithm that does not use block-graphs. This suggests that the graph partitioning algorithm in  is not suitable for the inference algorithms considered in Fig. 10. We did not apply the graph partitioning algorithm to LC since the corresponding inference algorithm was very slow.

###### Remark 5

In most cases, our proposed algorithm for constructing block-graphs performs better than using an algorithm that randomly splits clusters (the solid line is below the dashed line). Interestingly, for TreeEP, the random algorithm performs worse than the original algorithm. We also observed that both the random algorithm and the graph partitioning algorithm took more time than our proposed algorithm. This suggests that our proposed block-graph construction algorithm leads to block-graphs that are favorable for inference. Fig. 10: Evaluating the block-graph construction algorithm in Section IV on a 5×5 grid graph. The solid lines, denoted by Bm-Alg for an inference algorithm Alg, correspond to using our proposed block-graph construction algorithm. The dashed lines correspond to an inference algorithm that randomly splits larger clusters in a block-tree. The dotted lines correspond to an inference algorithm that uses graph partitioning to find clusters. The plots in the top, middle, and bottom row correspond to repulsive, attractive, and mixed potentials, respectively.

### Vi-B Grid Graphs

Tables I, II, III, IV, and V show results of applying the block-graph framework for inference over graphical models defined on grid graphs. Fig. 11: Comparing the performance of BP, IJGP, and GBP. Algorithms with the same message passing complexity are plotted in the same color.
###### Remark 6

In general, we observe that for all cases considered, applying the block-graph framework leads to better marginal estimates. This is shown in the Tables, where for each inference algorithm, we highlight the algorithm leading to the smallest mean error in bold. For example, when using block-graphs of size two for BP, the error decreases by as much as (see BP vs. B-BP), whereas when using block-graphs of size three for BP, the error decreases by as much as (see BP vs. B-BP).

###### Remark 7

It is interesting to compare BP, IJGP, and GBP, where both IJGP and GBP are based on finding overlapping clusters and IJGP first constructs a junction tree and then splits clusters in the junction tree to find overlapping clusters. Note that for the class of graphical models considered in (8), B-BP belongs to the class of GBP- algorithms since we can map the block-graph into an equivalent graph with overlapping clusters as done so when converting a block-tree into a junction tree (see Fig. 5). Further, IJBP- is also a GBP- algorithm . Thus, we want to compare B-BP, IJGP-, and BP-. It is clear that GBP- leads to superior marginal estimates, however, this comes at the cost of significantly more computations. Fig. 11 compares B-BP to IJGP-. We observe that for many cases, B-BP leads to better marginal estimates than IJGP-. We note that comparing B-BP to IJGP- may not be appropriate since the stopping criteria for the IJGP may be different than that of the BP algorithm555For IJGP, we used the software available at . We could specify the maximum number of iterations, but not the stopping criteria..

###### Remark 8

We can apply the block-graph framework to generalize GBP based algorithms. Our results show that this leads to better marginal estimates, see GBP-4 vs. B2-GBP-4, IJGP-3 vs. B2-IJGP-3, and IJGP-4 vs. B2-IJGP-4. More specifically, looking at Table V, we notice that the performance of using block-graphs of size two on GBP results in the error being reduced to nearly of the original error.

###### Remark 9

In Fig. 11, we see that for many cases the performance of B2-IJGP-3 (B2-IJGP-4) is better than IJGP-6 (IJGP-8). This suggests that the set of overlapping clusters chosen using the block-graph framework may be better than the clusters chosen using the IJGP framework.

###### Remark 10

Overall, we observe that block-graph versions of TreeEP lead to the best estimates with reasonable computational time. For example, in Table IV, with , B2-TreeEP results in a mean error of running in an average of seconds. In comparison, GBP- takes an average of about seconds and the mean error is . When compared to other algorithms, B-CBP- runs in seconds and results in a mean error of . For mixed potentials in Table III, we observe that the generalized versions of TreeEP do not lead to significant improvements in the marginal estimates although the performance of other algorithms does improve. Reference  proposes a generalization of TreeEP and gives guidelines for choosing clusters in the GBP algorithm. As shown for IJGP and GBP, our framework can be used in conjunction with frameworks that use overlapping clusters.

###### Remark 11

To our knowledge, there have been no algorithms for generalizing LC and CBP-. The computational complexity of LC is exponential in the maximum degree of the graph , so it is only feasible to apply LC to a limited number of graphs. We only used LC for the grid graph example in Fig. 10. We observe that the CBP- algorithm improves the estimates of the BP algorithm. Moreover, for regimes where the interaction strength is small, the performance of generalized versions of CBP is comparable to that of TreeEP. For example, in Table IV, for , the best TreeEP algorithm has a mean error of and the best CBP based algorithm has a mean error of . As another example, in Table V, for , the best TreeEP algorithm has a mean error of and the best CBP algorithm has a mean error of .

###### Remark 12

Fig. 12 shows how the error scales as the size of the cluster in the block-graph increases for the grid graph. It is clear that the error in general decreases as the cluster size increases; however, for some cases, the error does seem to increase especially when the interaction strength is large.

### Vi-C Random Regular Graphs

Tables VI and VII show results of applying the block-graph framework for inference over graphical models defined on random regular graphs with attractive potentials. Table VI considers graphs with nodes and degree and Table VII considers graphs with nodes and degree . Just like the grid graph case, we observe that our generalized framework leads to better marginal estimates. This is shown by highlighting the algorithm that leads to minimal mean error for each inference algorithm. We observe that both CBP and TreeEP based algorithms perform the best, even when compared to GBP.

## Vii Summary

We proposed a framework for generalizing inference (computing marginal distributions given the joint probability distribution) algorithms over graphical models (see Fig. 1). The key components in our framework are (i) constructing a block-tree, a tree-structured graph over non-overlapping clusters, and (ii) constructing a block-graph, a graph over non-overlapping clusters. We proposed a linear time algorithm for constructing block-trees and showed how large clusters in a block-tree can be split in a systematic manner to construct block-graphs that are favorable for inference. Using numerical simulations, we showed that our framework for generalized inference in general leads to improved marginal estimates for many approximate inference algorithms implemented in the libDAI software package. This suggests that the generalized inference framework can be used as a wrapper for improving the performance of approximate inference algorithms. All the code and graphical models used in the numerical simulations can be downloaded from http://www.ima.umn.edu/~dvats/GeneralizedInference.html. Although the focus in this paper was on computing marginal estimates, our proposed block-graph based framework can also be used to generalize algorithms for computing the partition function ( in (1)) [52, 53] or for the problem of MAP inference [54, 55, 56, 57].

There are several interesting research directions that can be further pursued to improve our generalized inference framework. Our algorithm for constructing block-graphs only used the structure of the graph in computing the set of non-overlapping clusters. Using the parameters of the graphical model may result in improved marginal estimates. Further, it may be of interest to design block-graphs that are specific to the inference algorithm of interest. Another interesting research direction is to combine frameworks that choose overlapping clusters with the block-graph framework.

## References

•  H. Rue and L. Held, Gaussian Markov Random Fields: Theory and Applications (Monographs on Statistics and Applied Probability), 1st ed.   Chapman & Hall/CRC, February 2005.
•  M. J. Wainwright and M. I. Jordan, Graphical Models, Exponential Families, and Variational Inference.   Hanover, MA, USA: Now Publishers Inc., 2008.
•  D. Koller and N. Friedman, Probabilistic Graphical Models: Principles and Techniques.   The MIT Press, 2009.
•  S. L. Lauritzen and D. J. Spiegelhalter, “Local computations with probabilities on graphical structures and their application to expert systems,” Journal of the Royal Statistical Society. Series B (Methodological), vol. 50, no. 2, pp. 157–224, 1988.
•  E. Fabre and A. Guyader, “Dealing with short cycles in graphical codes,” in IEEE International Symposium on Information Theory (ISIT), June 2000, p. 10.
•  E. P. Xing, M. I. Jordan, and S. Russell, “Graph partition strategies for generalized mean field inference,” in

Proceedings of the 20th conference on Uncertainty in artificial intelligence

, ser. UAI ’04.   Arlington, Virginia, United States: AUAI Press, 2004, pp. 602–610. [Online]. Available: http://portal.acm.org/citation.cfm?id=1036843.1036916
•  J. Pearl, Probabilistic Reasoning in Intelligent Systems: Networks of Plausible Inference.   Morgan Kaufmann, 1988.
•  F. Eaton and Z. Ghahramani, “Choosing a variable to clamp: Approximate inference using conditioned belief propagation,” in Proceedings of the Twelfth International Conference on Artificial Intelligence and Statistics, 2009, pp. 145–152.
•  A. Montanari and T. Rizzo, “How to compute loop corrections to the Bethe approximation,” Journal of Statistical Mechanics: Theory and Experiment, vol. 2005, no. 10, p. P10011, 2005.
•  J. M. Mooij and H. J. Kappen, “Loop corrections for approximate inference on factor graphs,” J. Mach. Learn. Res., vol. 8, pp. 1113–1143, May 2007.
•  R. Mateescu, K. Kask, V. Gogate, and R. Dechter, “Join-graph propagation algorithms,” Journal of Artificial Intelligence Research, vol. 37, pp. 279–328, 2010.
•  J. S. Yedidia, W. T. Freeman, and Y. Weiss, “Generalized belief propagation,” in NIPS, 2001, pp. 689–695.
•  T. Heskes, K. Albers, and B. Kappen, “Approximate inference and constrained optimization,” in UAI, 2003, pp. 313–320.
•  J. S. Yedidia, W. T. Freeman, and Y. Weiss, “Constructing free energy approximations and generalized belief propagation algorithms.” IEEE Transactions on Information Theory, vol. 51, no. 7, pp. 2282–2312, July 2005.
•  A. Pelizzola, “Cluster variation method in statistical physics and probabilistic graphical models,” Journal of Physics A: Mathematical and General, vol. 38, no. 33, pp. R309–R339, 2005.
•  M. Jordan, Z. Ghahramani, T. Jaakkola, and L. Saul, “An introduction to variational methods for graphical models,” Machine Learning, vol. 37, no. 2, pp. 183–233, Nov 1999.
•  J. Yedidia, W. Freeman, and Y. Weiss, “Bethe free energy, Kikuchi approximations, and belief propagation algorithms,” Mitsubishi Electric Research Laboratories, Tech. Rep. TR2001-16, 2001.
•  R. Kikuchi, “A theory of cooperative phenomena,” Phys. Rev., vol. 81, no. 6, pp. 988– 988–1003, 1951.
•  M. Welling, “On the choice of regions for generalized belief propagation,” in Proceedings of the 20th conference on Uncertainty in Artificial Intelligence, 2004, pp. 585–592.
•  M. Welling, T. Minka, and Y. W. Teh, “Structured region graphs: Morphing EP into GBP,” in Proceedings of the International Conference on Uncertainty in Artificial Intelligence, vol. 21, 2005.
•  E. P. Xing, M. I. Jordan, and S. Russell, “A generalized mean field algorithm for variational inference in exponential families,” in Proceedings of the 20th conference on Uncertainty in artificial intelligence, ser. UAI ’04.   Arlington, Virginia, United States: AUAI Press, 2003, pp. 602–610. [Online]. Available: http://portal.acm.org/citation.cfm?id=1036843.1036916
•  B. M. Marlin and K. P. Murphy, “Sparse Gaussian graphical models with unknown block structure,” in International Conference on Machine Learning, 2009, pp. 89–712.
•  A. Jalali, P. Ravikumar, V. Vasuki, and S. Sanghavi, “On learning discrete graphical models using group-sparse regularization,” in International Conference on Machine Learning, 2011, pp. 89–712.
•  D. Malioutov, “Approximate inference in Gaussian graphical models,” Ph.D. dissertation, Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology, 2008.
•  P. Lévy, “A special problem of Brownian motion, and a general theory of Gaussian random functions,” in Proceedings of the Third Berkeley Symposium on Mathematical Statistics and Probability, 1954–1955, vol. II.   Berkeley and Los Angeles: University of California Press, 1956, pp. 133–175.
•  D. Vats and J. M. F. Moura, “Telescoping recursive representations and estimation of Gauss-Markov random fields,” Trans. on Information Theory, vol. 57, no. 3, pp. 1645 – 1663, 2011.
•  R. E. Kalman and R. Bucy, “New results in linear filtering and prediction theory,” Transactions of the ASME–Journal of Basic Engineering, vol. 83, no. Series D, pp. 95–108, 1960.
•  H. E. Rauch, F. Tung, and C. T. Stribel, “Maximum likelihood estimates of linear dynamical systems,” AIAA J., vol. 3, no. 8, pp. 1445–1450, August 1965.
•  S. L. Lauritzen, Graphical Models.   Oxford University Press, USA, 1996.
•  J. Besag, “Spatial interaction and the statistical analysis of lattice systems,” Journal of the Royal Statistical Society. Series B (Methodological), vol. 36, no. 2, pp. 192–236, 1974.
•  R. Halin, “S-functions for graphs,” Journal of Geometry, vol. 8, pp. 171–186, 1976, 10.1007/BF01917434.
•  N. Robertson and P. D. Seymour, “Graph minors. II. Algorithmic aspects of tree-width,” Journal of Algorithms, vol. 7, no. 3, pp. 309 – 322, 1986.
•  F. Jensen and F. Jensen, “Optimal junction trees,” in Proceedings of the 10th Annual Conference on Uncertainty in Artificial Intelligence (UAI-94).   San Francisco, CA: Morgan Kaufmann, 1994, pp. 360–36.
• 

H. M. Markowitz, “The elimination form of the inverse and its application to linear programming,”

Management Science, vol. 3, no. 3, pp. 255–269, 1957.
•  A. Berry, P. Heggernes, and G. Simonet, “The minimum degree heuristic and the minimal triangulation process,” in Graph-Theoretic Concepts in Computer Science, ser. Lecture Notes in Computer Science, H. Bodlaender, Ed.   Springer Berlin / Heidelberg, 2003, vol. 2880, pp. 58–70.
•  U. B. Kjaerulff, “Triangulation of graphs - algorithms giving small total state space,” Department of Mathematics and Computer Science, Aalborg University, Denmark, Tech. Rep. Research Report R-90-09, 1990.
•  G. F. Cooper, “Nestor: A computer-based medical diagnostic aid that integrates causal and probabilistic knowledge,” Ph.D. dissertation, Department of Computer Science, Stanford University, 1984.
•  Y. Peng and J. A. Reggia, “Plausibility of diagnostic hypotheses,” in National Conference on Artificial Intelligence (AAAI’86), 1986, pp. 140–145.
• 

J. W. Woods and C. Radewan, “Kalman filtering in two dimensions,”

IEEE Trans. Inf. Theory, vol. 23, no. 4, pp. 473–482, Jul 1977.
•  J. M. F. Moura and N. Balram, “Recursive structure of noncausal Gauss-Markov random fields,” IEEE Trans. Inf. Theory, vol. IT-38, no. 2, pp. 334–354, March 1992.
•  B. C. Levy, M. B. Adams, and A. S. Willsky, “Solution and linear estimation of 2-D nearest-neighbor models,” Proc. IEEE, vol. 78, no. 4, pp. 627–641, Apr. 1990.
•  G. Shafer and P. P. Shenoy, “Probability propagation,” Annals of Mathematics and Artificial Intelligence, no. 1-4, pp. 327–352, 1990.
•  N. Zhang and D. Poole, “A simple approach to Bayesian network computations,” in Proceedings of the Tenth Canadian Conference on Artificial Intelligence, 1994, pp. 171–178.
•  R. Dechter, “Bucket elimination: A unifying framework for reasoning,” Artificial Intelligence, vol. 113, no. 1-2, pp. 41–85, Sep 1999.
• 

K. Kask, R. Dechter, J. Larrosa, and F. Cozman, “Bucket-tree elimination for automated reasoning,” University of California, Irvine, Tech. Rep. R92, 2001.

•  M. Kolar, L. Song, A. Ahmed, and E. P. Xing, “Estimating time-varying networks,” Annals of Applied Statistics, 2009.
•  S. Zhou, J. Lafferty, and L. Wasserman, “Time varying undirected graphs,” Machine Learning, vol. 80, pp. 295–319, 2010, 10.1007/s10994-010-5180-0.
•  F. Kschischang, B. Frey, and H.-A. Loeliger, “Factor graphs and the sum-product algorithm,” IEEE Transactions on Information Theory, vol. 47, no. 2, pp. 498 –519, feb 2001.
•  T. Minka and Y. Qi, “Tree-structured approximations by expectation propagation,” in Proc. Neural Information Processing Systems Conf. (NIPS), 2003, p. 2003.
•  J. M. Mooij, “libDAI: A free and open source C++ library for discrete approximate inference in graphical models,” Journal of Machine Learning Research, vol. 11, pp. 2169–2173, Aug. 2010.
•  V. Gogate, “Iterative joint graph propagation,” http://www.hlt.utdallas.edu/~vgogate/ijgp.html.
•  M. J. Wainwright, T. S. Jaakkola, and A. S. Willsky, “A new class of upper bounds on the log partition function,” IEEE Trans. on Information Theory, vol. 51, no. 7, pp. 2313 – 2335, July 2005.
•  Q. Liu and A. Ihler, “Bounding the partition function using Holder’s inequality,” in Proceedings of the 28th International Conference on Machine Learning, L. Getoor and T. Scheffer, Eds., June 2011, pp. 849–856.
•  M. J. Wainwright, T. S. Jaakkola, and A. S. Willsky, “MAP estimation via agreement on (hyper)trees: Message-passing and linear programming approaches,” IEEE Trans. Inf. Theory, vol. 51, no. 11, pp. 3697–3717, Nov. 2005.
•  V. Kolmogorov, “Convergent tree-reweighted message passing for energy minimization,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 28, pp. 1568–1583, 2006.
•  D. Sontag and T. Jaakkola, “Tree block coordinate descent for MAP in graphical models,” Journal of Machine Learning Research, vol. 5, pp. 544–551, 2009.
•  T. Jebara, “MAP estimation, message passing, and perfect graphs,” in Proceedings of the Twenty-Fifth Conference on Uncertainty in Artificial Intelligence, ser. UAI ’09, 2009, pp. 258–267.