Phase transition in the detection of modules in sparse networks
Aurelien Decelle, Florent Krzakala, Cristopher Moore, Lenka Zdeborová
Stochastic block models.
We consider networks of nodes. Each node has a hidden label , specifying which of groups it is a member of. These labels are chosen independently, where is the probability that a given node has label (normalized so that ). If is the number of nodes in each group, we have .
Once the group assignment is chosen, the model generates a graph as follows. For each pair of nodes with , we put an edge between and independently with probability , leaving them unconnected with probability . We call the affinity matrix. Since we are interested in the sparse case where , we will use the rescaled affinity matrix and assume that in the limit .
Bayesian inference for block models.
Bayesian inference has been applied to community detection before. However, except for some very specific generative models NewmanLeicht07 , the likelihood function must be computed approximately, either through Monte Carlo sampling (e.g. ClausetMoore08 ) or variational methods HofmanWiggins08 . The crucial contribution of our work is that the quantities that follow from Bayesian inference can be computed exactly in the thermodynamic limit using the cavity method, or on real finite networks using the BP algorithm in time roughly linear in the size of the network. The probability that the model parameters take a given set of values , conditioned on the topology of the network , is
The sum is over all possible group assignments , where for each node . The prior includes all graph-independent information about the values of the parameters. We will assume there is no such information available and hence this prior is uniform. In that case, maximizing over is equivalent to maximizing the sum .
The function is called the likelihood. It is the probability that the model would produce the group assignment and the network , assuming that its parameters are . We can write the likelihood exactly for many different generative models; for the stochastic block model defined above, it is
Thus is proportional to the partition sum of a generalized Potts model, with Hamiltonian
There is a strong interaction between connected nodes, and a weak one between unconnected nodes. The play the role of local fields, enforcing the prior distribution on group assignments.
Inferring the parameters is equivalent to minimizing the free energy associated with (2). If has a non-degenerate minimum, then, from the saddle point method, is with high probability exactly the set of parameters used in the generation of the network. In that case, inferring the parameters of the underlying model is possible.
It can be proven in general NishimoriBook01 that this marginalization maximizes the number of correctly labeled nodes in the thermodynamic limit, and that it is a better choice than using the ground state of (2). Furthermore, a configuration chosen according to the Boltzmann distribution has, asymptotically, the correct group sizes and the correct number of edges between each pair of groups, while for the ground state this is not true; finding the minimum bisection, for instance, creates the illusion of two groups even in a completely random graph coppersmith . Moreover marginalization is algorithmically easier than searching for the ground state. The expected number of correctly labeled nodes can be estimated as , even without knowing the original assignment.
Belief Propagation.
We could estimate the free energy using Monte Carlo (MC) sampling, and we do this for comparison. But a faster algorithm is Belief Propagation (BP), known in physics as the cavity method MezardParisi01 ; MezardMontanari07 . It is exact in the thermodynamic limit as long as the network is locally treelike, and as long as connected correlations decay rapidly as a function of topological distance.
To derive the BP equations YedidiaFreeman03 ; MezardMontanari07 , one introduces “messages” and for each pair of nodes . These are conditional marginals in the cavity method. For instance, is the probability that would be in group if were removed from the network. Assuming conditional independence between the neighbors of each node and neglecting lower order terms, the messages must be a fixed point of a consistency equation,
for each edge . Here is the set of ’s neighbors, the field summarizes the influence of the non-edges, and is a normalizing factor. We start with random messages, and iterate (3) until we reach a fixed point. This typically takes just a few iterations, and each step takes linear, , time.
The marginals corresponding to the BP fixed point are , and the free energy is
where . For more details, see YedidiaFreeman03 ; MezardMontanari07 . Requiring that is stationary we update the parameters to their most-likely values given the fixed point
and . Starting with a suitable initial value , we compute and iterate until convergence (see Fig. 1), as in the expectation-maximization algorithm DempsterLaird77 . To learn the number of groups , we run the algorithm with several values of . The free energy decreases with and then stays constant for .
Phase diagrams.
(where is the permutation group) is zero, and the original assignment is undetectable. Generalizing AchlioptasCoja-Oghlan08-focs ; KrzakalaZdeborova09 , one can show there is essentially no difference between a graph produced by the block model and a completely random graph of the same average degree; the free energy of the two ensembles is asymptotically identical.
A third situation arises if has both a paramagnetic fixed point and the ordered fixed point at the true . In this case, the two phases co-exist and the detectability transition is first-order; see Fig. 2 on the right. The phase transition is located by comparing the free energies of the two phases. However, even if the ordered fixed point has a lower free energy, it is not easy to find it unless the initial messages are close to the true group assignment. All but an exponentially small set of initial messages will lead to the paramagnetic fixed point. This situation is typical of mean-field first-order phase transitions. In fact, recent results about random optimization problems show that finding the lower-free-energy phase in this case is an extremely hard problem FranzMezard01 ; KrzakalaZdeborova09 .
Only when the paramagnetic phase is no longer locally stable does inference become easy. We can compute the location of the transition to this easily-detectable phase analytically by analyzing how a small random perturbation to the paramagnetic fixed point propagates as the BP equations are iterated MezardMontanari06 ; KrzakalaZdeborova09 . It follows that for
the original group assignment is dynamically attractive and hence many algorithms, e.g. MC or BP, will converge to it. Note that it is typically still hard to compute the ground state of (2), even though we can compute the marginals, and therefore the optimal estimate of the group assignment, asymptotically exactly.
Real-world networks.
Our algorithm is not restricted to large random networks; it is applicable to real networks as well. We tested it on the “Karate Club” network Zachary77 , a common benchmark for community detection. For , BP leads to two different fixed points. One corresponds to the actual known division into two groups. The other has a smaller free energy and thus a larger likelihood, and splits the network into high-degree nodes and low-degree nodes as found in KarrerNewman10 . These two fixed points correspond to two local minima of for , and depending on the initial value BP converges to one or the other. For , our algorithm converges to fixed points with yet lower values of . For the best fixed point corresponds to a splitting of the two actual groups into high-degree and low-degree subgroups.
The results obtained with MC, which can be easily equilibrated for such a small network, are almost identical to those of BP in terms of the parameters and marginals, and identical in terms of the estimated group assignments. This demonstrates that BP is a useful approach even on real, finite networks that are far from trees.
Conclusion.
We have presented a principled and asymptotically exact analysis of the detection of communities in networks generated by the stochastic block model. There is a strict limit on detectability due to a transition from a phase where the free energy landscape lets us infer the model’s parameters, to a phase where it does not. In some cases the communities are detectable, but the problem is hard because the attractive region around the correct fixed point is exponentially small. Our analysis comes with an associated learning algorithm, which for large sparse networks generated from the model is able to learn the number of groups, their exact sizes, and the affinity matrix . Our approach and our algorithm are easily generalized to other local generative models, and we will investigate its performance on a variety of real-world networks in the future.
Acknowledgments.
We are grateful to Mark Newman for helpful discussions. C.M. is funded by the McDonnell Foundation.