Multi-view heterogeneous graph neural network model based on comparative learning framework
By adopting the multi-view heterogeneous graph neural network model of the contrastive learning framework in the heterogeneous graph, using the contrastive learning between nodes and views inside and outside the meta-path, combined with graph convolution and graph attention network, the graph structure in the heterogeneous graph is solved. It solves the problem of sparsity and node feature noise, improves the accuracy of node embedding representation, and is suitable for large-scale heterogeneous graph processing and various downstream tasks.
Patent Information
- Application Number
- CN202310340167.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-03
- Publication Date
- 2024-10-15
AI Technical Summary
When the existing technology processes complex heterogeneous graphs, the sparse graph structure and node feature noise lead to low accuracy of node embedding representation, and there is an over-smoothing phenomenon, making it difficult to effectively mine node information.
A multi-view heterogeneous graph neural network model based on a contrastive learning framework is used to enhance node feature representation through contrastive learning of nodes inside and outside the meta-path and between different views, and combines graph convolution and graph attention networks for aggregation and optimization.
It improves the accuracy of node embedding representation, effectively solves the problems of heterogeneous graph sparseness and node feature noise, can handle large-scale heterogeneous graphs, and has broad application prospects in fields such as recommendation systems and link prediction.
Smart Images

Figure CN118780315A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to learning node embedding representations in heterogeneous graphs, and more particularly to a graph enhancement method using multiple views and meta-paths in heterogeneous graphs. Background Art
[0002] Graph representation learning is an active research discipline, which mainly makes effective use of and learns the information in the graph, and uses the obtained embedded representation for downstream tasks. There are already many methods in existing research, but they only use meta-paths to instantiate nodes in the graph and encode and aggregate the instantiated nodes. At present, an effective strategy for large heterogeneous graph structures is to use meta-paths to explore the first-order and high-order neighbors of heterogeneous graphs, which can dig deeper into node information. However, in complex heterogeneous graphs, the graph structure is often sparse and the node features have noise characteristics, and there are large errors and over-smoothing in the node embedding representation after training. A multi-view heterogeneous graph neural network model based on a contrastive learning framework in the present invention enhances node features by contrastive learning of nodes inside and outside the meta-path and between different views, rather than re-implementing existing discovery methods, thereby improving the accuracy of node embedding representation. Summary of the invention
[0003] The first purpose of the present invention is to overcome the shortcomings and deficiencies of the prior art and provide a multi-view heterogeneous graph neural network model based on a contrastive learning framework, which breaks through the traditional heterogeneous graph representation learning method and can handle the problems of sparse graph structure, noisy node features, and over-smoothing of node features obtained after existing model training, thereby improving the accuracy of node embedding representation.
[0004] The second objective of the present invention is achieved by the following technical solution: A multi-view heterogeneous graph neural network model based on a contrastive learning framework comprises the following steps: 1) In a heterogeneous graph, the nodes in the graph are initialized, and multiple meta-paths are used to explore the first-order and high-order neighbor information of the central node; 2) According to step 1), obtain the neighbors of the central node on different meta-paths and perform graph convolution aggregation on the central node respectively; 3) According to step 2), the embedded representation of the central node on a certain meta-path is obtained, and contrastive learning based on the meta-path is used to enhance the embedded representation of the central node. The positive samples are nodes inside the meta-path, and the negative samples are nodes outside the meta-path. 4) Based on the feature representation of the central node on different meta-paths obtained in step 2), the feature representation of the central node is further enhanced by contrastive learning based on meta-paths. The positive samples are the embedded representations of the central node on different meta-paths, and the negative samples are the embeddings of nodes outside the node. 5) Based on the embedding representations of the central nodes on different meta-paths obtained in step 2), the graph attention network is used to aggregate different embedding representations; 6) Use graph attention neural network to aggregate central nodes in the original heterogeneous graph; 7) Based on the embedding representation of the central node obtained in step 5) and step 6), cross-view contrast learning is performed, where the positive samples are different embedding representations of the central node, and the negative samples are other nodes, where the embedding used by the negative samples is obtained by aggregation between meta-paths; 8) According to step 5) and step 6), the embedding representations of the central node are added to obtain the final embedding representation of the central node, and the proposed model is back-propagated and optimized using the designed loss function. The embedding representation can be applied to common downstream tasks.
[0005] In step 1), the heterogeneous graph is composed of different types of nodes and edges. The meta-path is an ordered sequence of nodes of different or same types. The first-order neighbors and higher-order neighbors refer to nodes directly connected to the central node and nodes indirectly connected to the central node, respectively.
[0006] a. The calculation formula for initializing the features of heterogeneous graph nodes is as follows:
[0007] in Representation Node i Type, represents the mapping matrix, Representation Node i The feature vector of .
[0008] The calculation formula for graph convolution aggregation of the central node in step 2) is as follows:
[0009] in , represents the adjacency matrix, represents the identity matrix, is the trainable weight matrix, Represents node characteristics, represents the number of aggregation layers, where , represents a non-linear activation function.
[0010] In step 3), the contrastive learning refers to shortening the embedding distance between positive samples and increasing the embedding distance between negative samples. According to step 2), the embedding representation of each node in the meta-path is obtained. ,in represents the first meta-path, Indicates the length of the meta-path. The sequence obtained after the same meta-path instance is used as a positive sample, and other nodes are used as negative samples.
[0011] a. The contrastive learning calculation within the meta-path is as follows:
[0012] in represents the target node, Represents the characteristics of the target node under a certain meta-path, represents the positive sample pair under this meta-path, represents a hyperparameter.
[0013] In step 4), the central nodes obtained in step 2) are embedded in different meta-paths to represent ,in Indicates that it contains a central node i The set of all meta-paths of As a positive example , other nodes are used as negative samples .
[0014] a. To enhance the embedding representation of nodes, the calculation method of meta-path comparison learning is as follows:
[0015] in Representation Node u and nodes v Cosine similarity between vectors, Representation Node Feature collection under different meta-paths.
[0016] In step 5), the graph attention network aggregates the embedding representations on different meta-paths of the same node as shown below.
[0017] a. Calculate the similarity between the embedding representations of the same node in different meta-paths as follows:
[0018] Perform a linear transformation on the weight matrix. In the The embedding representation on the element path is the same as the j The embedded representations on the stripe paths are linearly transformed and concatenated, and the influence coefficients are calculated.
[0019] In order to To distinguish the impact of different meta-paths, use The data normalization is as follows
[0020] c. The embedded representation of the computation node is as follows:
[0021] in Representation Node In the meta path i and j The attention coefficient between Representation Node In the meta path j The following embedding representation.
[0022] In step 6), the graph attention aggregation method for nodes in the original heterogeneous graph is as follows:
[0023] Perform a linear transformation on the weight matrix. With Node Perform linear transformation and splicing, and calculate the influence coefficient. To distinguish the impact of different nodes, use The data normalization is as follows:
[0024]
[0025] In step 7): the cross-view is a semantic view and a structural view based on meta-path aggregation.
[0026] a. To enhance the embedding representation of nodes, cross-view contrast learning is performed. The calculation method is as follows:
[0027] in Representation Node u and nodes v Cosine similarity between vectors, Representation Node i In the meta path The following features.
[0028] b. Use the designed loss function to perform back propagation optimization on the proposed model
[0029] in Represents the aggregation of all nodes. The proposed model is optimized using back-propagation. Finally, the trained node features are used to perform downstream tasks.
[0030] Compared with the prior art, the present invention has the following advantages and beneficial effects: 1. For the first time, the present invention realizes comparative learning within a meta-path, between meta-paths, and between different views to enhance node embedding representation, improve node embedding representation, and effectively solve the problem of sparse heterogeneous graphs and noise in node features; 2. The present invention can be combined with the field of big data and deployed on a distributed system to more efficiently process large-scale heterogeneous graphs and obtain efficient node embedding representations; 3. The method of the present invention has a wide range of applications in graph node embedding representation and is highly practical. It has broad prospects in recommendation systems, link prediction, and node classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 Schematic diagram of the logic flow of the present invention Figure 2 This is the model framework diagram of the present invention Figure 3 Schematic diagram of the division of positive and negative samples in the meta-path contrast learning of the present invention
[0032] Figure 4 This is a schematic diagram of comparative learning between meta-paths of the present invention. DETAILED DESCRIPTION
[0033] The present invention is further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto.
[0034] This embodiment discloses a multi-view heterogeneous graph neural network model based on a contrastive learning framework, such as Figure 1 As shown; the method is implemented logically as Figure 2 As shown in the figure, the method regards the entire heterogeneous graph as a semantic view and a structural view respectively. In the semantic view, the meta-path is used to walk the heterogeneous graph. The node features within the meta-path and the node features between different meta-paths are aggregated using graph convolutional neural networks and graph attention neural networks respectively, and comparative learning is performed within and between meta-paths. In the structural view, the graph attention neural network is used to aggregate the node features. In the future, the node embedding representations in the semantic view and the structural view are summed, and comparative learning is performed between different views to enhance the node embedding representation. Specifically, the following steps are included: 1) In Figure 2In the semantic view in the , meta-path is used to walk in the heterogeneous graph to obtain the first-order and higher-order neighbors of the node. The heterogeneous graph is composed of different types of nodes and edges. The meta-path is an ordered sequence of relations connecting different or same node types. The first-order neighbors and higher-order neighbors refer to the nodes directly connected to the central node and the nodes indirectly connected to the central node, respectively.
[0035] Take one of the meta-paths PAP, whose walk sequence length is 3, as an example. Figure 3 As shown, the sequence obtained by instantiating the meta path p 1 a 2 p 4 , p 1 a 1 p 2 , p 4 a 4 p 3 Etc., according to the walking sequence p 1 Neighbor nodes a 2 , a 1 , p 4 , p 2 Perform graph convolution aggregation calculation on its neighbor nodes to obtain p 1 The embedded representation at this time. And p 1 Positive and negative samples under the PAP meta-path, where the nodes p 1 Nodes of the same type are taken as positive examples, for example p 4 , p 2 , the remaining nodes of the same type are used as negative samples, for example p 3 .
[0036] a. The graph convolution aggregation calculation formula is as follows:
[0037] in , represents the adjacency matrix, represents the identity matrix, is the trainable weight matrix, Represents node characteristics, represents the number of aggregation layers, where , Represents a nonlinear activation function. Specific implementation methods, such as Figure 3 Heterogeneous graph nodes in =8, , as well as The dimensions are , The dimension is , The dimension is .
[0038] After this step, the embedded representation of the nodes in each meta-path is obtained. ,in represents the first meta-path, represents the length of the metapath walk, Figure 3 Taking the metapath PAP in heterogeneous graph as an example, It can be expressed as Contrastive learning is performed within the meta-path to enhance the embedding representation of the node. The contrastive learning refers to shortening the embedding representation distance between positive samples and increasing the embedding representation distance between negative samples.
[0039] b. Contrastive learning within the meta-path is as follows:
[0040] in represents the target node, Represents the characteristics of the target node under a certain meta-path, represents the positive sample pair under this meta-path, Represents a hyperparameter. p 1 Perform node embedding reinforcement learning, where and , in order to facilitate the calculation, first determine The dimension will The dimension is expanded to Same dimension, then do the inner product. The size is set to 0.5.
[0041] Since the same node may exist in different meta-paths, such as p 1 Exists in metapath PAP and metapath PCP , In order to further enhance the embedding representation of nodes, comparative learning is performed on the same node between different meta-paths, such as Figure 4 As shown, the embedding of the same node is represented as a positive example, and the embedding of other nodes is represented as a negative example.
[0042] To enhance the embedding representation of nodes, the calculation method of meta-path contrast learning is as follows:
[0043] in Representation Node u and nodes v Cosine similarity between vectors, Representation Node Feature collection under different meta-paths. Figure 4 Take the heterogeneous graph and meta-path in as an example, p 1 They exist in the meta-path PAP and meta-path PCP respectively. and , The size is set to 0.5.
[0044] 2) The calculation formula for the embedding representation of a node in the semantic view is as follows: a. Calculate the similarity between the embedding representations of the same node in different meta-paths as follows:
[0045] Perform a linear transformation on the weight matrix. In the The embedding representation on the element path is the same as the j The embedded representations on the stripe path are linearly transformed and concatenated, and the influence coefficient is calculated. Figure 4 For example, suppose p 1 The embedding representations in meta-path PAP and meta-path PCP are , as well as So The correlation coefficient can be expressed as 0.7.
[0046] b. In order to To distinguish the impact of different meta-paths, use The row data is normalized as follows:
[0047] c. The embedded representation of the computation node is as follows:
[0048] in Representation Node In the meta path i and j The attention coefficient between Representation Node In the meta path j The embedding representation under . Then we can get p 1 Embedding representation in a semantic view .
[0049] 3) Use graph attention neural network to aggregate nodes in the structural view to obtain the embedded representation of each node.
[0050] a. The graph attention aggregation method is as follows:
[0051] Perform a linear transformation on the weight matrix. With Node Perform linear transformation and splicing, and calculate the influence coefficient. To distinguish the impact of different nodes, use Normalize the data and calculate the obtained normalization coefficient and neighbor features as follows:
[0052]
[0053] 4) In order to further enhance the embedded representation of nodes, cross-view contrastive learning is adopted.
[0054] a. Contrastive learning across views:
[0055] in Representation Node u and nodes v Cosine similarity between vectors, Representation Node i In the meta path The following features.
[0056] 5) The final heterogeneous graph embedding representation is obtained by adding the embedding representation obtained on the semantic view and the embedding representation on the structural view to obtain the final embedding representation of the node. Assume p 1 The embedding obtained by aggregation in the semantic view is expressed as [0.23, 0.034], and the embedding obtained in the structural view is expressed as [0.032, 0.22], then p 1The final embedding of is represented as [0.23, 0.034] + [0.032, 0.22] = [0.262, 0.254].
[0057] 6) To optimize the parameters in the model, the loss function is set to:
[0058] in Represents the aggregation of all nodes. The proposed model is optimized using back-propagation. Finally, the trained node features are used to perform downstream tasks.
[0059] In summary, after adopting the above scheme, the present invention provides a new method for solving the existing heterogeneous graph sparsity problem and the noise problem of node features, which results in inaccurate node embedding representation. It can effectively enhance the node embedding representation through comparative learning within meta-paths, between meta-paths and across views. It has practical promotion value and is worthy of promotion.
[0060] The above-described embodiments are only preferred embodiments of the present invention and are not intended to limit the scope of implementation of the present invention. Therefore, all changes made according to the shape and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A multi-view heterogeneous graph neural network model based on a contrastive learning framework, including the following modules and functional steps: 1) In a heterogeneous graph, the nodes in the graph are initialized, and multiple meta-paths are used to explore the first-order and high-order neighbor information of the central node; 2) According to step 1), obtain the neighbors of the central node on different meta-paths and perform graph convolution aggregation on the central node respectively; 3) According to step 2), the embedded representation of the central node on a certain meta-path is obtained, and contrastive learning based on the meta-path is used to enhance the embedded representation of the central node. The positive samples are nodes inside the meta-path, and the negative samples are nodes outside the meta-path. 4) Based on the feature representation of the central node on different meta-paths obtained in step 2), the feature representation of the central node is further enhanced by contrastive learning based on meta-paths. The positive samples are the embedded representations of the central node on different meta-paths, and the negative samples are the embeddings of nodes outside the node. 5) Based on the embedding representations of the central nodes on different meta-paths obtained in step 2), the graph attention network is used to aggregate different embedding representations; 6) Use graph attention neural network to aggregate central nodes in the original heterogeneous graph; 7) Based on the embedding representation of the central node obtained in step 5) and step 6), cross-view contrast learning is performed, where the positive samples are different embedding representations of the central node, and the negative samples are other nodes, where the embedding used by the negative samples is obtained by aggregation between meta-paths; 8) According to step 5) and step 6), the embedding representations of the central node are added to obtain the final embedding representation of the central node, and the proposed model is back-propagated and optimized using the designed loss function. The embedding representation can be applied to common downstream tasks.
2. The multi-view heterogeneous graph neural network model based on a contrastive learning framework according to claim 1, characterized in that: In step 1), the heterogeneous graph is composed of different types of nodes and edges. The meta-path is an ordered sequence of nodes of different or same types. The first-order neighbors and higher-order neighbors refer to nodes directly connected to the central node and nodes indirectly connected to the central node, respectively; a. The calculation formula for initializing the features of heterogeneous graph nodes is as follows: , in Representation Node i Type, represents the mapping matrix, Representation Node i The feature vector of .
3. The multi-view heterogeneous graph neural network model based on a contrastive learning framework according to claim 1, characterized in that: In step 2) a. The calculation formula for graph convolution aggregation of the central node is as follows: , in , represents the adjacency matrix, represents the identity matrix, is the trainable weight matrix, Represents node characteristics, represents the number of aggregation layers, where , represents a non-linear activation function.
4. The multi-view heterogeneous graph neural network model based on a contrastive learning framework according to claim 1, characterized in that: In step 3), the contrastive learning refers to shortening the embedding distance between positive samples and increasing the embedding distance between negative samples. According to step 2), the embedding representation of each node in the meta-path is obtained. ,in represents the first meta-path, Indicates the length of the meta-path. The sequence obtained after the same meta-path instance is used as a positive sample, and other nodes are used as negative samples; a. The contrastive learning calculation within the meta-path is as follows: , in represents the target node, Indicates the characteristics of the target node under a certain meta-path, represents the positive sample under this meta-path, Represents a hyperparameter.
5. The multi-view heterogeneous graph neural network model based on a contrastive learning framework according to claim 1, characterized in that: In step 4), the central node obtained in step 2) is embedded in different meta-paths to represent ,in Indicates that it contains a central node i The set of all meta-paths of As a positive example , other nodes are used as negative samples ; a. To enhance the embedding representation of nodes, the calculation method of meta-path comparison learning is as follows: , in Representation Node u and nodes v Cosine similarity between vectors, Representation Node Feature collection under different meta-paths.
6. The multi-view heterogeneous graph neural network model based on a contrastive learning framework according to claim 1, characterized in that: In step 5), the graph attention network aggregates the embedding representations on different meta-paths of the same node as shown below; a. Calculate the similarity between the embedding representations of the same node in different meta-paths as follows: , in Perform a linear transformation on the weight matrix. In the The embedding representation on the element path is the same as the j The embedded representations on the stripe path are linearly transformed and concatenated, and the influence coefficients are calculated; b. In order to To distinguish the impact of different meta-paths, use The data normalization is as follows , c. The embedded representation of the computation node is as follows: , in Representation Node In the meta path i and j The attention coefficient between Representation Node In the meta path j The following embedding representation.
7. The multi-view heterogeneous graph neural network model based on a contrastive learning framework according to claim 1, characterized in that: In step 6), the graph attention aggregation method for nodes in the original heterogeneous graph is as follows: , in Perform a linear transformation on the weight matrix. With Node Perform linear transformation and splicing, and calculate the influence coefficient. To distinguish the impact of different nodes, use Normalize the data and calculate the normalized influence coefficient and the corresponding neighbor features, as shown below , 8. The multi-view heterogeneous graph neural network model based on contrastive learning framework according to claim 1, characterized in that Step 7): The cross-view is a semantic view and a structural view based on meta-path aggregation; a. To enhance the embedding representation of nodes, cross-view contrast learning is performed. The calculation method is as follows: , in Representation Node u and nodes v Cosine similarity between vectors, Representation Node i In the meta path The following features; b. Use the designed loss function to perform back propagation optimization on the proposed model , in Represents the aggregation of all nodes. The proposed model is optimized using back-propagation. Finally, the trained node features are used to perform downstream tasks.
Citation Information
Cited By
Social platform opinion leader identification method based on graph contrast learning
CN121030273A
