Method for predicting relationship between users in social network and multi-head hybrid aggregation graph convolution network
By using a multi-head hybrid aggregate graph convolutional network, edge features are controlled to participate in node feature updates. Parallel convolution and residual connections are used to solve the problems of high computational complexity and model overfitting in social relationship prediction, thus achieving efficient prediction of user relationships.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HENAN UNIVERSITY
- Filing Date
- 2022-10-19
- Publication Date
- 2026-04-24
AI Technical Summary
Existing social relationship prediction methods suffer from high computational costs, model overfitting, and low learning efficiency in large social networks. In particular, the involvement of redundant social information during node feature updates leads to increased computational complexity and model overfitting.
A multi-head hybrid aggregation graph convolutional network is adopted. By using directed graph convolution operations and residual connections, the number of times edge features participate in node feature updates is controlled. Parallel convolutional structures are used to enrich node features and improve the learning efficiency of social relationship propagation and aggregation rules.
It achieves end-to-end prediction of user relationships, improves prediction accuracy, reduces the time and space complexity of model training, and enhances the expressive power and learning efficiency of node features.
Smart Images

Figure CN115660882B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of graph neural network technology, and in particular to a method for predicting relationships between users in a social network and a multi-head hybrid aggregated graph convolutional network. Background Technology
[0002] With the development of internet and communication technologies, social networks have become an important space for modern people to conduct business transactions, transmit information, and interact socially. Relationships between social users, such as trust and interaction, hold immense social and commercial value. Therefore, predicting social relationships between users has become a hot research topic in the field of social networks.
[0003] The problem of predicting social relationships can be solved using edge prediction methods in graph representation learning. Social relationship prediction methods within the scope of graph representation learning are all based on the following two fundamental consensuses: (1) social networks can be represented as graph data; (2) social relationships have two natural attributes: propagation and aggregation. Early social relationship prediction methods were based on matrix factorization or self-designed matrix computation methods, such as Matri, OpinionWalk, and NeuralWalk. These methods require manual formulation of rules for the propagation and aggregation of social relationships, and matrix computation depends on complete social network graph data. The time and space complexity required for prediction is high, making them unsuitable for large-scale social network scenarios. In recent years, social relationship prediction methods based on graph convolutional neural networks have received widespread attention, such as Guardian. These methods mainly utilize node features to represent information in the subgraph of the neighboring social network, and then learn the rules for the propagation and aggregation of social relationships by continuously updating node features. Finally, they use the updated node features to predict the social relationships between node pairs. These methods can be directly built on social network graph data, and can achieve end-to-end social relationship prediction by relying only on the user's local social subgraph. They have advantages such as high prediction accuracy and low time and space complexity.
[0004] The performance of social relationship prediction methods based on graph convolutional neural networks mainly depends on two aspects: the efficiency of node feature updates and the expressive power of node features. For node feature updates, the injection of sufficient social network information is beneficial to improving the expressive power of the updated node features. When a social network is represented as graph data, its information is mainly embedded in node features or edge features. Therefore, existing prediction methods input both node features and edge features each time node features are updated. However, this approach results in redundant social information participating in node feature updates multiple times, increasing the computational cost of the update operation and reducing the learning efficiency of prediction methods for social relationship propagation and aggregation rules. Furthermore, existing prediction methods mainly use stacked convolutions to abstract the representation of nodes on their neighborhood social subgraph information. However, as the number of stacked convolutional layers increases, the updated node features gradually lose diversity, leading to overfitting of the model and hindering the full learning of social relationship propagation and aggregation rules. Summary of the Invention
[0005] The purpose of this invention is to provide a method for predicting user relationships in social networks and a multi-head hybrid aggregation graph convolutional network to achieve end-to-end prediction of user relationships, improve prediction accuracy, and reduce the time and space complexity of model training.
[0006] On one hand, the present invention provides a method for predicting relationships between users in a social network, the method comprising:
[0007] Step 1: Store the social network as directed graph data;
[0008] Step 2: Preprocess the directed graph data to obtain initial node features and initial edge features;
[0009] Step 3: For any node, perform a directed graph convolution operation on the initial features of neighboring nodes and the initial features of related edges to obtain the node fusion features;
[0010] Step 4: For any node, process the node fusion features using residuals to obtain the node hybrid aggregated features;
[0011] Step 5: For any node, execute the previous step in parallel once, and then concatenate the results to obtain the final features of the node;
[0012] Step 6: For any pair of nodes that do not have an edge, connect the final features of the two nodes to obtain the predicted edge features between the nodes, and then transform the results to obtain the corresponding predicted value of social relationship between users.
[0013] Furthermore, step 1 specifically includes:
[0014] Extract social connections and relationships between users in the social network to construct a directed social graph G = (V, E, W); where v i ∈V represents the i-th user in the social network; e ij = <v i ,v j >,e ij ∈E represents user v i With user v j There is a direct social relationship between them, v i Called e ij The tail node, v j Called e ij The arc head node; w ij ∈Ws.te ij ∈E represents user v i For it and user v j A measure of direct social relationships.
[0015] Furthermore, step 2 specifically includes:
[0016] Step 2.1: For any node v i The local graph structure is mapped to a one-dimensional vector using a graph embedding method to obtain the initial node features x[i], where x[i]∈R. D×1 D is the length of the initial feature vector of the node;
[0017] Step 2.2: For any side weight w ij Feature encoding and dimensionality-up transformation operations are used to convert edge weights into dense weight vectors, which serve as edge e. ij initial features ew ij , among which, ew ij ∈R D×1 D is the length of the initial eigenvector of the edge.
[0018] Furthermore, step 3 specifically includes:
[0019] Step 3.1: For any node v i Based on the initial features of its neighboring nodes and the initial features of related edges, calculate the fused feature R of all its adjacent edge nodes. ij and R ji ;
[0020] Step 3.2: For any node v i Based on the fusion feature R of all its adjacent edge points ij and R ji Perform a directed graph convolution operation to obtain node v. i Fusion features x 1 [i];
[0021] Furthermore, step 3.1 specifically includes:
[0022] For any node v i The fusion feature R of all adjacent edge points that form the tail of the arc is calculated according to formula (1). ij :
[0023]
[0024] Where x[j] represents node v j Initial characteristics of the node, node v j It is node v i The arc-head neighbor node; ew ji Representing edge e ji initial characteristics, Indicates a connection operation;
[0025] For any node v i According to formula (2), the fusion feature R of all adjacent edge points of the arc head is calculated. ji :
[0026]
[0027] Where x[j] represents node v j Initial characteristics of the node, node v j It is node v i The tail neighbor node; ew ji Representing edge e ji initial characteristics, This indicates a join operation.
[0028] Furthermore, step 3.2 specifically includes:
[0029] For any node v i Perform a directed graph convolution operation according to formula (3) to obtain the node fusion feature x. 1 [i]:
[0030]
[0031] Among them, R ij and R ji It is node v i The adjacent edge point fusion feature, N H (i) is node v i The set of N arc-head neighbor nodes T (i) is node v i The set of neighbor nodes at the tail of the arc. It is a trainable transformation matrix, D is the length of the initial feature vector of the node, and D1 is the length of the fused feature vector of the node. σ represents the learnable bias, and σ represents the activation function.
[0032] Furthermore, step 4 specifically includes:
[0033] Step 4.1: For any node v i Based on the fusion features of all its adjacent edges, a directed graph convolution operation is performed to obtain node v. i Fusion update feature x 2 [i];
[0034] Step 4.2: For any node v i , and update its fusion feature x 2 [i] and node fusion features x 1 [i] The node hybrid aggregation feature x is obtained after two residual processing steps. head [i];
[0035] Furthermore, step 4.1 specifically includes:
[0036] For any node v i Perform a directed graph convolution operation according to formula (4) to obtain the node fusion and update feature x. 2 [i];
[0037]
[0038] Where, x 1 [j] is node v j The fusion characteristics, N H (i) is node v i The set of N arc-head neighbor nodes T (i) is node v i The set of neighbor nodes at the tail of the arc. It is a trainable transformation matrix, where D1 is the length of the node fused feature vector and D2 is the length of the node fused update feature vector. σ represents the learnable bias, and σ represents the activation function.
[0039] Furthermore, step 4.2 specifically includes:
[0040] For any node v i Perform the first residual processing according to formula (5) to obtain the first residual connection processing result x. 3 [i]:
[0041] x 3 [i] = normmlization(x 2 [i]+x 1 [i]) (5)
[0042] Where, x 1[i] represents the node fusion feature, x 2 [i] represents the node fusion update feature, and normlization is the normalization function;
[0043] For any node v i Following formula (6), a second residual processing is performed to obtain the node hybrid aggregation feature x. head [i]:
[0044] x head [i]=σ(nomalization(linear(x 3 [i])+x 3 [i])) (6)
[0045] Where, x 3 [i] represents the result of the first residual connection process, where linear is a linear function and normalization is a normalization function.
[0046] Furthermore, step 5 specifically includes:
[0047] Step 5.1: For any node v i Step 4 is executed in parallel for l times to obtain l node hybrid aggregate features, denoted as
[0048] Step 5.2: For any node v i The above l nodes are combined and their aggregated features are concatenated to obtain the final node feature x. f [i].
[0049] Furthermore, step 5.2 specifically includes:
[0050] For any node v i According to formula (7), the mixed aggregate features of l nodes are connected to obtain the final node feature x. f [i]:
[0051]
[0052] in, This represents the hybrid aggregation feature of the l-th node.
[0053] Furthermore, step 6 specifically includes:
[0054] Step 6.1: For any pair of nodes that do not have an edge The final features of two nodes are concatenated to obtain the predicted edge features between the nodes.
[0055] Step 6.2: For any pair of nodes that do not have an edge Predicted edge features between nodes Perform multi-class classification task output processing to obtain corresponding prediction values of social relationships between users.
[0056] Furthermore, step 6.1 specifically includes:
[0057] For any pair of nodes that do not have an edge The final features of the two nodes are connected according to formula (8) to obtain the predicted edge features between the nodes.
[0058]
[0059] Where, x f [i] and x f [j] represents node v i and v j The ultimate characteristic.
[0060] Furthermore, step 6.2 specifically includes:
[0061] For any pair of nodes that do not have an edge According to formula (9), the predicted edge features between nodes are... The data is processed sequentially through a fully connected layer, softmax, and argmax to obtain the corresponding predicted values of social relationships between users.
[0062]
[0063] in, D1 represents the trainable weight matrix in the fully connected layer, D2 represents the length of the final feature vector of the node, and D3 represents the number of categories of social relationship values. The function of argmax(f(x)) is to obtain the independent variable x that makes f(x) take the maximum value.
[0064] On the other hand, the present invention provides a multi-head hybrid aggregation graph convolutional network for predicting relationships between users in a social network, comprising: a preprocessing layer, a fusion convolutional layer, a multi-head hybrid aggregation convolutional layer, and a prediction layer;
[0065] The preprocessing layer is used to preprocess the directed graph data corresponding to the social network to obtain initial node features and initial edge features. The directed graph data of the social network is obtained by storing all users and social information in the social network as graph data. A user in the social network corresponds to a node in the directed graph data, the direct social relationship between users corresponds to an edge in the directed graph data, and the direct social relationship value between users corresponds to the edge weight.
[0066] The fusion convolutional layer is used to obtain the fusion features of all adjacent edge points of any node by using the initial features of its neighboring nodes and the initial features of related edges, and then use the fusion features of adjacent edge points to perform a directed graph convolution operation to obtain the node fusion features.
[0067] The multi-head hybrid aggregation convolutional layer is used to perform l directed graph convolution operations in parallel for any node, and then perform two residual connection, normalization and linear transformation operations to obtain l node hybrid aggregation features. Then, the l node hybrid aggregation features are connected to obtain the final node features.
[0068] The prediction layer is used to connect the final features of two nodes to obtain the predicted edge features between nodes for any pair of nodes that do not have an edge. Then, it is processed by a fully connected layer, softmax and argmax to obtain the corresponding predicted value of social relationship between users.
[0069] The beneficial effects of this invention are:
[0070] First, the number of times edge features participate in node feature updates is controlled to avoid redundant social network information from repeatedly participating in node feature updates, thereby improving the learning efficiency of the prediction method for social relationship propagation and aggregation rules. Specifically, during the first node feature update, both node features and edge features are input simultaneously, allowing the social structure and social value information carried by both to synergistically influence the node feature update. This results in the node fusion feature obtained in this update containing complete social subgraph information. In subsequent node feature update operations, only the node fusion feature, or its transformed node feature, is used as input, effectively improving the update efficiency of node features.
[0071] Second, residual operations and parallel convolutional structures are employed to enrich node features, enabling the prediction method to fully learn the social relationship information contained in the node's neighborhood social subgraph. Specifically, first, two consecutive residual operations are used to obtain node features containing mixed neighborhood social subgraph information, thus enhancing the diversity of node features. Then, a parallel convolutional structure is used to obtain multiple node features expressing neighborhood social subgraph information from different perspectives. The results are then concatenated to form the final node features, further enriching the node's expressive power. Attached Figure Description
[0072] Figure 1 This is a schematic diagram of a directed graph of a social network provided in an embodiment of the present invention;
[0073] Figure 2 This is a flowchart illustrating a method for predicting relationships between users in a social network, as provided in an embodiment of the present invention.
[0074] Figure 3This is a schematic diagram of the architecture of a multi-head hybrid aggregated graph convolutional network (MHAGCN) for predicting relationships between users in a social network, provided as an embodiment of the present invention. Detailed Implementation
[0075] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of the embodiments of this invention will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0076] like Figure 1 As shown, solid line edge e im Represents node v i With node v m There is a direct social relationship, w im Represents node v i Its relation to node v m A measure of direct social relationships. (Dashed edge) Represents node v i With v j There is no direct social relationship. Indicates the node v that needs to be predicted. i For its relation to node v j This invention aims to predict the social relationship metric between node pairs that do not have direct social relationships, based on existing direct social relationships and their corresponding social relationship values in social networks.
[0077] Example 1
[0078] like Figure 2 As shown, this embodiment of the invention provides a method for predicting relationships between users in a social network, the method comprising:
[0079] S101: Store social networks as directed graph data;
[0080] Specifically, since the social relationships between users in the social network to be processed in this embodiment of the invention are asymmetric—for example, regarding trust relationships between users, there exists the factual principle that "the person you trust may not trust you"—the social network is stored as directed graph data G = (V, E, W). Where v i ∈V represents a user in a social network; e ij = <v i ,v j >,e ij ∈E represents user v i With user vj There is a direct social relationship between them, v i Called e ij The tail node, v j Called e ij The arc head node; w ij ∈Ws.te ij ∈E represents user v i For it and user v j A measure of direct social relationships.
[0081] S102: Preprocess the directed graph data to obtain initial node features and initial edge features;
[0082] The preprocessing of directed graph data specifically includes: using classical graph embedding methods to map the local structural information of nodes into a continuous vector space, which serves as the initial features of the nodes. At this point, the initial node features contain local graph structural information centered on the node.
[0083] For example, in this embodiment of the invention, the classic graph embedding method node2vec is used to process directed graph data to obtain a node initial feature matrix x composed of node initial features x[i], where x[i] represents node v i The initial features are located in the i-th row of matrix x, satisfying x[i]∈R D×1 D is the length of the initial feature vector of the node after embedding the local graph information. It's understandable that classic graph embedding methods can also employ DeepWalk, LINE, and other methods.
[0084] Furthermore, by employing classic feature encoding and dimensionality transformation, the edge weights are converted into dense weight vectors, which serve as the initial features of the edges.
[0085] For example, in this embodiment of the invention, the edge weights between node pairs are first represented as one-hot codes according to the type of edge weights. For example, if the edge weights represent four different social relationship categories, then the edge weights are represented by the following one-hot codes: [0,0,0,1] T [0,0,1,0] T [0,1,0,0] T and [1,0,0,0] T Then, a linear transformation is performed on the one-hot encoding to stretch the edge features to obtain a dense weight vector, which serves as the initial feature for the edge, denoted as ew. ij , among which, ew ij ∈R D×1 D is the length of the initial eigenvector of the edge.
[0086] S103: For any node, perform a directed graph convolution operation on the initial features of neighboring nodes and the initial features of related edges to obtain the node fusion features;
[0087] Specifically, after the preprocessing in step S102, the two types of information related to social relationship prediction—social connections between users and their corresponding social relationship values—are embedded into the initial node features and initial edge features, respectively. To enable these two types of information to synergistically influence social relationship prediction, the initial node features and initial edge features need to be fused.
[0088] As one possible implementation, this step includes the following sub-steps:
[0089] S1031: For any node v i Based on the initial features of its neighboring nodes and the initial features of related edges, calculate the fusion features of all its adjacent edge points;
[0090] Specifically, since a social network graph is a directed graph, each node may be both a tail node and a head node. Therefore, in this embodiment of the invention, the fusion features of adjacent edge points of a node as both a tail node and a head node are calculated separately.
[0091] In this embodiment of the invention, for any node v i The fusion feature R of all adjacent edge points that form the tail of the arc is calculated according to formula (1). ij :
[0092]
[0093] Where x[j] represents node v j Initial characteristics of the node, node v j It is node v i The arc-head neighbor node; ew ij Representing edge e ij initial characteristics, This indicates a join operation.
[0094] For any node v i According to formula (2), the fusion feature R of all adjacent edge points of the arc head is calculated. ji :
[0095]
[0096] Where x[j] represents node v j Initial characteristics of the node, node v j It is node v i The tail neighbor node; ew ji Representing edge e ji initial characteristics, Indicates a connection operation;
[0097] S1032: For any node v i Based on the fusion features of all adjacent edge points, a directed graph convolution operation is performed to obtain the node fusion features;
[0098] Specifically, since a social network graph is a directed graph, each node has both head-side and tail-side neighbors. For example... Figure 1 As shown, for node v m Node v i It is its tail neighbor node, node v j It is its arc-head neighbor node. In the case of node v i When performing a directed graph convolution operation, first set the set of its arc-head neighbor nodes N. H (i) Edge fusion feature R ij Perform average aggregation, then apply it to the set of N neighbor nodes at the tail of the arc. T (i) Edge fusion feature R ji Perform an average aggregation operation, then concatenate the results to obtain the node fusion feature x. 1 [i].
[0099] As one possible implementation, node v is updated according to formula (3). i Based on the characteristics, its node fusion feature x is obtained. 1 [i];
[0100]
[0101] Among them, R ij and R ji It is node v i The adjacent edge point fusion feature, N H (i) is node v i The set of N arc-head neighbor nodes T (i) is node v i The set of neighbor nodes at the tail of the arc. It is a trainable transformation matrix, D is the length of the initial feature vector of the node, and D1 is the length of the fused feature vector of the node. Let σ represent the learnable bias and σ represent the activation function. In this embodiment of the invention, σ uses the tanh activation function.
[0102] S104: For any node, the node fusion feature is processed twice using residuals to obtain the node hybrid aggregation feature;
[0103] Specifically, the prediction process continuously learns the propagation and aggregation rules of social relationships by updating node features. Ensuring sufficient and non-redundant social graph data participates in node feature updates is crucial for efficient node feature updates. In step S103, the node fusion feature is obtained by fusing the initial node features and edge features, which has already captured complete local graph information of the first-order neighbors. Furthermore, edge features remain unchanged during propagation; therefore, this step only uses the node fusion feature to further update the node features. This effectively avoids redundant social information participating in the convolution operation again, thereby improving the efficiency of node feature updates.
[0104] As one possible implementation, this step employs directed graph convolution operations to update node features according to formula (3), thereby obtaining the node fusion update feature x. 2 [i]:
[0105]
[0106] Where, x 1 [j] is node v j The fusion characteristics, N H (i) is node v i The set of N arc-head neighbor nodes T (i) is node v i The set of neighbor nodes at the tail of the arc. It is a trainable transformation matrix, where D1 is the length of the node fused feature vector and D2 is the length of the node fused update feature vector. σ represents the learnable bias, and σ represents the activation function. In this embodiment of the invention, σ uses the ReLU activation function.
[0107] To avoid a decrease in model fitting ability, based on the above steps, the node's fused and updated feature x can be further processed. 2 [i] and node fusion features x 1 [i] The node hybrid aggregation feature is obtained by two residual processing.
[0108] As one possible implementation method, this step first updates the node fusion feature x according to formula (5). 2 [i] Perform the first residual processing to obtain the first residual join result x. 3 [i];
[0109] x 3 [i] = normmlization(x 2 [i]+x 1 [i]) (5)
[0110] Preferably, to further deepen the learning, based on the above steps, x can be further processed according to formula (6).3 [i] After linearization, the result is subjected to a second residual processing to obtain the node hybrid aggregation feature x. head [i]:
[0111] x head [i]=σ(nomalization(linear(x 3 [i])+x 3 [i])) (6)
[0112] Where linear represents a linear function, normalization represents a normalization function, and σ represents an activation function. In this embodiment of the invention, σ uses the ReLU activation function.
[0113] S105: For any node, execute step S104 in parallel l times to obtain l node mixed aggregate features, and then connect the l node mixed aggregate features to obtain the final feature vector of the node.
[0114] Specifically, constructing a multi-head model and concatenating the results of l parallel steps S104 helps the model focus on neighborhood social subgraph information from multiple perspectives, enhancing the learning of social relationship aggregation rules.
[0115] As one possible implementation, the mixed aggregate features of l nodes are connected according to formula (7) to form the final feature vector x of the node. f [i]:
[0116]
[0117] in, This represents the hybrid aggregation feature of the l-th node. In this embodiment of the invention, l = 3 is set.
[0118] S106: For any pair of nodes that do not have an edge, connect the final features of the two nodes to obtain the predicted edge features between the nodes, and then transform the result to obtain the corresponding predicted value of social relationship between users.
[0119] As one possible implementation, this step includes the following sub-steps:
[0120] S1061: Connect the final features of two nodes to obtain the predicted edge features between the nodes.
[0121] Specifically, in social network graph data, a specific pair of nodes corresponds to a specific edge. Therefore, the features of the edge can be learned from the features of the nodes at both ends of the edge.
[0122] As one possible implementation, the edge features of two nodes are connected according to formula (8) to obtain the predicted edge features between the nodes:
[0123]
[0124] Where, x f [i] and x f [j] represents node v i and v j The ultimate characteristic.
[0125] S1062: For any pair of nodes that do not have edges, perform classic multi-classification task output processing on the predicted edge features between the nodes to obtain the corresponding predicted value of social relationship between users.
[0126] Specifically, the predicted edge features are fitted to a fully connected layer for dimensionality reduction, and then processed by softmax and argmax functions to predict the social relationship values corresponding to the edge features.
[0127] As one possible implementation method, the predicted value of the social relationship between two nodes is predicted according to formula (9):
[0128]
[0129] Where argmax(f(x)) represents the independent variable x that makes f(x) take the maximum value; D1 represents the trainable weight matrix in the fully connected layer, D2 represents the length of the final feature vector of the node, and D3 represents the number of categories of social relationship values.
[0130] Example 2
[0131] like Figure 3 As shown, this embodiment of the invention provides a multi-head hybrid aggregated graph convolutional network (MHAGCN) for predicting relationships between users in a social network. The MHAGCN includes: a preprocessing layer, a fusion convolutional layer, a multi-head hybrid aggregated convolutional layer, and a prediction layer.
[0132] The preprocessing layer preprocesses the directed graph data corresponding to the social network to obtain initial node features and initial edge features. The directed graph data of the social network is obtained by storing all users and social information in the social network as graph data. Each user in the social network corresponds to a node in the directed graph data, the direct social relationships between users correspond to edges in the directed graph data, and the direct social relationship values between users correspond to edge weights. The fusion convolutional layer, for any node, uses the relevant initial edge features and the initial features of neighboring nodes to obtain the fusion features of all adjacent edge points of the node, and then uses these adjacent edge point fusion features to perform a directed graph convolution operation to obtain the node fusion features. The multi-head hybrid aggregation convolutional layer, for any node, performs l parallel directed graph convolution operations, followed by two residual connections, normalization processing, and linear transformations to obtain l node hybrid aggregation features, and then concatenates these l node hybrid aggregation features to obtain the final node features. The prediction layer is used to connect the final features of two nodes to obtain the predicted edge features between nodes for any pair of nodes that do not have an edge. Then, it is processed by a fully connected layer, softmax and argmax to obtain the corresponding predicted value of social relationship between users.
[0133] Specifically, the social network is stored as directed graph data, transforming social network information into a form suitable for learning and training graph neural networks, serving as input to MHAGCN. The preprocessing layer aims to preprocess the graph data, representing the node and edge features in the social network graph as vectors. The fusion convolutional layer primarily implements the first node feature update, completing the feature fusion of a node with its neighboring nodes and corresponding edges, enabling the graph structure and social relationship values of the social network to synergistically influence the update of node features. The multi-head hybrid aggregation convolutional layer is the core layer of this network model. In this layer, it mainly expands the scope of node propagation of social relationships and aggregation rule learning, while enriching the expression of nodes' information on neighborhood social subgraphs, by executing directed graph convolution operations and continuous residual operations in parallel. The prediction layer uses the features of node pairs to predict the unknown edge features between two points. Specifically, after concatenating the node features at both ends of the unknown edge, it undergoes dimensionality reduction processing through a fully connected module, and the softmax activation function is used to transform the result into the probability value of the predicted edge belonging to each social relationship type. Then, argmax is used to obtain the social relationship type with the highest probability value, which is used as the final edge prediction category, i.e., the social relationship prediction result between the two users.
[0134] It should be noted that the multi-head hybrid aggregation graph convolutional network for predicting user relationships in social networks provided in this embodiment of the invention is for implementing the above method embodiment. Its specific functions can be found in the above method embodiment, and will not be repeated here.
[0135] To verify the effectiveness of the prediction method and multi-connected graph convolutional network provided in the embodiments of the present invention, the present invention also provides the following examples for experimental verification.
[0136] (1) Data preparation
[0137] The dataset used in this embodiment comes from Advogato, an online community platform for free software developers launched in 1999. This dataset contains a list of all user-to-user links, with 5280 nodes and 54382 edges, where nodes represent users and directed edges represent direct trust relationships between users. A user-to-user trust link is called an "authentication" on Advogato, which has four different levels of trust authentication: Observer, Apprentice, Traveler, and Master. Therefore, in this embodiment, the social network refers to the trust network of Advogato, and the social relationship value between users refers to the numerical value transformed from the trust authentication between users. The goal of this embodiment is to predict unknown direct trust relationships between users.
[0138] The Advogato trust network dataset was reorganized into directed graph data, transforming social network information into a form suitable for graph neural network learning and training. This primarily consists of two data files: one storing adjacency graph data, where nodes represent users in the trust network; edges represent the existence of direct trust relationships between users, denoted by 1 if a direct trust relationship exists, and 0 otherwise. The other storing direct trust relationship values between users, containing pairs of nodes and their corresponding trust relationship values, specifically 0, 1, 2, and 3. All node pairs are represented as arcs from the tail node to the head node.
[0139] (2) Dataset preprocessing
[0140] In the preprocessing module: the adjacency graph contains 5280 nodes, which are processed by node2vec to obtain the initialization vector representation (i.e., node initial features) of each node. Specifically, the initialization vectors of all nodes are stored as a 5280×128 node initial feature matrix, where the i-th row represents node v. i The initial feature vector has a length of 128.
[0141] The direct trust relationship values between the 54382 node pairs are represented using one-hot encoding. Specifically, the direct trust relationship values 0, 1, 2, and 3 between users are encoded as [0, 0, 0, 1] respectively. T [0,0,1,0] T [0,1,0,0] T and [1,0,0,0] TThen, a linear transformation is used to obtain the initial features of the edges, with the feature vector length being 128.
[0142] (3) Model Training
[0143] All direct trust relationship values between users were divided into a training set and a test set. Specifically, the training set accounted for 40%, and the remainder was used for the test set. The experimental simulation hardware environment was as follows: Intel Core i7-11700K 3.6GHz CPU, 16GB RAM, 954GB SSD, and GeForce RTX 3070 Ti GPU.
[0144] First, the training set is input into a multi-head hybrid graph convolutional network to train and obtain a prediction model. Then, the node pairs in the test set are input into the trained prediction model to obtain the predicted relationship values between the node pairs. Finally, the prediction results are compared with the corresponding real results in the test set to verify the model's performance.
[0145] In the fusion convolutional layer: First, for any node, the initial features of all its arc-head neighbor nodes are connected to the initial features of the corresponding edges respectively (i.e., processed according to formula (1)); the initial features of all its arc-tail neighbor nodes are connected to the initial features of the corresponding edges respectively (i.e., processed according to formula (2)); the fusion features of the node's adjacent edges are obtained, and the feature vector length is 256.
[0146] Then, the fusion features of all adjacent edge points of the node as the head node and tail node are summed and averaged respectively, and then connected to obtain the feature of the node, with a feature length of 512. The node feature is then linearly calculated and processed with the tanh activation function (i.e., processed according to formula (3)) to obtain the node fusion feature, with the feature length compressed to 128.
[0147] In the multi-head hybrid aggregation convolutional layer: the node fusion features of all the head neighbors of a node are summed and averaged, and the node fusion features of all the tail neighbors of the node are summed and averaged. The above two summed and averaged results are then concatenated to obtain the feature of the node, with a feature length of 256. Then, linear calculation is performed, and the node fusion update feature is obtained by processing with the ReLU activation function (i.e., processing according to formula (4)). The feature length is compressed to 128.
[0148] The node's fusion update feature includes the node fusion features of all its tail neighbors and head neighbors.
[0149] The fusion update feature of each node is added to the fusion feature of the corresponding node output in the fusion convolutional layer, and then regularized (i.e., processed according to formula (5)) to obtain the node features, with the feature vector length remaining unchanged.
[0150] Add the above processing results of each node to the linearized result, and then perform regularization (i.e., process according to formula (6)) to obtain the node hybrid aggregation feature, with the feature vector length remaining unchanged.
[0151] That is, the output of the multi-head hybrid aggregation convolutional layer contains 5280 nodes of node hybrid aggregation features, each feature is 128 in length, forming a 5280×128 node hybrid aggregation feature matrix.
[0152] In the multi-head hybrid aggregation convolutional layer, l=3, that is, all the operations in the multi-head hybrid aggregation convolutional layer are repeated 3 times to obtain 3 node hybrid aggregation feature matrices of 5280×128.
[0153] The three node hybrid feature matrices obtained above are joined (i.e., processed according to formula (7)) to obtain the final node feature matrix 5280×384, where the i-th row represents node v. i The final feature vector has a length of 384.
[0154] In the prediction layer: for node pairs in the training set <v i ,v j > Extract node v from the final feature matrix of the nodes i and node v j The feature vectors are concatenated (i.e., processed according to formula (8)) to obtain the predicted edge features between nodes. The predicted edge features are fitted to a fully connected layer for dimensionality reduction, and then processed by the softmax and argmax functions (i.e., processed according to formula (9)) to obtain the node pairs. <v i ,v j The predicted edge weights between users are the trust relationship values between them.
[0155] The predicted edge weights and the corresponding real edge weights in the training set are used to calculate the loss value using the nll_loss function, and then backpropagated to update the model parameters.
[0156] (4) Repeat the above model training process 200 times.
[0157] (5) Model performance evaluation
[0158] The optimal trained model is selected and input into the test set to obtain prediction results, thus evaluating the performance of the MHAGCN model. For node pairs in the test set... <v i ,v j > Obtain the final feature matrix of the nodes from the trained optimal model, and extract node v i and node v jThe final feature vectors are concatenated to obtain the predicted edge features between node pairs. These predicted edge features are then processed by a fully connected layer in the trained optimal model for dimensionality reduction, followed by softmax and argmax functions to obtain the node pairs. <v i ,v j >Predicted trust relationship value.
[0159] To verify the effectiveness of the MHAGCN model proposed in this invention, the following experimental comparative analysis results are also provided:
[0160] Table 1 compares the performance of the proposed MHAGCN model with existing Guardian and Matri models on the Advogato dataset. For all models, the training set was set to 40%, and the remainder to the test set; all experimental results are based on the average of 20 runs. F1 score and MAE were used as performance metrics for the models. F1 score is the harmonic mean of precision and recall, with a maximum of 1 and a minimum of 0. A higher F1 score indicates a more robust model. MAE is the mean absolute error, representing the average absolute error between predicted and observed values; a lower MAE value indicates higher prediction accuracy.
[0161]
[0162] As shown in Table 1, MHAGCN's F1 score is 0.5% higher than the state-of-the-art Guardian and 11.8% higher than Matri. MHAGCN's MAE is also superior to both Guardian and Matri.
[0163] Experimental results verify that the multi-head hybrid aggregated graph convolutional neural network proposed in this invention can characterize the potential factors of social relationships between users, thereby establishing an effective social relationship value prediction model. In summary, the prediction method and multi-head hybrid aggregated graph convolutional network provided in this invention can effectively predict the social relationship values between users in social networks.
[0164] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for predicting relationships between users in a social network, characterized in that, The method, applied to the prediction of end-to-end user trust relationships and / or interaction relationships, includes: Step 1: Extract social connections and relationships between users in the social network and store the social network as directed graph data; Step 2: Preprocess the directed graph data to obtain initial node features and initial edge features; Step 3: For any node, perform a directed graph convolution operation on the initial features of neighboring nodes and the initial features of related edges to obtain the node fusion features; Step 4: For any node, process the node fusion features using residuals to obtain the node hybrid aggregated features; specifically including: Step 4.1: For any node Based on the fusion features of all its adjacent edges, a directed graph convolution operation is performed to obtain the node. Fusion update features Specifically, this includes: for any node Perform directed graph convolution operation according to formula (4) to obtain node fusion and update features. ; (4) in, It is a node The fusion characteristics It is a node The set of neighboring nodes at the arc head, It is a node The set of neighbor nodes at the tail of the arc. It is a trainable transformation matrix. D1 is the length of the node fusion feature vector, and D2 is the length of the node fusion update feature vector. This represents learnable bias. Indicates the activation function; Step 4.2: For any node Its integration and update features Node fusion features The node hybrid aggregation feature is obtained through two residual processing steps. Specifically, this includes: for any node Perform the first residual processing according to formula (5) to obtain the result of the first residual connection processing. : (5) in, It is a node fusion feature. It is a node fusion and update feature. This is the normalization function; For any node Following formula (6), a second residual processing is performed to obtain the node hybrid aggregation feature. : (6) in, This is the result of the first residual join processing. It is a linear function. This is the normalization function; Step 5: For any node, execute the previous step in parallel once, and then concatenate the results to obtain the final features of the node; Step 6: For any pair of nodes that do not have an edge, connect the final features of the two nodes to obtain the predicted edge features between the nodes, and then transform the results to obtain the corresponding predicted value of social relationship between users.
2. The method for predicting relationships between users in a social network according to claim 1, characterized in that, Step 1 specifically includes: Building a directed social graph ;in, This represents the i-th user in the social network; , Indicates user With users There is a direct social relationship between them. Called The tail node of the arc, Called The arc head node; st Indicates user For it and users A measure of direct social relationships.
3. The method for predicting relationships between users in a social network according to claim 1, characterized in that, Step 2 specifically includes: Step 2.1: For any node The graph embedding method is used to map the local graph structure to a one-dimensional vector to obtain the initial features of the nodes. ,in, D is the length of the initial feature vector of the node; Step 2.2: For the weights on either side Feature encoding and dimensionality-up transformation operations are used to convert edge weights into dense weight vectors, which serve as edge weights. initial features ,in, D is the length of the initial eigenvector of the edge.
4. The method for predicting relationships between users in a social network according to claim 1, characterized in that, Step 3 specifically includes: Step 3.1: For any node Based on the initial features of its neighboring nodes and the initial features of related edges, calculate the fused features of all its adjacent edge nodes. and ; Step 3.2: For any node Based on the fusion features of all its adjacent edge points and Perform a directed graph convolution operation to obtain the nodes. Fusion characteristics .
5. The method for predicting relationships between users in a social network according to claim 4, characterized in that, Step 3.1 specifically includes: For any node The fusion feature of all adjacent edge points that serve as the tail of the arc is calculated according to formula (1). : (1) in, Represents a node Initial characteristics of nodes, nodes It is a node The arc-head neighbor node; Representing an edge initial characteristics, Indicates a connection operation; For any node According to formula (2), the fusion characteristics of all adjacent edge points of the arc head are calculated. : (2) in, Represents a node Initial characteristics of nodes, nodes It is a node The arc tail neighbor nodes; Representing an edge initial characteristics, This indicates a join operation.
6. The method for predicting relationships between users in a social network according to claim 4, characterized in that, Step 3.2 specifically includes: For any node Perform a directed graph convolution operation according to formula (3) to obtain the node fusion features. : (3) in, and It is a node The fusion feature of adjacent edge points, It is a node The set of neighboring nodes at the arc head, It is a node The set of neighbor nodes at the tail of the arc. It is a trainable transformation matrix, and D is the length of the initial feature vector of the node. It is the length of the node fused feature vector. This represents learnable bias. This represents the activation function.
7. The method for predicting relationships between users in a social network according to claim 1, characterized in that, Step 5 specifically includes: Step 5.1: For any node Step 4 is executed in parallel for l times to obtain l node hybrid aggregate features, denoted as ; Step 5.2: For any node The above l nodes are combined and aggregated to obtain the final node features. .
8. The method for predicting relationships between users in a social network according to claim 7, characterized in that, Step 5.2 specifically includes: For any node According to formula (7), the mixed aggregate features of l nodes are connected to obtain the final node features. : (7) in, This represents the hybrid aggregation feature of the l-th node.
9. The method for predicting relationships between users in a social network according to claim 1, characterized in that, Step 6 specifically includes: Step 6.1: For any pair of nodes that do not have an edge The final features of two nodes are concatenated to obtain the predicted edge features between the nodes. ; Step 6.2: For any pair of nodes that do not have an edge , predict edge features between nodes Perform multi-class classification task output processing to obtain corresponding prediction values of social relationships between users. .
10. A method for predicting relationships between users in a social network according to claim 9, characterized in that, Step 6.1 specifically includes: For any pair of nodes that do not have an edge The final features of the two nodes are connected according to formula (8) to obtain the predicted edge features between the nodes. : (8) in, and Representing nodes respectively and The ultimate characteristic.
11. The method for predicting relationships between users in a social network according to claim 9, characterized in that, Step 6.2 specifically includes: For any pair of nodes that do not have an edge According to formula (9), the predicted edge features between nodes are... The data is processed sequentially through a fully connected layer, softmax, and argmax to obtain the corresponding predicted values of social relationships between users. : (9) in, D1 represents the trainable weight matrix in the fully connected layer, D2 represents the length of the final feature vector of the node, and D3 represents the number of categories of social relationship values. , ; Its function is to obtain The independent variable x that takes the maximum value.
12. A multi-head hybrid aggregated graph convolutional network for use in a user relationship prediction method in a social network as described in claim 1, characterized in that, include: Preprocessing layer, fusion convolutional layer, multi-head hybrid convolutional layer, and prediction layer; The preprocessing layer is used to preprocess the directed graph data corresponding to the social network to obtain initial node features and initial edge features. The directed graph data of the social network is obtained by storing all users and social information in the social network as graph data. A user in the social network corresponds to a node in the directed graph data, the direct social relationship between users corresponds to an edge in the directed graph data, and the direct social relationship value between users corresponds to the edge weight. The fusion convolutional layer is used to obtain the fusion features of all adjacent edge points of any node by using the relevant initial edge features and the initial features of neighboring nodes, and then use the fusion features of adjacent edge points to perform a directed graph convolution operation to obtain the node fusion features. The multi-head hybrid aggregation convolutional layer is used to perform l directed graph convolution operations in parallel for any node, and then perform two residual connection, normalization and linear transformation operations to obtain l node hybrid aggregation features. Then, the l node hybrid aggregation features are connected to obtain the final node features. The prediction layer is used to connect the final features of two nodes to obtain the predicted edge features between nodes for any pair of nodes that do not have an edge. Then, it is processed by a fully connected layer, softmax and argmax to obtain the corresponding predicted value of social relationship between users.
Citation Information
Patent Citations
Social network link prediction method and social network link prediction system for adversarial residual graph variational autoencoder
CN113609306A
Multi-information aggregation graph residual generation model, classification method, electronic equipment and storage medium
CN114330672A