A social network link prediction method and device
By combining social network metapaths and graph convolutional networks and using attention mechanisms to fuse multi-view features, the problem of low utilization of heterogeneous associations in social network link prediction is solved, and higher link prediction accuracy is achieved.
Patent Information
- Application Number
- CN202310524605.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-10
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2043-05-10
AI Technical Summary
Existing social network link prediction technologies have low utilization rates of heterogeneous relationships within social networks, resulting in low link prediction accuracy.
The social heterogeneous network is decomposed into multiple account-related subviews by using the social network meta-path. Each account-related subview is represented by a graph convolutional network, and multi-view features are fused through an attention mechanism to generate account feature vectors. A social network link prediction model is then constructed, and the link score is calculated.
It improves the accuracy of social network link prediction, can better utilize heterogeneous information between accounts, enhances link prediction performance, and overcomes the limitations of traditional methods.
Smart Images

Figure CN116805067B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data mining technology, and more specifically, to a method and apparatus for predicting social network links. Background Technology
[0002] A social network is an online platform based on the internet and mobile communications, connecting people and allowing them to build, share, communicate, and expand social relationships within virtual communities. Social network analytics, on the other hand, is a method for studying the structure, relationships, and interaction patterns of social networks. Through social network analysis, hidden information and relationships within social networks can be revealed, helping people better understand how social networks operate and their impact, which is of great significance to individuals, organizations, and society. For example, social network analytics can help businesses and organizations understand consumer behavior and preferences, discover new business opportunities and market trends, and help governments and social groups understand public opinion and social trends, improving the scientific and accurate nature of decision-making. It can also improve the design and operation of social networks, enhancing user experience and engagement.
[0003] Social network link prediction is a crucial aspect of social network analysis and a current research hotspot in sociology, computer science, and other fields. It involves predicting the existence and strength of connections between a node and other nodes, which helps improve the structure and accuracy of social networks and provides strong support for recommender systems and social network management. With the widespread adoption of social networks, the vast amount of information generated by users provides researchers with a wealth of valuable data.
[0004] Traditional link prediction techniques include heuristic analysis and latent feature analysis. Heuristic analysis predicts the probability of connections between nodes by calculating their similarity; this method can be further categorized as either local or global based on the scope of the calculation. Latent feature methods, on the other hand, factorize the network's matrix representation to learn low-dimensional embeddings of nodes. Both heuristic and latent feature methods utilize existing network topology to predict future links, but they do not incorporate node features, resulting in low utilization of heterogeneous relationships in social networks and consequently, low link prediction accuracy. Summary of the Invention
[0005] The purpose of this application is to overcome the shortcomings of existing technologies and provide a method and apparatus for predicting links in a social network. By fusing features from multiple account-related subviews through an attention mechanism, the method can automatically calculate the contribution of various relationships to the link prediction effect, thereby solving the problem of low utilization rate of heterogeneous relationships in social networks in existing technologies, which leads to low link prediction accuracy.
[0006] The objective of this application is achieved through the following technical solution:
[0007] Firstly, this application proposes a social network link prediction method, the method comprising:
[0008] The social heterogeneous network is decomposed into multiple account-related sub-views through social network meta-paths;
[0009] A graph convolutional network is used to represent the accounts associated with each of the account subviews;
[0010] The attention mechanism is used to perform multi-view feature fusion on the represented account to generate an account feature vector.
[0011] A social network link prediction model is constructed using the account feature vectors, and the link score is calculated to achieve link prediction.
[0012] In one possible implementation, the social network meta-path is used to characterize the association relationships of accounts under multiple factors. The step of decomposing the heterogeneous social network into multiple account-related sub-views through the social network meta-path includes:
[0013] Query two different accounts using social network metapaths;
[0014] If two accounts are connected under the aforementioned social network meta path, it indicates a connection edge;
[0015] If the two accounts are not connected under the aforementioned social network meta path, it indicates that they are not connected.
[0016] Perform pairwise queries on all accounts in the heterogeneous social network until the heterogeneous social network is decomposed into multiple account-related subviews.
[0017] In one possible implementation, the convolutional layers of the graph convolutional network are:
[0018]
[0019] Where σ represents the ReLU activation function. This represents the number of neighbors of nodes i and j. W represents the feature of node j in the l-th layer of the k-th account-related subview. (k,l) This is the learnable parameter matrix of the l-th layer in the subview associated with the k-th account.
[0020] In one possible implementation, the generation steps of the attention mechanism are as follows:
[0021] Define node i in the account-related subview G k Attention weights in:
[0022]
[0023] Among them, z k It is the account-associated subview G k The attention vector, z kT It is z k The transpose of z kρT It is another account-related subview G k′ The transpose of the attention vector. It is the splicing of the embedding of node i relative to all its subviews.
[0024] In one possible implementation, the account feature vector is:
[0025] h i =∑ k∈K α i,k ·f i k ;
[0026] Where α i,k The attention weight, f i k Node i is based on the account-associated subview G k Embedded.
[0027] In one possible implementation, the link score is obtained using a two-layer perceptron MLP, expressed as: Among them, h u and h v Let u and v be the final feature representations of accounts u and v, and || denotes the vector concatenation operation;
[0028] The first layer of the neural network has a 2d-dimensional input and a d-dimensional output, while the second layer has a d-dimensional input and a 1-dimensional link score output.
[0029] In one possible implementation, the method further includes: using binary cross-entropy as a loss function.
[0030]
[0031] In the formula, y u~v The actual value of the link. The predicted score for the link.
[0032] Secondly, this application also proposes a social network link prediction device, the device comprising:
[0033] The decomposition module is used to decompose a heterogeneous social network into multiple account-related subviews through social network meta-paths.
[0034] The representation module is used to represent the account of each account-associated subview using a graph convolutional network;
[0035] The fusion module is used to fuse features from multiple views through an attention mechanism to generate account feature vectors.
[0036] The generation module is used to construct a social network link prediction model using the account feature vectors and calculate the link score to achieve link prediction.
[0037] Thirdly, this application also proposes a computer device comprising a processor and a memory, wherein the memory stores a computer program that is loaded and executed by the processor to implement the social network link prediction method as described in any of the first aspects.
[0038] Fourthly, this application also proposes a computer-readable storage medium storing a computer program that is loaded and executed by a processor to implement the social network link prediction method as described in any of the first aspects.
[0039] The main solution and its various further alternatives described above can be freely combined to form multiple solutions, all of which are solutions that can be adopted and are claimed in this application; furthermore, the (non-conflicting alternatives) can also be freely combined with each other and with other alternatives. Those skilled in the art, after understanding the solution of this application, will realize from the prior art and common general knowledge that there are many combinations, all of which are technical solutions to be protected by this application, and will not be exhaustively listed here.
[0040] This application discloses a method and apparatus for predicting social network links. The method includes: decomposing a heterogeneous social network into multiple account-related sub-views using social network meta-paths; representing the accounts in each of the account-related sub-views using a graph convolutional network; fusing features from multiple views using an attention mechanism to generate account feature vectors; constructing a social network link prediction model using the account feature vectors; and calculating link scores to achieve link prediction. By utilizing social network meta-paths to extract multi-dimensional relationships between accounts, more heterogeneous information between accounts is considered. Simultaneously, the attention mechanism, by fusing features from multiple account-related sub-views, can automatically calculate the contribution of various relationships to the link prediction effect, solving the problem of low utilization rate of heterogeneous social network relationships in existing technologies, which leads to low link prediction accuracy. Attached Figure Description
[0041] Figure 1 A flowchart illustrating the social network link prediction method proposed in this application is shown. Detailed Implementation
[0042] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, unless otherwise specified, the following embodiments and features in the embodiments can be combined with each other.
[0043] Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0044] In existing technologies, traditional link prediction techniques rely on heuristic analysis and latent feature analysis to predict future links, but do not incorporate node features. This results in low utilization of heterogeneous relationships in social networks, leading to low link prediction accuracy.
[0045] To address the aforementioned issues, this application proposes a social network link prediction method, which mainly involves two related technologies: graph embedding technology based on graph convolutional networks and attention mechanism.
[0046] Graph convolutional network models boast a simple and easy-to-understand architecture and excellent performance, capable of meeting a variety of complex application requirements. One core module is the aggregation of neighbor information, specifically first-order (direct) neighbor information. In practice, aggregating neighbor information once is often insufficient; information from second-order neighbors (neighbors of neighbors) may be needed. Therefore, the concept of "layers" arises. The first layer aggregates first-order neighbor information onto the nodes, and the same operation is performed in the second layer to aggregate second-order neighbor information. Just like in convolutional neural networks, the higher the number of layers, the better the aggregation of information from distant pixels. The aggregation method is as follows: assuming H... l Representing the state of the l-th layer node, find a function H. l+1 =f(A,H) l One aggregation method is to directly sum the neighbor information. The aggregation function for this method can be represented as H. l+1 =δ(AH l W l In the formula, δ is the activation function, such as ReLU, AH l It involves summing the neighbor information of all nodes in parallel, W l It is a d×d dimensional vector, representing the mapping of d-dimensional node information of the l-th layer to d-dimensional information of the (l+1)-th layer.
[0047] Secondly, attention mechanisms are complex cognitive functions that help quickly filter out valuable information while effectively avoiding interference from useless information. Attention mechanisms are a continuous evolutionary process that effectively improves the efficiency and accuracy of visual information processing, enabling people to better adapt to environmental changes. In deep learning, the attention mechanism is a unique structure that automatically identifies and calculates the impact of input data on output results, allowing the model to focus more on the core parts of the current task, thereby improving efficiency and performance.
[0048] Attention mechanisms can be applied to various fields, such as natural language processing, speech recognition, and image processing. Based on different dimensions, they are divided into soft attention and hard attention. Soft attention obtains a mixed output vector by weighting the input vector with a probability distribution, and can be trained by backpropagating gradients. Through reinforcement learning, hard attention can select an input vector from random variables without relying on gradient propagation. Furthermore, attention mechanisms can be categorized into self-attention and cross-attention based on their source. Self-attention uses only the input data itself to calculate similarity or relevance, capturing the internal structure and dependencies of data or features. Cross-attention utilizes input data and other information sources to calculate similarity or relevance, enabling alignment and fusion between different information sources.
[0049] Please refer to Figure 1 , Figure 1 This paper illustrates a flowchart of a social network link prediction method proposed in an embodiment of this application. The method is based on an attention mechanism and includes the following steps:
[0050] S100: Decompose the heterogeneous social network into multiple account-related sub-views through social network meta-paths.
[0051] Metapaths are a sequence of relational paths in a heterogeneous network. They define different types of nodes and relationships in a network path and describe long-distance connections between two entities in a heterogeneous network. Social network metapaths are used to characterize the association relationships of accounts under multiple factors.
[0052] The specific steps are as follows: Query two different accounts using the social network meta-path. If the two accounts are connected under the social network meta-path, it indicates an edge. If the two accounts are not connected under the social network meta-path, it indicates no edge. Perform pairwise queries on all accounts in the social heterogeneous network until the social heterogeneous network is decomposed into multiple account-related subviews, where the selection of the two accounts is random.
[0053] S200. Use graph convolutional networks to represent the accounts associated with subviews of each account.
[0054] Graph convolutional networks (GCNNs) employ Laplacian smoothing, calculating new features for nodes based on themselves and their neighbors. By applying Laplacian smoothing multiple times in deep neural networks, the feature vector of each node converges to values similar to those of its neighbors. It's worth noting that GCNNs typically have two layers.
[0055] First, set This indicates the embedding of node i in the k-th account-related subview. Where d is the dimension of node embedding, and the goal is to learn the associated subview G of a single account. k Node embedding on.
[0056] The convolutional layers of a graph convolutional network are:
[0057]
[0058] Where σ represents the ReLU activation function. This represents the number of neighbors of nodes i and j. W represents the feature of node j in the l-th layer of the k-th account-related subview. (k,l) This is the learnable parameter matrix of the l-th layer in the subview associated with the k-th account.
[0059] Representing the accounts associated with each account in a subview enables the embedded representation of accounts in a single account-associated subview.
[0060] S300: Utilize an attention mechanism to perform multi-view feature fusion on the represented account to generate an account feature vector;
[0061] To generate the final account feature vector, multi-view feature fusion must be performed on the account of each represented account-related subview using an attention mechanism. The attention mechanism in this application differs from existing technologies and can robustly learn account embeddings by automatically learning the attention weights of different account-related subviews.
[0062] The steps involved in generating the attention mechanism are as follows:
[0063] Define node i in the account-related subview G k Attention weights in:
[0064]
[0065] Among them, z k It is the account-associated subview G k The attention vector, z kT It is z k The transpose of z kρT It is another account-related subview G k′ The transpose of the attention vector. It is the concatenation of the embeddings of node i relative to all its subviews. If node i is in the account-associated subview G... k Attention weight α i,k The higher the value, the higher the subview G. k The greater the amount of information provided to the link prediction task, the higher the contribution value.
[0066] After defining the attention weights, the account feature vector is calculated, and the account feature vector is:
[0067] h i =∑ k∈K α i,k ·f i k ;
[0068] Where α i,k It is the attention weight, f i k Node i is based on the account-associated subview G k Embedded.
[0069] S400: Construct a social network link prediction model using account feature vectors and calculate the link score to achieve link prediction.
[0070] The social network link prediction model is based on the typical machine learning binary classification problem of social network link prediction. It is used to test whether there is a relationship between accounts. In order to calculate the link score between two account nodes, for each node pair, the features of the two nodes are concatenated, and a two-layer perceptron MLP is used to obtain the link score, which is represented as: Among them, h u and h v Let u and v be the final feature representations of accounts u and v, and || denotes the vector concatenation operation;
[0071] If a two-layer perceptron MLP is used, the account feature vector is a d-dimensional vector. The input of the first layer of the neural network is a 2d-dimensional vector and the output is a d-dimensional vector. The input of the second layer of the neural network is a d-dimensional vector and the output is a 1-dimensional vector (link score).
[0072] Furthermore, to provide a basis for model training iterations and to update the various parameters in the model, this embodiment uses binary cross-entropy as the loss function: Among them, y u~v The actual value of the link. The predicted score for the link.
[0073] Finally, edges in the social network are used as positive samples, and non-existent edges are used as negative samples. The data is divided into training and test sets. The model is trained using the training set, and the values of each parameter of the model are adjusted according to the defined loss function until training is complete. The link prediction effect of the model is tested and verified using the test set.
[0074] Compared with the prior art, the embodiments of this application have the following beneficial effects:
[0075] First, addressing the issue that traditional social network analysis uses a single type of graph structure data representation, which is insufficient to fully represent the complex and multidimensional information in social networks, this paper utilizes social network meta-paths to extract multidimensional relationships between accounts, while also considering more heterogeneous information between accounts.
[0076] Secondly, by using the attention mechanism to integrate the features of social accounts under multiple related subviews, the contribution of various relationships to the link prediction effect is automatically calculated, which can achieve better social network link prediction effect, overcome the expression limitations of traditional heuristic algorithms, and the results are interpretable.
[0077] Furthermore, this application also proposes a social network link prediction device, which includes:
[0078] The decomposition module is used to decompose a heterogeneous social network into multiple account-related subviews through social network meta-paths.
[0079] The representation module is used to represent the accounts associated with each account's subviews using graph convolutional networks;
[0080] The fusion module is used to perform multi-view feature fusion on the represented account using an attention mechanism to generate an account feature vector.
[0081] The generation module is used to build a social network link prediction model using account feature vectors and calculate the link score to achieve link prediction.
[0082] This preferred embodiment provides a computer device that can implement the steps of any embodiment of the social network link prediction method provided in this application. Therefore, it can achieve the beneficial effects of the social network link prediction method provided in this application. For details, please refer to the previous embodiments, which will not be repeated here.
[0083] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor. Therefore, embodiments of this application provide a storage medium storing multiple instructions that can be loaded by a processor to execute the steps of any embodiment of the social network link prediction method provided in this application.
[0084] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0085] Since the instructions stored in the storage medium can execute the steps in any of the social network link prediction method embodiments provided in this application, the beneficial effects that any of the social network link prediction methods provided in this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0086] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for predicting links in a social network, characterized in that, The method includes: The social heterogeneous network is decomposed into multiple account-related sub-views using social network meta-paths. These social network meta-paths characterize the relationships between accounts across multiple factors. The step of decomposing the social heterogeneous network into multiple account-related sub-views using social network meta-paths includes: Query two different accounts using social network metapaths; If two accounts are connected under the aforementioned social network meta path, it indicates a connection edge; If the two accounts are not connected under the aforementioned social network meta path, it indicates that they are not connected. Perform pairwise queries on all accounts in the social heterogeneous network until the social heterogeneous network is decomposed into multiple account-related subviews; A graph convolutional network is used to represent the accounts associated with each of the account subviews. The convolutional layers of the graph convolutional network are as follows: ; in Represents the ReLU activation function. Represents a node The number of neighbors, Represents a node In the In the account-related subview, the first Features of the layer For the first In the account-related subview, the first The learnable parameter matrix of the layer; The attention mechanism is used to perform multi-view feature fusion on the represented account to generate an account feature vector. A social network link prediction model is constructed using the account feature vectors, and the link score is calculated to achieve link prediction.
2. The social network link prediction method as described in claim 1, characterized in that, The steps for generating the attention mechanism are as follows: Define nodes In the account association subview Attention weights in: ; in, It is an account-related subview Attention vector, yes transpose, It is another account-related subview The transpose of the attention vector. It is a node This is a splicing of embedded subviews associated with all accounts.
3. The social network link prediction method as described in claim 2, characterized in that, The account feature vector is: ; in It is the attention weight, It is a node Based on account-related subviews Embedded.
4. The social network link prediction method as described in claim 1, characterized in that, The link score is obtained using a two-layer perceptron MLP and is represented as follows: ,in, and For account and account The final characteristic representation, This indicates a vector concatenation operation; Set the input of the first layer of the neural network as Dimension, output is The input to the second layer of the neural network is dimensional. The output is a 1-dimensional link score.
5. The social network link prediction method as described in claim 1, characterized in that, The method further includes using binary cross-entropy as the loss function. In the formula, The actual value of the link. The predicted score for the link.
6. A social network link prediction device, characterized in that, The device includes: The decomposition module is used to query two different accounts using social network meta-paths; If two accounts are connected under the aforementioned social network meta path, it indicates a connection edge; If the two accounts are not connected under the aforementioned social network meta path, it indicates that they are not connected. Perform pairwise queries on all accounts in the social heterogeneous network until the social heterogeneous network is decomposed into multiple account-related subviews; The representation module is used to represent the accounts associated with each of the account subviews using a graph convolutional network. The convolutional layers of the graph convolutional network are as follows: ; in Represents the ReLU activation function. Represents a node The number of neighbors, Represents a node In the In the account-related subview, the first Features of the layer For the first In the account-related subview, the first The learnable parameter matrix of the layer; The fusion module is used to perform multi-view feature fusion on the represented account using an attention mechanism to generate an account feature vector. The generation module is used to construct a social network link prediction model using the account feature vectors and calculate the link score to achieve link prediction.
7. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program that is loaded and executed by the processor to implement the social network link prediction method as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which is loaded and executed by a processor to implement the social network link prediction method as described in any one of claims 1-5.
Citation Information
Patent Citations
Social network link prediction method based on perceptual neural network
CN112508085A
Social network influence prediction method and device based on heterogeneous network
CN114090902A