Community detection has been an active research area for decades. Among all probabilistic models, Stochastic Block Model has been the most popular one. This paper introduces a novel probabilistic model: RW-HDP, based on random walks and Hierarchical Dirichlet Process, for community extraction. In RW-HDP, random walks conducted in a social network are treated as documents; nodes are treated as words. By using Hierarchical Dirichlet Process, a nonparametric Bayesian model, we are not only able to cluster nodes into different communities, but also determine the number of communities automatically. We use Stochastic Variational Inference for our model inference, which makes our method time efficient and can be easily extended to an online learning algorithm.READ FULL TEXT VIEW PDF
Designing effective algorithms for community detection is an important a...
Multiplex networks have become increasingly more prevalent in many field...
We present a new algorithm for community detection. The algorithm uses r...
We propose a robust, scalable, integrated methodology for community dete...
Stochastic block models (SBM) are widely used in network science due to ...
This paper addresses the problem of community detection in networked dat...
A distinguishing property of communities in networks is that cycles are ...
Social networks have been studied intensively for decades. Community detection is one of the most interesting problems in this area. Social networks usually possess community structure: nodes in the network can be grouped such that nodes in the same group are densely connected while nodes in different groups are sparsely connected. We call such groups communities.
Over the years, many novel methods have been proposed for community structure extraction. Among them, there is a category of methods based on random walks on networks , , . In these methods, random walks on the network serve as input data for future network property mining. A simple illustration explains why random walks give us insights of the network’s properties, such as community structure. Because nodes in the same community tend to be densely connected, unsurprisingly, the path of a random walker tends to fall in only a small number of communities. Combining many random walks together can be a very good way of collecting information of the network, thus reveal the network’s properties. What’s more, a random walker chooses its next move based solely on the information of the neighborhood of its current position, which makes random walk easy to implement.
Traditional community detection methods need to specify the number of communities manually. Moreover, this same problem is quite common in statistical and machine learning. How many classes should I use in my mixture model? How many factors should I use in my factor analysis? The classical way to handle this problem is by model selection, where people first fit several models, then conduct model selection to choose the model that fits the data well and also has a relatively small model complexity. Nonparametric Bayesian models (BNP) address this problem in a very different way: it can detect such hyper-parameters automatically and can increase the model complexity when new data are observed.
Our model RW-HDP is based on random walks and nonparametric Bayesian modeling mentioned above. We first conduct random walks on the network. Each node is treated as a word, and each random walk is treated as a document. Using random walks as the input data, we fit the HDP topic model to reveal community structure. For fast model inference (posterior approximation), we use Stochastic Variational Inference .
Our model has many merits:
By equipping a probabilistic model to the random walks, we obtain a better interpretation than other methods.
HDP, a nonparametric Bayesian model, can automatically determine the number of communities and, if necessary, automatically increase the number of communities when new data are observed.
The random walk part can be parallelized which ensures that our method can be time efficient.
The posterior approximation part can easily be extended to an online learning scenario where random walks are not generated at once but keep streaming.
The rest of the paper is organized as follows. In section 2 we introduce the related works. In section 3, we describe our method in details. In section 4, we outline the experimental studies and compare our method to others. In section 5, we close with a conclusion and a discussion of possible future works.
Community detection in complex networks has been receiving a lot of attentions during the past decades. A large number of methods have been proposed for this problem. For example, centrality or betweenness based approaches and minimum cut methods are two of the most popular and rich tactics , , , , , .
While being less popular, other works such as random walk based methods also enrich the research in this field. Pons and Latapy  introduced a measure of similarity between nodes based on random walks. Rosvall and Bergstrom 
utilized the probability flow of random walks on a network as a proxy for information flows to reveal community structure. Perozzi, AI-Rfou, and Skiena
conducted random walks on a network, and treated them as sentences, later they used Natural Language Processing techniques to map the nodes into a Euclidean space for various tasks including clustering analysis.
LDA topic model proposed by Blei, et al  has been applied in many domains such as document modeling , image processing , information retrieval  and the list goes on. Zhang, et al  developed a method for network community detection based on LDA. In their model, a social interaction profile was treated as a document and LDA was smoothly fitted into the community detection task, where communities were treated as topics.
Nonparametric Bayesian models are becoming popular these days due to their flexibility ,  and new posterior inference methods such as Variational Inference , . Teh, Jordan, Beal, and Blei  extended the Dirichlet Process to the Hierarchical Dirichlet Process which can also be viewed as an extension of LDA model. Hoffman, Blei, Wang, and Paisley  developed the Stochastic Variational Inference for several non-parametric Bayesian models including HDP. In social network research, Morup and Schmidt ,  formulated a non-parametric Bayesian community generative model for social network analysis. Kim, Gopalan, Blei, and Sudderth  proposed the hierarchical Dirichlet process relational model which allowed nodes to have mixed membership in an unbounded set of communities. Guo and Nordman  introduced a series of Bayesian nonparametric statistical models for community detection. Blundell and Teh  proposed an efficient Bayesian nonparametric model for discovering hierarchical community structure in social networks.
In relation to these related works, our work essentially combines the data generation component of the random walk (RW) approach and the inferential component of the HDP topic model. This combination allows us to achieve more than what the previous methods can do, e.g., automatic detection of number of communities, and the use of more informative RW “documents” for the topic model to detect the network communities.
Later we will show that the proposed method indeed leads to obvious improvement in several performance measures in the real applications, when compared to several existing methods; but first we will describe the details of the proposed method in the next section.
In this section, we describe the RW-HDP model for network community detection in detail. We first introduce related terminologies and notation. Section 3.1 describes the corpus generation using random walks. Section 3.2 introduces the Hierarchical Dirichlet Process topic model.
Formally, let be an undirected network, where is the set of nodes; is the set of edges and is the weight between node and . is the number of nodes. As we treat each node as a word, is also the vocabulary size. We assume networks are undirected but our model can easily be extended to directed ones.
Our notation is partly summarized in Table 1.
|number of nodes||size of the vocabulary|
|number of random walks||number of documents|
|expected random walk length||expected document length|
|length of the random walk||length of the document|
|the random walk||the document|
|node in the random walk||word in the document|
|community assignment of||topic assignment of|
Each random walk is treated as a document and the collection of random walks is treated as the corpus. To carry out a random walk, we need to specify three elements: the starting point, the length, and the transition probability matrix.
The starting points are sampled independently uniformly across the nodes set
. The lengths of random walks are sampled independently from Poisson distribution parametrized by, the expected length of a random walk. As for the transition matrix , we take the edge weights into consideration. Let . That being said, a random walker at node , would randomly choose one of node ’s neighbors to visit in the next step with probability proportional to the edge weight between node and its destination.
The success of the proposed method is caused by using RW to generate informative “documents” for topic discovery. The same word, when embedded in good documents, can be easily assigned its correct topic; on the other hand, when it is embedded in bad documents, it cannot be easily assigned any topic with clarity, even when the same topic model, e.g., the HDP topic model, is used. As a simple example: when the network has two communities of integer-indexed nodes, the community of odd indexes and the community of even indexes, with many more within-community connections than between-community connections. The completely random (CR) documents would have documents all looking like, which is hard to be assigned any topic clearly. On the other hand, RW will generate documents either like or ,which have clearly distinctive styles of word distributions. The same word, say, 3, cannot be easily assigned a topic in CR documents, but can be easily assigned a topic in the RW documents.
The RW documents also have a natural interpretation. An RW document can be regarded as recording the experience of a person in making a sequence of friends in an RW fashion in the network, each time with his newest friend introducing a “neighbor” to him as a newer friend. These documents of names of friends, when accumulated over many such experiences as a corpus will, therefore, be very informative in inferring the community structure, unlike CR documents consisting of only random names.
To speed up the corpus generation process, random walks can be carried out simultaneously using parallel computing. Also, if we keep carrying out random walks and feeding newly observed random walks to the HDP topic model, we easily extend our model to an online learning model. Although we set the length of a random walk be a Poisson random variable, it is not critical to our method.
In this section, we introduce the Hierarchical Dirichlet Process topic model  in detail and show how to apply it for network community structure extraction.
HDP topic model is a mixture model with unbounded number of mixtures (topics). In mixture models, each observation is assumed to belong to a cluster or group. In our case, each node belongs to a topic
. Note that in topic models, a word may be assigned to different topics in different documents. For the network community detection problem, we go a step further: we use Bayesian rule to calculate the overall probability of a node belonging to each community and assign the node to the community with the largest posterior probability. If we can get the conditional probabilityand the topic probability , then by Bayesian rule, the conditional probability is given by
The community assignment of node is .
For programming implementation simplicity, we will derive the HDP topic model using stick-breaking construction. The HDP topic model couples a set of document-level Dirichlet Process via a single top-level Dirichlet Process. In the top-level, the base measure is a symmetric Dirichlet over the vocabulary simplex. The stick-breaking construction for HDP topic model is given by :
Draw an infinite number of topics,
Draw corpus breaking proportions,
For each document:
Draw document-level topic indexes,
Draw document breaking proportions,
For each word:
Draw topic assignment .
Draw word .
Note that specifies the word distribution in the topic. By stick-construction, the corpus level distribution of topics is given by:
thus from (1) the overall probability of node belonging to topic is given by
The HDP topic model is a hierarchical model which means that there are different levels in the governing ranges of variables. Variables such as and are corpus or global level variables. They govern the distributions of the observations (words) across all documents. While, other variables such as and are document or local level variables because they only govern the distributions of the observations in a particular document. The scopes of variables are clearly shown in Figure 1.
We choose Stochastic Variational Inference , which is a combination of stochastic method and Variational Inference, for posterior approximation. At each iteration, we only sample a mini batch of documents, update their corresponding local variables, and then treat them as if they appear times to update the global variables333Other constructions of the HDP topic model and the details of the Stochastic Variational Inference for the model can be found in Hoffman et al. (2013)..
In this section, we evaluate and compare the performances of our model with three previously proposed methods. The comparison has been done in five different types of networks.
We deliberately choose three models to compare with ours. Each of them shares one characteristic with our model. Since RW-HDP consists of three major characteristics: random walk, nonparametric Bayesian, and topic model. We decide to choose the following three models to compare with:
SIP2-LDA , a topic based community detection model. In this model, each node is associated with a social interaction profile (SIP2), which only takes a node’s immediate and secondary neighbors into consideration. Those social interaction profiles are treated as documents for community detection using Latent Dirichlet Allocation.
Walktrap , a random walk based community detection model. This method does not actually implement random walks on the network, but it defines node-to-node distance and community-to-community distance based on properties of random walks, such as the transition probability between any pair of nodes within steps. Later, it merges communities iteratively to get a hierarchical tree of partition. Finally, it cuts the tree to get the best partition.
, a nonparametric Bayesian network generative model. The generative process is: first, a cluster assignment is generated using Chinese Restaurant Process (a commonly used metaphor for Dirichlet Process); then, within-cluster and between-cluster link probabilities are generated; finally, links between nodes are generated according to the within- and between-cluster link probabilities.
We conduct experiments on several different types of networks:
yeast: a yeast protein complex interaction network .
ca-GrQc: Arxiv General Relativity and Quantum Cosmology collaboration network. If an author co-authored a paper with author , the graph contains an undirected edge between and .
ca-CondMat: Arxiv Condense Matter Physics collaboration network .
US powergrid: the high-voltage power grid in the Western States of the United States of America. The nodes are transformers, substations, and generators, and the ties are high-voltage transmission lines .
The statistics of networks are summarized in Table 2.
To compare our method with others, we use community scoring functions. A good community tends to be densely connected internally and sparsely connected with other parts of the network. The community scoring functions quantify this intuition in different aspects .
Given a set of nodes (a community of the network ), let be the subgraph induced by , where . Let denote the number of nodes in the original network. Let denote the number of nodes in set , and the number of edges in set . Let denote the number of edges with one end in , and the other outside of : . We use the following four community scoring functions:
Internal density: . This metric sores the community structure based on its internal connectivity. A larger internal density usually means a better community structure .
Cut Ratio: , which quantifies the community structure based on its external connectivity. A smaller cut ratio usually means a better community structure .
Conductance: , which measures the fraction of edge that points outside the cluster. It combines both internal and external connectivity to give a score. A smaller conductance usually means a better community structure .
Modularity: , where is the number of communities, the fraction of edges with one end in community and the other in community , . This index falls in . A larger modularity means a better community structure .
For the two topic based models: SIP2-LDA and RW-HDP, we also compare their perplexity scores  on the testing corpus. Perplexity is defined as:
where is the testing corpus, which is either random walks in RW-HDP model, or randomly sampled social profiles in SIP-LDA model. A smaller perplexity score corresponds to a better topic model.
There are three types of hyperparameters that are worthy of study. They are corpus, HDP topic model, and Stochastic Variational Inference hyperparameters. Here, we briefly explain the principles and intuitions of choosing proper hyperparameters.
The corpus hyperparameters are average random walk length and number of random walks . If is too large, a document will contain words from many topics, which by intuition is not a well-written document and thus will make it hard for the topic model to detect any meaningful topic assignment. cannot be too small either. An extreme case is , where it is impossible to capture the dependencies between nodes and thus will make community detection by topic models in vain. In our experiments, we set to be around 100. The same principle applies to corpus size . We set to be approximately five times of the number of nodes.
The HDP topic model has an infinite number of topics which makes it hard for programming implementation and variational inference. Instead, we do truncations both at the corpus level and the document level. At the corpus level, we fit breaking points as the topic choices. At the document level, we fit topic pointers and let the topic assignment variable take on one of values. can be much smaller than as there might be hundreds of topics in the corpus but for a single document, only a small number of topics will be exhibited. To see this is still an infinite model, note that by setting the truncations high enough, the variational posterior will not necessarily use all topics .
The last type of hyperparameters is those in Stochastic Variational Inference, such as batch size, the number of epochs, etc. The choice of batch size is a tradeoff between speed and noise. We set the batch size to be a small number such assince noise is tolerable in our community detection task. We run epochs on the corpus.
Our model outperforms other models almost in every aspect and on every dataset, except that the modularity of our model on the GSE network is slightly smaller than that of Walktrap and the densities of our model on the US powergrid and the ca-CondMat network are not the biggest among all models.
RW-HDP outperforms SIP2-LDA because random walk is a much better way of collecting information compared to the social interaction profile. Also, HDP topic model is more powerful than LDA, as the former is a nonparametric Bayesian model. Both RW-HDP and Walktrap utilize random walks but perhaps it is because the transition probability between nodes within steps is not the best way to capture nodes similarities that makes Walktrap less successful in terms of model performances. Also, Walktrap views the community detection as an optimization problem. It merges two communities according to Ward’s method which minimizes the mean of squared distances between each node and its community. To get the best partition, the algorithm cuts the hierarchical tree at where it has the largest modularity, which could result in less satisfying results on other metrics. RW-HDP, on the contrary, is a probabilistic model, which may be the reason why it is more flexible. As for BCD, though it is also a nonparametric Bayesian model, hierarchically, it has a relatively shallow depth, which could be the reason why it lacks the power to reveal the network structure.
Network community detection has been studied intensively by researchers from various disciplines. In this paper, we present the RW-HDP model for this task. As the name suggested, the two pillars for RW-HDP are random walk and Hierarchical Dirichlet Process topic model. We first conduct random walks on the network and treat them as documents. Later, we fit the Hierarchical Dirichlet Process topic model to reveal community structure. As HDP is a nonparametric model, our method enables us to find the number of communities automatically. Our work is a new endeavor in nonparametric Bayesian modeling in networks. It borrows ideas from some novel previous works and outperforms them.
The choices of hyperparameters are based on intuitive rules at the current stage. A more sophisticated mathematical formulation leaves as one of our future works. Also, our model can be improved in many ways. One possible future work is to allow overlapping community detection. Currently, we assume each node only belongs to a unique community, the one gives the largest conditional probability. We may relax this assumption and assign a community to a node if its corresponding conditional probability exceeds some threshold, which would allow overlapping communities to exist. Finally, we believe by changing HDP topic model to other topic models, we are able to find various types of community structures in networks, such as hierarchical community structure. Such interesting applications of topic models on social networks are yet to be explored in the future.
. in ICCV ’05: Proceedings of the Tenth IEEE International Conference on Computer Vision. Washington, DC, USA: IEEE Computer Society, 2005, pp. 1331-1338.