Group detection method, device, electronic device and computer storage medium
By obtaining the prior distribution of community size in social relationship network and optimizing module degree calculations in combination with the Louvain method, the problem of inaccurate community division in the existing technology is solved, the accuracy of community division is improved, and the social relationship is reflected The real situation of community size in the Internet.
Patent Information
- Application Number
- CN202110099626.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-25
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2041-01-25
Smart Images

Figure CN113763193B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a group detection method, device, electronic equipment and computer storage medium. Background Art
[0002] In the related art, group detection is a technology that divides the nodes of a social network into multiple communities. After the communities are divided using the group detection technology, the connections between the nodes within each community are strong connections, while the connections between communities are weak connections. In the related art, a modularity-based method can be used to implement group detection of social networks. Modularity is not only proposed as an optimization objective function, it is also one of the most popular standards for measuring the quality of community results. The introduction of the modularity index is also considered a milestone in the history of group detection research; however, the inventors found that the community division results obtained using the modularity-based method are not completely consistent with the actual community structure of the social network, that is, the community division results obtained using the modularity-based method are not accurate enough. Summary of the invention
[0003] The embodiments of the present invention are intended to provide a technical solution for group detection, which can solve the problem that the community division results obtained in the related art are not accurate enough.
[0004] An embodiment of the present invention provides a group detection method, the method comprising:
[0005] Obtain the prior distribution of community size in social relationship networks;
[0006] Determining a calculation method of the modularity of the social relationship network according to the prior distribution;
[0007] With the goal of maximizing the modularity of the social relationship network, the social relationship network is divided into communities to obtain community division results.
[0008] In some embodiments, when the social relationship network is a non-weighted network, the method for calculating the modularity of the social relationship network according to the prior distribution includes:
[0009] A calculation method for the modularity of the social relationship network is determined according to the prior distribution, the total number of edges of the social relationship network, the number of edges of each community in the social relationship network, and the sum of the node degrees of each community in the social relationship network.
[0010] In some embodiments, when the social relationship network is a weighted network, the method for calculating the modularity of the social relationship network according to the prior distribution includes:
[0011] A calculation method for the modularity of the social relationship network is determined according to the prior distribution, the sum of the node strengths of the social relationship network, the sum of the node strengths of each community in the social relationship network, and the sum of the weights of the edges in each community in the social relationship network.
[0012] In some embodiments, the step of dividing the social relationship network into communities with the goal of maximizing the modularity of the social relationship network to obtain community division results includes:
[0013] Determine a modularity change function according to weight coefficients of any two communities in the social relationship network and a weight coefficient of a new community after the two communities are merged; wherein the weight coefficient of a community in the social relationship network is related to the number of nodes in the community;
[0014] According to the calculation method of the modularity and the modularity change function, the social relationship network is divided into communities using the Louvain method to obtain the community division result.
[0015] In some embodiments, determining the modularity change function according to the weight coefficients of any two communities in the social relationship network and the weight coefficient of a new community after the arbitrary two communities are merged includes:
[0016] When the social relationship network is a non-weighted network, the modularity change function is determined according to the weight coefficients of any two communities in the social relationship network, the weight coefficient of the new community after the merger of the any two communities, the total number of edges in the social relationship network, the sum of the node degrees of each community in the any two communities, the number of edges of each community in the any two communities, and the number of edges between the any two communities.
[0017] In some embodiments, determining the modularity change function according to the weight coefficients of any two communities in the social relationship network and the weight coefficient of a new community after the arbitrary two communities are merged includes:
[0018] When the social relationship network is a weighted network, the modularity change function is determined according to the weight coefficients of any two communities in the social relationship network, the weight coefficient of the new community after the merger of the any two communities, the sum of the node strengths of the social relationship network, the sum of the node strengths of each community in the any two communities, the sum of the weights of the edges of each community in the any two communities, and the sum of the weights of the edges between the any two communities.
[0019] In some embodiments, obtaining a prior distribution of community sizes in a social relationship network includes:
[0020] The distribution information of the community sizes in the sample data is collected, and the prior distribution of the community sizes in the social relationship network is constructed according to the distribution information of the community sizes in the sample data.
[0021] The embodiment of the present invention further provides a group detection device, the device comprising:
[0022] An acquisition module, used to obtain the prior distribution of community size in a social relationship network;
[0023] A first processing module, configured to determine a calculation method of the modularity of the social relationship network according to the prior distribution;
[0024] The second processing module is used to divide the social relationship network into communities with the goal of maximizing the modularity of the social relationship network to obtain a community division result.
[0025] In some embodiments, when the social relationship network is a non-weighted network, the first processing module is used to determine the calculation method of the modularity of the social relationship network according to the prior distribution, including:
[0026] A calculation method for the modularity of the social relationship network is determined according to the prior distribution, the total number of edges of the social relationship network, the number of edges of each community in the social relationship network, and the sum of the node degrees of each community in the social relationship network.
[0027] In some embodiments, when the social relationship network is a weighted network, the first processing module is used to determine the calculation method of the modularity of the social relationship network according to the prior distribution, including:
[0028] A calculation method for the modularity of the social relationship network is determined according to the prior distribution, the sum of the node strengths of the social relationship network, the sum of the node strengths of each community in the social relationship network, and the sum of the weights of the edges in each community in the social relationship network.
[0029] In some embodiments, the second processing module is used to divide the social relationship network into communities with the goal of maximizing the modularity of the social relationship network to obtain community division results, including:
[0030] Determine a modularity change function according to weight coefficients of any two communities in the social relationship network and a weight coefficient of a new community after the two communities are merged; wherein the weight coefficient of a community in the social relationship network is related to the number of nodes in the community;
[0031] According to the calculation method of the modularity and the modularity change function, the social relationship network is divided into communities using the Louvain method to obtain the community division result.
[0032] In some embodiments, the second processing module is used to determine the modularity change function according to the weight coefficients of any two communities in the social relationship network and the weight coefficient of a new community after the arbitrary two communities are merged, including:
[0033] When the social relationship network is a non-weighted network, the modularity change function is determined according to the weight coefficients of any two communities in the social relationship network, the weight coefficient of the new community after the merger of the any two communities, the total number of edges in the social relationship network, the sum of the node degrees of each community in the any two communities, the number of edges of each community in the any two communities, and the number of edges between the any two communities.
[0034] In some embodiments, the second processing module is used to determine the modularity change function according to the weight coefficients of any two communities in the social relationship network and the weight coefficient of a new community after the arbitrary two communities are merged, including:
[0035] When the social relationship network is a weighted network, the modularity change function is determined according to the weight coefficients of any two communities in the social relationship network, the weight coefficient of the new community after the merger of the any two communities, the sum of the node strengths of the social relationship network, the sum of the node strengths of each community in the any two communities, the sum of the weights of the edges of each community in the any two communities, and the sum of the weights of the edges between the any two communities.
[0036] In some embodiments, the acquisition module is used to obtain the prior distribution of community sizes in the social relationship network, including:
[0037] The distribution information of the community sizes in the sample data is collected, and the prior distribution of the community sizes in the social relationship network is constructed according to the distribution information of the community sizes in the sample data.
[0038] An embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any one of the above-mentioned group detection methods when executing the program.
[0039] An embodiment of the present invention further provides a computer storage medium on which a computer program is stored. When the computer program is executed by a processor, any one of the above-mentioned group detection methods is implemented.
[0040] In the group detection method, device, electronic device and computer storage medium proposed in the embodiments of the present invention, first, a prior distribution of community sizes in a social relationship network is obtained; then, a calculation method for the modularity of the social relationship network is determined based on the prior distribution; finally, with the goal of maximizing the modularity of the social relationship network, the social relationship network is divided into communities to obtain community division results.
[0041] Thus, in an embodiment of the present invention, the calculation method of the modularity of the social relationship network can be determined based on the consideration of the prior distribution of the community size in the social relationship network, and then the community division can be performed. That is to say, the final community division result can reflect the size of the community in the social relationship network, thereby improving the accuracy of the community division result to a certain extent.
[0042] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings herein are incorporated into and constitute a part of the specification. These drawings illustrate embodiments consistent with the present invention and, together with the specification, are used to explain the technical solutions of the present invention.
[0044] Figure 1 A schematic diagram of a group detection method based on modularity in related technologies;
[0045] Figure 2 is a flow chart of a group detection method according to an embodiment of the present invention;
[0046] Figure 3 It is a schematic diagram of a process of dividing a social relationship network into communities using the Louvain method in an embodiment of the present invention;
[0047] Figure 4 is a schematic structural diagram of a group detection device according to an embodiment of the present invention;
[0048] Figure 5 Schematic diagram of the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0049] In related technologies, a social network refers to a network composed of different users that reflects the relationships between users. A community can reflect the structural characteristics of a social network, embody the relationships between users, and display user interest characteristics. By performing group detection on a social network, communities (user groups) with common interests can be identified in the social network, and the correct information can be disseminated to the correct audience, which plays an important role in achieving accurate information push.
[0050] In the related art, methods for detecting groups in social networks include graph segmentation, clustering, spectral methods, label propagation, and modularity-based methods. Among them, graph segmentation divides the nodes in the graph into groups of a predetermined size, with the minimum number of edges between these groups. This problem is an NP-hard problem. Clustering methods regard communities as a collection of objects with similar content, and their focus is on the definition of node similarity. Spectral methods require the calculation of matrix eigenvalues, which are very expensive and difficult to apply in large-scale social networks. Label propagation methods have the advantage of low computational complexity and can be used to solve the problem of fast community detection, which is suitable for community detection in large-scale networks. Label propagation methods usually result in a large difference in community size. Modularity is not only proposed as an optimization objective function, but it is also one of the most popular criteria for measuring the quality of community results.
[0051] Modularity-based methods generally have resolution limitations, that is, the community division results obtained by modularity-based methods are not accurate enough; Figure 1 As shown in the figure, there are 24 clusters in the ring network, and the nodes in each cluster are connected to each other (the nodes in the cluster are not shown in the figure), and there are 5 nodes in each cluster; here, the cluster is a subset of nodes in the graph, and any two different nodes in the cluster are adjacent to each other. The cluster is also called a complete graph. Clusters are connected by a single link, and finally form a ring in the graph. Intuitively, each cluster should be divided into a separate community with a modularity of Q1 = 0.8674. However, when using the modularity-based method, according to the modularity index, the optimal community division will combine two clusters, and the corresponding modularity is Q2 = 0.8712. This means that the optimal modularity does not correspond to the best community detection result. It can be seen that the modularity-based method cannot find some community structures smaller than a certain scale. The main reason for the resolution limitation is that the modularity definition does not include information about the number of nodes in the community, and the community division results are also highly sensitive to the edge weights in the network.
[0052] In related technologies, call information, location information, and device login information between users can be used to predict social relationships between users, such as family relationships, fan relationships, etc. Ideally, the data set obtained after prediction is completely cohesive within the community, and there is no connection between communities, so that the user group detection can directly obtain the result through a round of connectivity graph analysis. However, in actual scenarios, it is impossible to have such an ideal situation. The quality of data sources, the small number of available data types, and the performance limitations of algorithm models may all cause connections between different communities. Therefore, it is necessary to further divide the groups through community detection algorithms. In some scenarios, according to experience, the members of the same family are often only 2 to 6 people. If there is no restriction on the size of the community, the size of each community obtained by the modularity-based method is often much larger than this number (2 to 6); the fundamental reason is that there is less prior information about the community in the related technology, which may cause its community division results to fail to meet the understanding of the community, making its results inaccurate.
[0053] In related technologies, the modularity index is proposed by comparing with the link relationship structure in a random network. The modularity is calculated using the following formula (1):
[0054]
[0055] Where m represents the total number of edges in the social network. In the social network, each node represents a user, and the connections between nodes are the edges in the social network. i and k j They represent the degrees of node i and node j respectively. The degree of a node represents the number of edges associated with the node; c i and c j Respectively represent the communities to which nodes i and j belong. When c i =c j When δ(c i ,c j )=1, otherwise, δ(c i ,c j )=0;e i Represents community c i The number of inner edges, d i Represents community c i The sum of the degrees of all nodes in A ij The value of can be explained by formula (2).
[0056]
[0057] When using a modularity-based method to detect groups in a social network, the larger the modularity corresponding to the community division result, the more reasonable the community division result.
[0058] However, based on the above records, it can be seen that the definition of modularity in the relevant technology only considers the structural information of the social relationship network, and does not consider the prior distribution of the community size. Therefore, how to accurately obtain the community division result based on the prior distribution of the community size is a technical problem that needs to be solved urgently.
[0059] In order to solve the problem that the community division result obtained by the modularity-based method in the related art is not accurate enough, a technical solution of the embodiment of the present invention is proposed.
[0060] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the embodiments provided herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the embodiments provided below are partial embodiments for implementing the present invention, rather than providing all embodiments for implementing the present invention. In the absence of conflict, the technical solutions recorded in the embodiments of the present invention can be implemented in any combination.
[0061] It should be noted that, in the embodiments of the present invention, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a method or apparatus including a series of elements includes not only the elements explicitly recorded, but also includes other elements not explicitly listed, or also includes elements inherent to the implementation of the method or apparatus. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other related elements (such as steps in a method or units in a device, for example, a unit may be a part of a circuit, a part of a processor, a part of a program or software, etc.) in the method or apparatus including the element.
[0062] The term "and / or" herein is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or C can represent: A exists alone, A and C exist at the same time, and C exists alone. In addition, the term "at least one" herein means any combination of at least two of any one or more of a plurality of.
[0063] For example, the group detection method provided by the embodiment of the present invention includes a series of steps, but the group detection method provided by the embodiment of the present invention is not limited to the recorded steps. Similarly, the group detection device provided by the embodiment of the present invention includes a series of modules, but the group detection device provided by the embodiment of the present invention is not limited to including the modules explicitly recorded, and may also include modules that need to be set to obtain relevant information or perform processing based on information.
[0064] The embodiments of the present invention may be implemented based on a terminal and / or a server, where the terminal may be a thin client, a thick client, a handheld or laptop device, a microprocessor-based system, a set-top box, a programmable consumer electronic product, a network personal computer, a small computer system, etc. The server may be a small computer system, a large computer system, and a distributed cloud computing technology environment including any of the above systems, etc.
[0065] Electronic devices such as servers may be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, program modules may include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers may be implemented in a distributed cloud computing environment where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules may be located on local or remote computing system storage media including storage devices.
[0066] The embodiment of the present invention proposes a group detection method. Figure 2 is a flow chart of a group detection method according to an embodiment of the present invention, as shown in Figure 2 As shown, the process may include:
[0067] Step 201: Obtain a priori distribution of community sizes in a social relationship network.
[0068] In an embodiment of the present application, a prior distribution of community size in a social relationship network can be derived based on sample data, where the sample data represents known social relationship network data. In some embodiments, the distribution information of community size in the sample data can be statistically analyzed, and a prior distribution of community size in a social relationship network can be constructed based on the distribution information of community size in the sample data.
[0069] It can be seen that by statistically analyzing the distribution information of community size in sample data, it is easy to derive the prior distribution of community size in the social relationship network.
[0070] In some embodiments, a histogram distribution of community sizes may be statistically obtained from sample data, and then a priori distribution of community sizes in the social relationship network may be determined based on the histogram distribution.
[0071] Exemplarily, the probability density function p(|c|) of the community size can be estimated from the sample data as a prior distribution, where |c| represents the number of nodes in community c.
[0072] For example, the Parzen window method can be used to construct the prior distribution of the community size in the social relationship network. The Parzen window method is also called the kernel density estimation method. It is a method used in probability theory to estimate unknown density functions and is one of the non-parametric test methods. The Parzen window function can be a Gaussian function or other functions. The Parzen window function can be expressed by formula (3).
[0073]
[0074] Among them, n represents the number of sample data, σ represents the standard deviation, and x i represents the value of the i-th sample in the sample data, x is the independent variable, and p(x) represents the prior probability that the sample value is x.
[0075] Referring to the above formula (3), it can be seen that the probability density function of the community size in the social relationship network approaches the average value of the Gaussian function. When σ is smaller (approaching 0), p(x) is closer to the histogram distribution, and when σ is larger, p(x) is smoother. For example, σ can be empirically set to 0.6.
[0076] Step 202: Determine a calculation method for the modularity of the social relationship network according to the prior distribution.
[0077] In the related art, the modularity of a social network can be calculated according to the above formula (1), but the prior distribution of the size of communities in the social network is not considered in formula (1).
[0078] In an embodiment of the present application, the calculation method of the modularity of the social relationship network can be re-determined based on the above-mentioned prior distribution. That is, the embodiment of the present application corrects the definition of the modularity of the social relationship network in the related art, and the prior distribution of the community size in the social relationship network is reflected in the corrected definition of the modularity.
[0079] Step 203: with the goal of maximizing the modularity of the social relationship network, the social relationship network is divided into communities to obtain community division results.
[0080] In some embodiments, the modularity of the social relationship network may be used as an optimization objective function to determine the function values of the modularity corresponding to various community division results, and the community division result corresponding to the maximum function value may be used as the final community division result.
[0081] It is understandable that if the modularity of the above social relationship network is directly used as the optimization objective function to obtain the community division result, it may lead to excessively high computational complexity. Therefore, in other embodiments, the greedy optimization strategy of the Louvain method can be borrowed to locally optimize the modularity by finding small communities, and then finally obtain the community division result through aggregation and iteration.
[0082] Exemplarily, the modularity change function may be determined according to the weight coefficients of any two communities in the social relationship network and the weight coefficient of a new community after the above-mentioned any two communities are merged; wherein the weight coefficient of a community in the social relationship network is related to the number of nodes in the community;
[0083] Then, according to the above-mentioned calculation method of modularity and modularity change function, the social relationship network is divided into communities using the Louvain method to obtain the community division result.
[0084] In one implementation, after the number of nodes in the community is obtained, the weight coefficient of the community in the social relationship network can be obtained according to a preset community weight coefficient calculation formula; the value range of the community weight coefficient can be 0 to 1.
[0085] It can be understood that the Louvain method is a method for quickly calculating community division results through aggregation and iteration. Therefore, the embodiment of the present application draws on the idea of the Louvain algorithm and performs local optimization through an improved modularity change function, which can facilitate fast calculation while ensuring the generation of community division results.
[0086] In practical applications, steps 201 to 203 can be implemented based on a processor of an electronic device, and the processor can be at least one of an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a central processing unit (CPU), a controller, a microcontroller, and a microprocessor.
[0087] It can be understood that in the embodiments of the present invention, the calculation method of the modularity of the social relationship network can be determined based on the prior distribution of the community size in the social relationship network, and then the community division can be performed. In other words, the final community division result can reflect the size of the community in the social relationship network, which improves the accuracy of the community division result to a certain extent.
[0088] In some embodiments, the above social relationship network can be a weighted network or an unweighted network; each edge in a weighted network has a corresponding weight, and the weights corresponding to different edges in a weighted network may be different; the weights of all edges in an unweighted network are the same.
[0089] In some embodiments, when the social relationship network is a non-weighted network, the calculation method of the modularity of the social relationship network can be determined based on the above-mentioned prior distribution, the total number of edges in the social relationship network, the number of edges of each community in the social relationship network, and the sum of the node degrees of each community in the social relationship network.
[0090] Exemplarily, in order to determine the calculation method of the modularity of the social relationship network, the above-mentioned prior distribution can be used to constrain the number of nodes of each community in the social relationship network; when the social relationship network is a non-weighted network, the calculation formula of the modularity of the social relationship network can be formula (4).
[0091]
[0092] Among them, Q v represents the modularity of the social network when it is a non-weighted network, m represents the total number of edges in the social network, W(|c i |) represents the community c in the social relationship network i The weight coefficient, W(|c i |)=p(|c i |), we can see that community c in the social relationship network i The weight coefficient can reflect the community c i The probability of the number of internal nodes; e i Represents community c i The number of edges, d i Represents community c i The sum of the degrees of all nodes in it.
[0093] For unweighted networks, it can be considered that the number of communities in the network is uniformly distributed, that is, the size of each community obeys a uniform distribution, and the probability density functions of the community sizes corresponding to different communities are the same.
[0094] It can be seen that for unweighted networks, the calculation method of the modularity of social relationship networks can be easily modified by combining the prior distribution of community size and the graph structure of the network.
[0095] In some embodiments, when the social relationship network is a non-weighted network, the modularity change function can be determined based on the weight coefficients of any two communities in the social relationship network, the weight coefficient of the new community after the merger of the above two communities, the total number of edges in the social relationship network, the sum of the degrees of the nodes in each of the above two communities, the number of edges in each of the above two communities, and the number of edges between the above two communities.
[0096] Here, when using the Louvain method to divide the social relationship network into communities, it is necessary to merge two communities in the social relationship network to obtain a merged new community; the edge represents an edge that directly connects any two of the above communities. If any two communities in the social relationship network are directly connected, it is considered that there is an edge between the above two communities. At this time, the number of edges between the above two communities can be determined; if any two communities in the social relationship network are not directly connected, it can be considered that the number of edges between the above two communities is 0.
[0097] In some embodiments, when Louvain method is used to divide the community of a non-weighted network, if community c is to be divided into i and community c j If a merger is carried out, the community c i and community c j The modularity change function brought about by the merger can be expressed by formula (5).
[0098]
[0099] Where ΔQ represents the modularity change function, e j Represents community c j The number of edges, e ij Represents community c i and community c j The number of edges between i Represents community c i The weight coefficient, W j Represents community c j The weight coefficient, W ij Represents community c i and community c j The weight coefficient of the new community after the merger; d j Represents community c j The sum of the degrees of all nodes in it.
[0100] It can be seen that for non-weighted networks, the Louvain method can be used to divide the social relationship network into communities based on the constructed modularity change function, which is conducive to quickly obtaining the community division results of the social relationship network.
[0101] In some embodiments, when the social relationship network is a weighted network, the calculation method of the modularity of the social relationship network is determined based on the above-mentioned prior distribution, the sum of the node strengths of the social relationship network, the sum of the node strengths of each community in the social relationship network, and the sum of the weights of the edges within each community in the social relationship network.
[0102] For example, when the social network is a weighted network, the adjacency matrix A of the weighted network can be calculated first. The adjacency matrix is a matrix representing the adjacent relationship between nodes in the network. When i and j are both integers greater than 0, the element in the i-th row and j-th column of the matrix A can be recorded as a ij , a ij represents the adjacent relationship between node i and node j in the social relationship network. The strength of node i can be defined as s i =∑ j a ij ; Exemplarily, the calculation formula for the modularity of the social relationship network can be formula (6).
[0103]
[0104] Among them, Q w represents the modularity of the social network when it is a weighted network, 2w represents the sum of the strengths of all nodes in the social network, W(|c i |) represents the community c in the social relationship network i The weight coefficient, w i Represents the community c in the social network i The sum of the strengths of all nodes, l i Represents the community c in the social network i The sum of the edge weights within .
[0105] It can be seen that for weighted networks, the calculation method of the modularity of social relationship networks can be easily modified by combining the prior distribution of community size and the graph structure of the network.
[0106] In some embodiments, when the social relationship network is a weighted network, the modularity change function can be determined based on the weight coefficients of any two communities in the social relationship network, the weight coefficient of the new community after the merger of the above two communities, the sum of the node strengths of the social relationship network, the sum of the node strengths of each community in the above two communities, the sum of the weights of the edges of each community in the above two communities, and the sum of the weights of the edges between the above two communities.
[0107] In some embodiments, when Louvain method is used to divide the weighted network into communities, if community c is to be divided into i and community c j If a merger is carried out, the community c i and community c j The modularity change function brought about by the merger can be expressed by formula (7).
[0108]
[0109] Among them, ΔQ w represents the modularity change function, W i Represents community c i The weight coefficient, W j Represents community c j The weight coefficient, W ij Represents community c i and community c j The weight coefficient of the new community after the merger; l i Represents the community c in the social network i The sum of the edge weights within, l j Represents the community c in the social network j The sum of the edge weights within, l ij represents the weight sum of the edges between any two communities mentioned above in the social relationship network; w i Represents the community c in the social network i The sum of the strengths of all nodes, w j Represents the community c in the social network j The sum of the strengths of all nodes.
[0110] It can be seen that for weighted networks, the Louvain method can be used to divide the social relationship network into communities based on the constructed modularity change function, which is conducive to quickly obtaining the community division results of the social relationship network.
[0111] In some embodiments, for an unweighted network or a weighted network, the above modularity change function is the key to using the Louvain method to divide the network into communities.
[0112] Reference Figure 3 , the process of using Louvain method to divide the social relationship network into communities can include:
[0113] Step 301: Consider each node in the social relationship network as an independent community.
[0114] It can be seen that at the initial moment, the number of nodes in the social relationship network is equal to the number of communities divided at the initial moment.
[0115] Step 302: Determine the community to be merged with each community, and merge the communities.
[0116] In some embodiments, for each community, attempts are made to merge with each adjacent community (adjacent community means the community where the neighboring nodes of the corresponding community are located) in turn. After each attempt to merge the communities, the value of the corresponding modularity change function is determined according to the above-mentioned modularity change function; for each community, the adjacent community that makes the value of the modularity change function the largest is recorded.
[0117] In the embodiment of the present invention, for community c i , the maximum value of the modularity change function can be recorded as maxΔQ. When maxΔQ is greater than 0, community c i Merge with the neighboring community that maximizes the value of the modularity change function; when maxΔQ is less than or equal to 0, for community c i No community mergers will be conducted.
[0118] According to the above records, in order to calculate the value of the modularity function, it is necessary to obtain the prior distribution of the community size in the social relationship network in advance.
[0119] Step 303: Determine whether the community to which each node belongs has changed. If yes, return to step 302; if no, execute step 304.
[0120] Step 304: compress the nodes of the social relationship network.
[0121] In some embodiments, nodes in the same community can be compressed into a new node. At this time, the weight sum of the edges between the nodes in the same community can be converted into the weight coefficient of the new node, and the weight of the edges between adjacent communities can be converted into the weight of the edges between the corresponding new nodes.
[0122] Step 305 : Determine whether the modularity of the social relationship network has changed. If yes, return to step 301 ; if no, execute step 306 .
[0123] In some embodiments, after each execution of step 304, the modularity of the social relationship network can be calculated once. When the modularity of the social relationship network calculated this time is different from the modularity of the social relationship network calculated last time, it is considered that the modularity of the social relationship network has changed; when the modularity of the social relationship network calculated this time is the same as the modularity of the social relationship network calculated last time, it is considered that the modularity of the social relationship network has not changed.
[0124] Step 306: Divide the communities according to the current community merging result.
[0125] Based on the group detection method proposed in the above-mentioned embodiment, the embodiment of the present invention further proposes a group detection device.
[0126] Figure 4 FIG. 1 is a schematic diagram of the structure of a group detection device according to an embodiment of the present invention. Figure 4 As shown, the device may include:
[0127] An acquisition module 401 is used to acquire a priori distribution of community sizes in a social relationship network;
[0128] A first processing module 402, configured to determine a calculation method of the modularity of the social relationship network according to the prior distribution;
[0129] The second processing module 403 is used to divide the social relationship network into communities with the goal of maximizing the modularity of the social relationship network to obtain community division results.
[0130] In some embodiments, when the social relationship network is a non-weighted network, the first processing module 402 is used to determine the calculation method of the modularity of the social relationship network according to the prior distribution, including:
[0131] A calculation method for the modularity of the social relationship network is determined according to the prior distribution, the total number of edges of the social relationship network, the number of edges of each community in the social relationship network, and the sum of the node degrees of each community in the social relationship network.
[0132] In some embodiments, when the social relationship network is a weighted network, the first processing module 402 is used to determine the calculation method of the modularity of the social relationship network according to the prior distribution, including:
[0133] A calculation method for the modularity of the social relationship network is determined according to the prior distribution, the sum of the node strengths of the social relationship network, the sum of the node strengths of each community in the social relationship network, and the sum of the weights of the edges in each community in the social relationship network.
[0134] In some embodiments, the second processing module 403 is used to divide the social relationship network into communities with the goal of maximizing the modularity of the social relationship network to obtain community division results, including:
[0135] Determine a modularity change function according to weight coefficients of any two communities in the social relationship network and a weight coefficient of a new community after the two communities are merged; wherein the weight coefficient of a community in the social relationship network is related to the number of nodes in the community;
[0136] According to the calculation method of the modularity and the modularity change function, the social relationship network is divided into communities using the Louvain method to obtain the community division result.
[0137] In some embodiments, the second processing module 403 is used to determine the modularity change function according to the weight coefficients of any two communities in the social relationship network and the weight coefficient of a new community after the arbitrary two communities are merged, including:
[0138] When the social relationship network is a non-weighted network, the modularity change function is determined according to the weight coefficients of any two communities in the social relationship network, the weight coefficient of the new community after the merger of the any two communities, the total number of edges in the social relationship network, the sum of the node degrees of each community in the any two communities, the number of edges of each community in the any two communities, and the number of edges between the any two communities.
[0139] In some embodiments, the second processing module 403 is used to determine the modularity change function according to the weight coefficients of any two communities in the social relationship network and the weight coefficient of a new community after the arbitrary two communities are merged, including:
[0140] When the social relationship network is a weighted network, the modularity change function is determined according to the weight coefficients of any two communities in the social relationship network, the weight coefficient of the new community after the merger of the any two communities, the sum of the node strengths of the social relationship network, the sum of the node strengths of each community in the any two communities, the sum of the weights of the edges of each community in the any two communities, and the sum of the weights of the edges between the any two communities.
[0141] In some embodiments, the acquisition module 401 is used to acquire the prior distribution of community sizes in the social relationship network, including:
[0142] The distribution information of the community sizes in the sample data is collected, and the prior distribution of the community sizes in the social relationship network is constructed according to the distribution information of the community sizes in the sample data.
[0143] The acquisition module 401, the first processing module 402 and the second processing module 403 can all be implemented by a processor located in the electronic device, and the processor is at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor.
[0144] In addition, each functional module in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or software functional modules.
[0145] If the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0146] Specifically, a computer program instruction corresponding to a group detection method in this embodiment can be stored on a storage medium such as a CD, a hard disk, or a USB flash drive. When the computer program instruction corresponding to a group detection method in the storage medium is read or executed by an electronic device, any group detection method in the aforementioned embodiments is implemented.
[0147] Based on the same technical concept as the above embodiments, see Figure 5 , which shows an electronic device 50 provided by an embodiment of the present invention, which may include: a memory 501, a processor 502, and a computer program stored in the memory 501 and executable on the processor 502; wherein,
[0148] Memory 501, used for storing computer programs and data;
[0149] The processor 502 is configured to execute the computer program stored in the memory to implement any one of the group detection methods in the foregoing embodiments.
[0150] In practical applications, the memory 501 may be a volatile memory, such as RAM; or a non-volatile memory, such as ROM, flash memory, hard disk drive (HDD) or solid-state drive (SSD); or a combination of the above types of memory, and provide instructions and data to the processor 502.
[0151] The processor 502 may be at least one of an ASIC, a DSP, a DSPD, a PLD, a FPGA, a CPU, a controller, a microcontroller, and a microprocessor.
[0152] In some embodiments, the functions or modules included in the apparatus provided in the embodiments of the present invention can be used to execute the method described in the above method embodiment. The specific implementation can refer to the description of the above method embodiment. For the sake of brevity, it will not be repeated here.
[0153] The above description of the various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other. For the sake of brevity, this article will not repeat them.
[0154] The methods disclosed in the various method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0155] The features disclosed in the various product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0156] The features disclosed in the various method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0157] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0158] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
Claims
1. A group detection method, characterized in that: The method comprises: Counting the distribution information of community sizes in sample data, and constructing a priori distribution of community sizes in a social network based on the distribution information of community sizes in the sample data; the community is used to reflect the structural characteristics of the social network, reflect user relationships, and display user interest characteristics; the sample data includes call information, location information, and device login information between users; Modifying the calculation method of the modularity of the social relationship network according to the prior distribution, and reflecting the prior distribution of the community size in the social relationship network in the modified calculation method of the modularity; With the goal of maximizing the modularity of the social relationship network, the social relationship network is divided into communities to obtain community division results.
2. The method according to claim 1, characterized in that When the social relationship network is a non-weighted network, the calculation method of correcting the modularity of the social relationship network according to the prior distribution includes: The calculation method of the modularity of the social relationship network is modified according to the prior distribution, the total number of edges of the social relationship network, the number of edges of each community in the social relationship network, and the sum of the node degrees of each community in the social relationship network.
3. The method according to claim 1, characterized in that: When the social relationship network is a weighted network, the calculation method of correcting the modularity of the social relationship network according to the prior distribution includes: The calculation method of the modularity of the social relationship network is modified according to the prior distribution, the sum of the node strengths of the social relationship network, the sum of the node strengths of each community in the social relationship network, and the sum of the weights of the edges in each community in the social relationship network.
4. The method according to any one of claims 1 to 3, characterized in that: The step of dividing the social relationship network into communities with the goal of maximizing the modularity of the social relationship network to obtain community division results includes: Determine a modularity change function according to weight coefficients of any two communities in the social relationship network and a weight coefficient of a new community after the two communities are merged; wherein the weight coefficient of a community in the social relationship network is related to the number of nodes in the community; According to the calculation method of the modularity and the modularity change function, the social relationship network is divided into communities using the Louvain method to obtain the community division result.
5. The method according to claim 4, characterized in that The determining of the modularity change function according to the weight coefficients of any two communities in the social relationship network and the weight coefficient of a new community after the arbitrary two communities are merged comprises: When the social relationship network is a non-weighted network, the modularity change function is determined according to the weight coefficients of any two communities in the social relationship network, the weight coefficient of the new community after the merger of the any two communities, the total number of edges in the social relationship network, the sum of the node degrees of each community in the any two communities, the number of edges of each community in the any two communities, and the number of edges between the any two communities.
6. The method according to claim 4, characterized in that The determining of the modularity change function according to the weight coefficients of any two communities in the social relationship network and the weight coefficient of a new community after the arbitrary two communities are merged comprises: When the social relationship network is a weighted network, the modularity change function is determined according to the weight coefficients of any two communities in the social relationship network, the weight coefficient of the new community after the merger of the any two communities, the sum of the node strengths of the social relationship network, the sum of the node strengths of each community in the any two communities, the sum of the weights of the edges of each community in the any two communities, and the sum of the weights of the edges between the any two communities.
7. A group detection device, characterized in that: The device comprises: An acquisition module is used to collect the distribution information of community sizes in sample data, and construct a priori distribution of community sizes in a social network based on the distribution information of community sizes in the sample data; the community is used to reflect the structural characteristics of the social network, reflect user relationships, and display user interest characteristics; the sample data includes call information, location information, and device login information between users; A first processing module, configured to modify a calculation method of the modularity of the social relationship network according to the prior distribution, and reflect the prior distribution of the community size in the social relationship network in the modified calculation method of the modularity; The second processing module is used to divide the social relationship network into communities with the goal of maximizing the modularity of the social relationship network to obtain a community division result.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the group detection method according to any one of claims 1 to 6 is implemented.
9. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the group detection method according to any one of claims 1 to 6 is implemented.
