Network representation method based on adaptive structure and position encoding
By integrating adaptive structure and position coding in network representation, and using the contrastive learning method of self-supervised learning, the problem of insufficient capture of node position information and dependence on contrastive learning labels in the existing technology is solved, and the quality and self-regulation of network representation are improved. The effect of supervised learning.
Patent Information
- Application Number
- CN202210034393.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-13
- Publication Date
- 2024-09-06
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing network representation methods cannot effectively capture the position information of nodes, resulting in limited expression capabilities for isomorphic nodes and graph symmetric networks. They also lack contrastive learning methods in self-supervised learning, require label information for training, and suffer from over-smoothing. .
Adopt a network representation method based on adaptive structure and position coding, extract position coding through random edge deletion and random walk, and fuse it with structural coding, use contrastive learning methods in the self-supervised field for training, and independently optimize position coding and structure Encoding to prevent over-smoothing.
It realizes the capture and fusion of position information in network representation, reduces the dependence on label information, improves the representation quality and classification and clustering accuracy of the network, and is suitable for self-supervised learning tasks.
Smart Images

Figure CN114386600B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of self-supervised graph network representation, and specifically is a network representation method based on adaptive structure and position coding. Background Art
[0002] In recent years, deep learning has revolutionized many machine learning tasks, from image classification and video processing to speech recognition and natural language understanding. The data used in traditional machine learning is usually Euclidean spatial data with regular spatial structure, while more and more non-Euclidean spatial data with mining significance, such as abstract graphs from electronic transactions and recommendation systems, pose severe challenges to existing machine learning algorithms. Network representation methods can model irregular and disordered non-Euclidean spatial data, converting the vertices, edges or subgraphs of the graph into low-dimensional embeddings, thereby capturing the internal dependencies of the data and retaining the important structural information of the graph. Network representation methods such as graph convolutional network models (GCN) and graph attention mechanism models (GAT) have achieved good results in tasks such as semi-supervised node classification and node clustering.
[0003] In the prior art, existing network representation methods mainly rely on the structural information of the network to obtain a low-dimensional embedding of the network. The representation obtained by the existing network representation model cannot cover the location information of the node, which will limit the expression ability of isomorphic nodes and other graph symmetric networks. One way to solve this problem is to propagate information from one node to multi-hop neighboring nodes by stacking multiple layers of convolutional networks, thereby distinguishing the representation of distant nodes. However, the essence of graph convolutional neural networks is message propagation. Each node collects the feature vectors of neighboring nodes and combines them with its own features to update the representation of the node. Stacking multiple layers of convolutional networks means that each node aggregates the features of multi-hop neighboring nodes, which will make all node features tend to be consistent, resulting in serious over-smoothing. The method of distinguishing the representation of distant nodes by stacking multiple layers of convolutional networks is essentially a structural representation of the network, but lacks the position encoding of the nodes. Summary of the invention
[0004] In view of the deficiencies in the prior art, the technical problem that the present invention intends to solve is to propose a network representation method based on adaptive structure and position coding.
[0005] The technical solution adopted by the present invention to solve the technical problem is:
[0006] A network characterization method based on adaptive structure and position coding, characterized in that the method includes the following contents:
[0007] Step 1: Extract the characteristic information and structural information of the nodes in the original network graph. The characteristic information of all nodes constitutes the characteristic matrix of the original network graph, and the structural information is represented by the adjacency matrix A. Randomly delete the edges in the original network graph at a certain ratio to obtain two different sub-network graphs S1 and S2. The structural information of the two sub-network graphs is represented by sparse matrices A1 and A2. Subtract the sparse matrices A1 and A2 from the adjacency matrix A to obtain the adjacency matrix A of the sub-network graphs S1 and S2. drop1 and A drop2 ;
[0008] Step 2: Initialize the position encoding of the original network graph by random walk;
[0009] Step 3: Let the structure encoders of subnetwork graphs S1 and S2 be g1 and g2 respectively, and compare the feature matrix with the adjacency matrix A drop1 Input into the structure encoder g1, and combine the feature matrix with the adjacency matrix A drop2 Input into the structural encoder g2 to obtain the node-level representations H1 and H2 corresponding to the sub-network graphs S1 and S2;
[0010] Step 4: Pass the position code initialized in step 2 through the position encoder twice to obtain the attention-based position codes P1 and P2;
[0011] Step 5: concatenate the node-level representation H1 obtained in step 3 and the attention-based position code P1 obtained in step 4 according to the dimension of 1, and concatenate the node-level representation H1 and the attention-based position code P2 according to the dimension of 1 to obtain two fused node-level representations H1' and H'2; the two fused node-level representations are then mapped into the network representation of the original network graph through a fully connected layer;
[0012] This completes the network representation based on adaptive structure and position encoding.
[0013] Compared with the prior art, the present invention has the following beneficial effects:
[0014] 1. In view of the problem that many network models in the traditional supervised learning and unsupervised learning fields do not contain location information, the present invention incorporates the idea of random walk into the network representation and extracts the position coding of the network graph; then the position coding and structural coding of the network graph are integrated, so that the final network representation will contain both structural information and location information.
[0015] 2. Compared with supervised learning such as GCN and GAT, the present invention adopts the contrastive learning method in the field of self-supervision, so that label information is no longer required during the model training process, and the original network graph is augmented by random edge deletion and splicing position encoding, thereby providing data from two perspectives that can be used for contrastive learning.
[0016] 3. During the training process, the position encoding and structure encoding are decoupled so that the position encoding has an independent loss function, which solves the problem that the position encoding in the fusion information is inconvenient to modify and optimize.
[0017] 4. The structure encoding part uses information bottleneck to calculate node-level representation loss, which expands the information bottleneck used for supervised learning and proposes information bottleneck under multiple inputs, so as to better adapt to self-supervised learning tasks. The position encoding loss uses Laplace feature loss, so that the position information can be optimized independently.
[0018] 5. Since two sub-network graphs are obtained by randomly deleting edges, over-smoothing can be effectively prevented, thereby improving the quality of network representation. The method of the present invention has a good effect on the node classification and node clustering tasks of the network, can better fit the citation network, and improve the classification accuracy and clustering accuracy of the citation network. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0020] The specific embodiments of the present invention are given below in conjunction with the accompanying drawings. The specific embodiments are only used to further illustrate the present invention in detail and do not limit the protection scope of the patent requirements of this application.
[0021] The present invention is a network representation method based on adaptive structure and position coding (hereinafter referred to as method, see Figure 1 ), the specific steps are as follows:
[0022] Step 1: Extract the feature information and structural information of the nodes in the network graph S. The feature information of all nodes constitutes the feature matrix X of the network graph S, X∈R N×F , R is the matrix space dimension, N is the number of nodes in the network graph S, and F is the number of features of each node; the information of the edges between nodes reflects the structural information of the network graph, which is represented by the adjacency matrix. Taking an undirected graph as an example, if there is an edge connecting node i and node j, then the adjacency matrix A of node i and node j is ij =1; if there is no edge connection, then the adjacency matrix A ij = 0, assuming that the initial weight of each edge is the same; assuming that the structural information of the network graph S is the adjacency matrix A, A∈R N×N; Randomly delete the edges in the network graph S with probability a1 and a2 respectively, and obtain two different sub-network graphs S1 and S2. The structural information of the sub-network graphs S1 and S2 is represented by sparse matrices A1 and A2 of the same size as the adjacency matrix A respectively. The number of edges in the sub-network graphs S1 and S2 is equal to the total number of edges in the network graph S multiplied by (1-a1 / a2); Subtract the sparse matrices A1 and A2 from the adjacency matrix A respectively to obtain the adjacency matrix A of the sub-network graphs S1 and S2 drop1 and A drop2 , the adjacency matrix A drop1 As shown in formula (1), the adjacency matrix A drop2 Similarly;
[0023] A drop1 =A-A1 (1)
[0024] Step 2: Initialize the position code P by random walk, obtain the position code of each node from the network graph S, and the position codes of all nodes constitute the position code P of the network graph S; where the position code of node i is It can be expressed as k-order random walk coding:
[0025]
[0026] R W ii =AD -1 (3)
[0027] Where D is the degree matrix of the adjacency matrix A; RW ii is the random walk operator corresponding to node i. To reduce the complexity of the random walk algorithm, the present invention only considers the probability of node i reaching itself. When k is large enough and each node in the network graph has a unique k-hop neighborhood, node i has a unique position code
[0028] Step 3: Select a layer of GCN as the structural encoder of the sub-network graphs S1 and S2. Let the structural encoders of the sub-network graphs S1 and S2 be g1 and g2 respectively. Then, transform the feature matrix X and the adjacency matrix A drop1 As the input of the structure encoder g1, the feature matrix X and the adjacency matrix A drop2 As the input of the structure encoder g2, the node-level representations H1 and H2 corresponding to the sub-network graphs S1 and S2 are obtained. The expression of the node-level representation H1 is:
[0029]
[0030]
[0031] Among them, H (l) , H (l+1)are the node-level representations of the input and output of the l+1th layer of the structural encoder g1, σ is the linear activation function, represents an adjacency matrix with self-loops, Represents an adjacency matrix with self-loops , θ1 is the parameter of encoder g1, and I represents the identity matrix of the same size as the adjacency matrix A;
[0032] Step 4: Select the graph attention network (GAT) as the position encoder, pass the initialized position code P through the position encoder twice, and obtain the attention-based position codes P1 and P2, which are used to describe the importance of the edges between different nodes;
[0033] For the graph attention network, the present invention adopts a multi-head attention mechanism. After each node calculates the single-head position code, the position codes from each head are connected to obtain the multi-head position code. The multi-head position code of node i for:
[0034]
[0035]
[0036]
[0037] Among them, || represents splicing, represents the coefficient between nodes i and j calculated by the mth graph attention mechanism. In order to facilitate the comparison of coefficients between different nodes, the softmax function is used to normalize the attention weights; M represents the total number of graph attention mechanisms used; W m ∈R F ' ×F represents the weight matrix, F' is the output dimension; is the position code of node j, e ij is the attention weight between nodes i and j, Q i is the neighborhood of node i, and node t is the neighborhood Q i The node inside, e it is the attention weight between nodes i and t, and a represents the attention mechanism;
[0038] In formula (8), m=1 represents single-head attention, m=2,3,…,M represents multi-head attention;
[0039] Step 5. Concatenate the node-level representation H1 obtained in step 3 and the attention-based position encoding P1 obtained in step 4 with a dimension of 1, and concatenate the node-level representation H1 with the attention-based position encoding P2 with a dimension of 1 to obtain two fused node-level representations H1' and H'2, i.e., the network representations of the two sub-network graphs S1 and S2; the two fused node-level representations are then mapped to the network representation of the network graph S through a fully connected layer (MLP), and the dimension of the final network representation is mapped to the same output dimension as the encoder in step 3 to avoid dimensional explosion of the encoder during the iteration process; the fused node-level representation combines the structural encoding and position encoding of the network graph, and the two fused node-level representations are used as two different perspectives to perform self-supervised learning on the encoder and the graph attention network.
[0040] Repeat steps 3 to 5 to iteratively train the structure encoder g1, g2 and position encoder. During the training process, decouple the node-level representation obtained in step 3 from the attention-based position encoding obtained in step 4, calculate the node-level representation loss and the position encoding loss respectively, and finally sum the losses of these two parts to obtain the total loss of the network graph representation, so as to optimize the parameters of the structure encoder g1, g2 and position encoder; when the total loss of the network graph representation is minimized, the optimal structure encoder g1, g2 and position encoder are obtained for subsequent node classification or clustering tasks;
[0041] The information bottleneck in information theory is used as the loss of the node-level representation part, aiming to discard some redundant information in the input network graph; firstly, because the present invention is mainly used in the field of self-supervised learning to solve the problem of expensive label information, it is necessary to extend the information bottleneck theory containing label information to the field of self-supervised learning; using the contrast learning method in self-supervised learning, the sub-network graphs S1 and S2 of two different perspectives are made to be the "labels" of another perspective, so as to achieve the purpose of self-supervision, and the loss is calculated by maximizing mutual information; in addition, in order to achieve the task of self-supervised learning, it is also necessary to obtain the global information of the network graph, that is, the graph-level representation C, so the fused node-level representation is read out through the function Aggregate into graph-level representations. Specifically, C1 and C2 are graph-level representations of subnetwork graphs S1 and S2, respectively.
[0042] The node-level representation loss R corresponding to encoders g1 and g2 IB (θ1), R IB (θ2) is shown in equations (9) and (10):
[0043]
[0044]
[0045] in, Respectively represent the mutual information between the two representations in encoders g1 and g2. Mutual information MI is a measurement method based on Shannon entropy, which is used to measure the degree of dependence between two random variables. β is a hyperparameter.
[0046] The present invention uses the JSD mutual information estimator to estimate the mutual information Since the JSD mutual information estimator is insensitive to the number of negative samples, the obtained mutual information estimation value will not change significantly due to the number of negative samples. The expression of the JSD mutual information estimator is:
[0047]
[0048] Among them, H. are the node-level representations corresponding to positive and negative samples, respectively. Denote the set space of positive and negative samples respectively. Negative samples are matrices obtained by randomly perturbing the feature matrix X. ω is the discriminator, ω is the parameter of the discriminator, and sp represents the softplus activation function;
[0049] Sum and average equations (9) and (10) to get the total node-level representation loss, as shown in equation (12).
[0050]
[0051] The position encoding loss is calculated using the Laplace feature loss as shown in formula (13):
[0052]
[0053] Among them, f is the dimension of the position code P, T represents the matrix transpose, I f represents the identity matrix of the same size as the position code P, RW is the random walk operator corresponding to all nodes in step 2, λ is a hyperparameter greater than zero, trace(·) represents the trace function of the matrix,
[0054] is the Frobenius normal number;
[0055] Finally, the total node-level representation loss and position encoding loss are summed according to formula (14) to obtain the total loss of network graph representation;
[0056] L=L struct +μL position (P) (14)
[0057] Among them, μ is a hyperparameter.
[0058] Simulation test:
[0059] This method is used for node classification and clustering tasks respectively. The parameter settings of the structure encoder include: the batch size is 1, the number of iterations per training cycle is 3000, the training cycle is 20, the learning rate is 0.01, and the weight decay is 5e-4; the parameter settings of the position encoder include: the number of attention heads is 4, the hyperparameter of the dropout function is 0.5, and the hyperparameter of the leaky_relu function is 0.2.
[0060] The parameter settings for different data sets are: for the Cora data set, a1=a2=0.8, the output dimension of the position encoder is 64, and the output dimensions of the structure encoders g1 and g2 are both 512; for the Citeseer data set, a1=a2=0.9, the output dimension of the position encoder is 64, and the output dimensions of the structure encoders g1 and g2 are both 512; for the Pubmed data set, a1=a2=0.8, the output dimension of the position encoder is 32, and the output dimensions of the structure encoders g1 and g2 are both 256.
[0061] Under the same experimental conditions, this method and six common unsupervised network models in the prior art were used to complete the node classification task, and the accuracy statistics shown in Table 1 were obtained;
[0062] Table 1 Accuracy of each model for node classification task
[0063]
[0064] As can be seen from Table 1, the classification accuracy of this method on the Cora and Pubmed datasets is improved by 0.5 percentage points respectively. This is because for isomorphic graphs, position encoding helps to distinguish different types of nodes with the same neighborhood, making the node classification effect better; and for different datasets, both the structure encoder and the position encoder will learn the optimal parameters and adapt to different datasets.
[0065] Under the same experimental conditions, the method of the present invention and seven common unsupervised network models in the prior art were used to complete the node clustering task, and the statistical results shown in Table 2 were obtained;
[0066] Table 2 Statistics of the results of each model for node clustering tasks
[0067]
[0068] The two clustering evaluation indicators are the mean normalized mean (NMI) and the adjusted Rand index (ARI) of clustering accuracy. As can be seen from Table 2, the clustering performance of this method is better than that of other models. This is because position encoding can make the connection between distant nodes of the same type closer, thereby achieving better clustering effect.
[0069] The sources of each model are as follows:
[0070] [1] Velickovic P, Fedus W, Hamilton WL, et al. Deep Graph Infomax[C] / / International Conference on Learning Representations. New Orleans, May 6 - 9, 2019. France: Trans Tech Publications Ltd, 2019: 10341 - 103558.
[0071] [2] Peng Z, Huang W, Luo M, et al. Graph representation learning via graphical mutual information maximization[C] / / Proceedings of The WebConference 2020. 2020: 259 - 270.
[0072] [3] Zhu Y, Xu Y, Yu F, et al. Deep graph contrastive representation learning[J]. arXiv preprint arXiv:2006.04131, 2020.
[0073] [4] Zhu Y, Xu Y, Yu F, et al. Graph contrastive learning with adaptive augmentation[C] / / Proceedings of the Web Conference 2021. 2021: 2069 - 2080.
[0074] [5] Mavromatis C, Karypis G. Graph InfoClust: Maximizing Coarse - Grain Mutual Information in Graphs[C] / / Pacific - Asia Conference on Knowledge Discovery and Data Mining. Springer, Cham, 2021: 541 - 553.
[0075] [6]Hassani K,Khasahmadi A H.Contrastive multi-view representationlearning on graphs[C] / / International Conference on Machine Learning.PMLR,2020:4116-4126.
[0076] [7]Kipf TN,Welling M.Variational graph auto-encoders[J].arXivpreprint arXiv:1611.07308,2016.[8]Wang C,Pan S,Long G,et al.Mgae:Marginalized graph autoencoder for graph clustering[C] / / Proceedings of the 2017ACM onConference on Information and Knowledge Management.2017:889-898.
[0077] [9]Pan S, Hu R, Long G, et al. Adversarially regularized graphautoencoder for graph embedding[J]. arXiv preprint arXiv:1802.04407, 2018.
[0078] Any matters not described in the present invention are applicable to the prior art.
Claims
1. A network representation method based on adaptive structure and position coding, characterized in that: The method includes the following: Step 1: Extract the characteristic information and structural information of the nodes in the original network graph. The characteristic information of all nodes constitutes the characteristic matrix of the original network graph, and the structural information is represented by the adjacency matrix A. Randomly delete the edges in the original network graph at a certain ratio to obtain two different sub-network graphs S1 and S2. The structural information of the two sub-network graphs is represented by sparse matrices A1 and A2. Subtract the sparse matrices A1 and A2 from the adjacency matrix A to obtain the adjacency matrix A of the sub-network graphs S1 and S2. drop1 and A drop2 ; Step 2: Initialize the position encoding of the original network graph by random walk; Step 3: Let the structure encoders of subnetwork graphs S1 and S2 be g1 and g2 respectively, and compare the feature matrix with the adjacency matrix A drop1 Input into the structure encoder g1, and combine the feature matrix with the adjacency matrix A drop2 Input into the structural encoder g2 to obtain the node-level representations H1 and H2 corresponding to the sub-network graphs S1 and S2; Step 4: Pass the position code initialized in step 2 through the position encoder twice to obtain the attention-based position codes P1 and P2; Step 5: concatenate the node-level representation H1 obtained in step 3 and the attention-based position code P1 obtained in step 4 according to the dimension of 1, and concatenate the node-level representation H1 and the attention-based position code P2 according to the dimension of 1 to obtain two fused node-level representations H1' and H'2; the two fused node-level representations are then mapped into the network representation of the original network graph through a fully connected layer; This completes the network representation based on adaptive structure and position encoding.
2. The network characterization method based on adaptive structure and position coding according to claim 1, characterized in that: Repeat steps 3 to 5 to train the structure encoders g1, g2 and the position encoder, and use the trained structure encoders g1, g2 and the position encoder for subsequent node classification or clustering tasks; During the training process, the node-level representation obtained in step 3 is decoupled from the attention-based position encoding obtained in step 4, and the node-level representation loss and position encoding loss are calculated separately. Finally, the losses of these two parts are summed to obtain the total loss of the network graph representation, so as to optimize the parameters of the position encoder and the two structural encoders. The node-level representation loss R corresponding to encoders g1 and g2 IB (θ1), R IB (θ2) are: in, Respectively represent the mutual information between the two representations in encoders g1 and g2, β is a hyperparameter, C1 and C2 are the graph-level representations of sub-network graphs S1 and S2, respectively; The total node-level representation loss is; The position encoding loss is: Among them, f is the dimension of the position code P, T represents the matrix transpose, I f represents the identity matrix of the same size as the position code P, RW is the random walk operator corresponding to all nodes in step 2, λ is a hyperparameter greater than zero, trace(·) represents the trace function of the matrix, is the Frobenius normal number; The total loss of the network graph representation is: L=L struct +μL position (P) (14) Among them, μ is a hyperparameter.
3. The network characterization method based on adaptive structure and position coding according to claim 1, characterized in that: In step 3, the expression of node-level representation H1 is: Among them, H (l) , H (l+1) are the node-level representations of the input and output of the l+1th layer of the structural encoder g1, σ is the linear activation function, represents an adjacency matrix with self-loops, Represents an adjacency matrix with self-loops , θ1 is the parameter of encoder g1, and I represents the identity matrix of the same size as the adjacency matrix A.
4. The network characterization method based on adaptive structure and position coding according to claim 1, characterized in that: The structural encoders g1 and g2 both adopt a one-layer graph convolutional neural network, and the position encoder adopts a graph attention network.
