Heterogeneous graph representation learning method based on graph converter

By designing new sampling strategies and attention mechanisms in heterogeneous graph representation learning, combined with graph convolutional neural networks and graph transformers, the problem of computational overhead and insufficient information capture of heterogeneous graph transformers in large-scale graph processing is solved. , achieving high-quality heterogeneous graph representation and performance improvement.

CN118839719APending Publication Date: 2024-10-25HANGZHOU DIANZI UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410971256.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2024-10-25

AI Technical Summary

Technical Problem

Existing heterogeneous graph transformers face the problems of excessive computational overhead, incomplete capture of heterogeneous information, and low sequence quality when processing large-scale heterogeneous graphs, and cannot effectively capture high-order information and long-order dependencies.

Method used

Propose a heterogeneous graph representation learning method based on graph transformers, obtain node-edge-node relationships through network data, design a new sampling strategy to construct high-quality node sequences, and use graph convolutional neural networks and graphs Transformer learns node representation, combines the attention coefficient of node features and type information, reduces feedforward network parameters, and improves model performance.

Benefits of technology

It achieves accurate representation learning of heterogeneous graphs, improves the performance of node classification tasks, can effectively capture the structure and heterogeneous information in heterogeneous graphs, and improves the scalability and accuracy of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118839719A_ABST
    Figure CN118839719A_ABST
Patent Text Reader

Abstract

The invention discloses a heterogeneous graph representation learning method based on a graph converter, and the method comprises the steps: firstly obtaining the relation between different types of entities through network data, carrying out the modeling to form a heterogeneous graph, and inputting a first-order neighbor of a target node in the heterogeneous graph into a node sequence until a predefined length is met; secondly, mapping all different types of nodes in the heterogeneous graph to a common vector space by using linear transformation, and learning initial node representation of each node in an lth layer by using a graph convolutional neural network GCN; and then, based on the initial node representation, obtaining a final node representation containing type information through a graph converter Transform. Finally, the final node representation is used for a node classification task, the weight is optimized through loss, and the optimized node representation is learned. According to the method, accurate heterogeneous graph representation can be learned, so that the method is applied to downstream tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of heterogeneous graph representation learning, and in particular relates to a transformer-based heterogeneous graph representation learning method. Background Art

[0002] Heterogeneous graphs are widely used in real life. Learning the representation of heterogeneous graphs is very important, which helps to achieve downstream tasks such as node classification, link prediction, and graph classification. However, since heterogeneous graphs are full of rich heterogeneous semantics, traditional homogeneous graph-based methods cannot capture heterogeneous semantics, and heterogeneous graph representation learning is very challenging.

[0003] With the extensive research on the message passing framework, the methods of heterogeneous graph neural networks based on neighborhood aggregation for heterogeneous graph representation learning have attracted widespread attention. Due to the adoption of the message passing framework, these methods are inevitably subject to its limitations, especially the Weissfeller-Lehman isomorphism restriction, over-smoothing problem and over-suppression problem. Therefore, some graph transformer models have been proposed to replace the traditional message passing framework and have achieved state-of-the-art performance on various graph-related tasks. This success is mainly attributed to the effectiveness of the transformer architecture. In particular, the graph transformer learns the interactions between nodes in the context through a global attention mechanism. Despite the success of graph transformers, effectively applying graph transformers to heterogeneous graphs and capturing various semantics in heterogeneous graphs remains to be fully explored. In addition, the application of global attention mechanisms faces a key limitation due to quadratic complexity, which limits their scalability when processing large-scale graphs.

[0004] Recently, some studies have attempted to apply graph transformers to large-scale heterogeneous graphs. They use specially designed neighborhood sampling methods to construct inputs for the transformer and calculate different types of attention coefficients to capture heterogeneous semantics. The lengths of these sequences are adjusted to meet predefined criteria, and then they are input into the transformer for further processing. However, these methods also have their limitations. When the attention mechanism is applied at the node level, the model fails to capture high-order information and long-order dependencies. When sampling node sequences within a multi-hop neighborhood, some recognition nodes may be randomly ignored, resulting in degraded model performance. In addition, setting the predefined sequence length too large leads to computationally expensive calculations. Therefore, existing heterogeneous graph transformers face the challenges of excessive computational overhead, incomplete capture of heterogeneous information, and low sequence quality. Summary of the invention

[0005] To address these challenges, the present invention proposes a heterogeneous graph representation learning method based on graph transformer to improve the accuracy of heterogeneous graph representation.

[0006] The present invention comprises the following steps:

[0007] S1. Obtain the relationships between different types of entities through network data, represent these relationships with “node-edge-node”, and model them into heterogeneous graphs.

[0008] S2. Input the first-order neighbors of the target node in the heterogeneous graph into the node sequence S.

[0009] The calculation formula of weight function D(·) is as follows:

[0010]

[0011] Among them, d v Represents the degree of node v. For the second-order neighbors of the target node, calculate the entropy H(S) incorporated into the node sequence:

[0012]

[0013] Where P(·) is the probability function, is the type of node, φ(·) is the node type mapping function. At the same time, the number of node types T(S) in the node sequence is calculated:

[0014] T(S)=|φ(S)|

[0015] Compute the score of a node sequence:

[0016]

[0017] After calculating the scores of the sequences composed of the neighbor nodes of all nodes in the sequence, the neighbor node pointed to by the highest score is selected and input into the node sequence.

[0018] S3. Repeat the highest score sampling process until the sequence length meets the pre-defined length.

[0019] S4. Use a linear transformation to map all different types of nodes in the heterogeneous graph into a common vector space:

[0020] h v =W φ(v) X v +b φ(v)

[0021] Among them, W φ(v) is a weight matrix, b φ(v) is the deviation term.

[0022] S5. In the vector space, use the graph convolutional neural network GCN to learn the preliminary node representation of each node in the lth layer:

[0023]

[0024] Among them, A is the adjacency matrix of the heterogeneous graph, D is the degree matrix of the node, is a weight matrix. (l) The i-th row is the node representation For the entire heterogeneous graph The sampling node sequence matrix obtained in the previous step is Where s is the sequence length. After learning the structural information, we can get the input of the heterogeneous graph transformer Where d is the node representation dimension.

[0025] S6. Based on the preliminary node representation, the final node representation containing type information is obtained through the graph transformer.

[0026] For heterogeneous graphs, we need to learn the heterogeneous information that exists. For the target node v, we first use a one-hot vector As a node type vector to represent its node type. In order to capture heterogeneous relationships on the sequence and propagate the node types of neighbors, we use GCN as an encoder to integrate the node type information in the node sequence. The update process of the node type vector r is as follows:

[0027]

[0028] in, is the type weight matrix, is the parameter θ r GCN encoder.

[0029] The learned node type vector is then input into the graph transformer. Specifically, the standard graph transformer is first used to learn the attention coefficient based on node features. Next, the node type vector is used to learn the type attention coefficient. Finally, the two sets of attention coefficients are fused together and the final node representation is read out. Different from the traditional attention coefficient calculation method, we adopt a method with fewer parameters to calculate the attention coefficient based on node features, which is as follows:

[0030]

[0031] Among them, a and W are weight matrices. The type attention coefficient is calculated as follows:

[0032]

[0033] in, and is the weight matrix. The final fusion calculation of the attention coefficient is as follows:

[0034]

[0035] Additionally, the feed-forward network is removed from each layer of the Graph Transformer, which has been shown to improve performance. This also reduces the number of learnable parameters without affecting the results.

[0036] In general, the graph transformer layer is calculated as follows:

[0037] H1 S(l) =LN(α+H1 S(l-1) )

[0038] Where LN(·) is the layer normalization function, is the attention coefficient matrix, composed of α i,j composition.

[0039] Finally, a readout function is used to get the final representation:

[0040] Z=Readout(H1 S(l) )

[0041] The target node representation in the sequence is used as the output node representation.

[0042] S7. After obtaining the final node representation, it can be used for node classification tasks. According to the availability of node labels, the weights of the model are optimized by minimizing the cross entropy loss using back propagation and gradient descent. Through this process, the accurate node representation of the optimized heterogeneous graph can be learned.

[0043] Beneficial effects of the present invention:

[0044] This paper proposes a heterogeneous graph representation learning method based on graph transformer. A new sampling strategy is designed to achieve the sampling of high-quality node sequences of target nodes. The heterogeneous contextual neighbor sampling strategy simultaneously considers the importance of structure, the diversity of types, and the richness of heterogeneous semantics. Subsequently, the sampled node sequence is input into a heterogeneous graph transformer to obtain the final node representation. The heterogeneous graph transformer further integrates node relations and attention mechanisms to reflect the semantic similarity between nodes in heterogeneous views. Our method can learn accurate heterogeneous graph representations, which can be applied to downstream tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 This is a network structure diagram of the heterogeneous graph representation learning method based on graph transformer of the present invention. DETAILED DESCRIPTION

[0046] Example 1

[0047] In this embodiment, a heterogeneous graph representation learning method based on graph transformer is disclosed, the process is as follows Figure 1 As shown, including:

[0048] S1: Obtain the relationships between different types of entities in the real-world citation network data, represent these relationships with "node-edge-node", and perform data processing to model them into heterogeneous graphs.

[0049] In the citation network, there are many types of nodes, such as papers, authors, citations, etc. In order to realize the representation of different types of nodes in the heterogeneous graph, this embodiment constructs the relationship between "paper-author" and "paper-citation" into a heterogeneous graph. in is the node set, ε is the edge set, and n is the number of nodes. An edge e ij =(v i ,v j )∈ε represents v i and v j There is a relationship between them. We arrange different types of node features into a feature matrix X according to the node index. The adjacency matrix of is A, where A ij =1 indicates edge e ij exists in ε. At the same time, the heterogeneous graph has two mapping functions: φ(v): and They correspond to nodes and edges respectively. and represents the set of node types and edge types, where

[0050] S2: Sequence sampling of target nodes in heterogeneous graphs to obtain high-quality node sequences.

[0051] Input the first-order neighbors of the target node into the node sequence S. Calculate the degree of all nodes, the sequence entropy of the candidate node, and the number of node types in the sequence, and select the candidate node with the highest score based on the final score and input it into the node sequence.

[0052] S3. Repeat the highest score sampling process until the sequence length meets the pre-defined length.

[0053] S4. Use a linear transformation to map different types of nodes into a common vector space.

[0054] S5. In the vector space, use the graph convolutional neural network GCN to learn the preliminary node representation of each node in the lth layer.

[0055] S6. Based on the preliminary node representation, the final node representation containing type information is obtained through the graph transformer.

[0056] First, this embodiment encodes the node type into a one-hot vector, and then encodes the type vector matrix into a type representation through GCN. The type representation is then input into the transformer for learning the attention coefficient. The attention coefficient consists of two parts: the type attention coefficient and the global attention coefficient. The transformer learns the representation of the node sequence: H1 S(l) =LN(α+H1 S(l-1) Then, this embodiment uses a readout function to obtain the final representation: Z = Readout (H1 S(l) ), and selects the target node representation in the sequence as the output node representation.

[0057] S7. Model optimization.

[0058] This example optimizes the model's weights by minimizing the cross entropy loss:

[0059]

[0060] in is the set of labeled nodes, C is the number of categories, and y v It is a vector obtained by one-hot encoding the label of node v.

[0061] Use the optimized model to obtain representations of heterogeneous graphs.

[0062] This embodiment conducts experiments on four real-world datasets: DBLP, IMDB, Freebase, and AMiner. The target nodes are divided into training set, validation set, and test set in a ratio of 24:6:70.

[0063] In the dataset used in this embodiment, the target node type of DBLP is author, the target node type of IMDB is movie, the target node type of Freebase is movie, and the target node type of AMiner is paper. This embodiment uses labels to evaluate the detection results.

[0064] If the prediction result of a node is positive and the label is positive, it is a true positive (TP). If the prediction result of a node is negative and the label is positive, it is a false negative (FN). If the prediction result of a node is negative and the label is negative, it is a true negative (TN). If the prediction result of a node is positive and the label is negative, it is a false positive (FP). The performance of the method disclosed in this embodiment is evaluated using Micro-F1 and Macro-F1 scores based on precision and recall.

[0065]

[0066] Among them, Precisioni and Recall i are the precision and recall corresponding to category i.

[0067] The detection results of the method disclosed in this embodiment are compared with those of GCN, GAT, Transformer, RGCN, HetGNN, HAN, GTN, MAGNN, RSHN, HetSANN, HGT, HINormer and SimpleHGN. The results on the DBLP dataset are shown in Table 1, the results on the IMDB dataset are shown in Table 2, the results on the Freebase dataset are shown in Table 3, and the results on the AMiner dataset are shown in Table 4. Compared with the other methods, the method disclosed in this embodiment achieved the highest Micro-F1 and Macro-F1 scores. The performance of the method disclosed in this embodiment exceeds that of Transformer, HGT and HINormer, which illustrates the effectiveness of the designed sampling strategy, which can capture key structural and heterogeneous information in heterogeneous graphs. Compared with the cyclic random sampling within the neighborhood of HINormer, the method disclosed in this embodiment can sample nodes containing more information. Compared with Transformer, our model is able to learn more heterogeneous semantics. Secondly, the method disclosed in this embodiment outperforms all heterogeneous graph neural network methods, emphasizing the superiority of the global attention mechanism in heterogeneous graph learning. Third, the standard transformer outperforms most heterogeneous graph neural network methods, illustrating the importance of capturing contextual information in learning heterogeneous graph representations. Finally, the performance of the meta-path-based heterogeneous graph neural network is almost equivalent to that of the heterogeneous graph neural network without meta-paths. This suggests that in the future, more effective models can be designed without prior knowledge.

[0068] Table 1

[0069]

[0070] Table 2

[0071]

[0072] Table 3

[0073]

[0074]

[0075] Table 4

[0076]

[0077] The heterogeneous graph representation learning method disclosed in this embodiment uses original relationship data to model pairwise relationships, and applies transformers in heterogeneous graphs to learn structural information and capture heterogeneous relationships to understand the importance of different nodes, thereby achieving accurate heterogeneous graph representation.

Claims

1. A heterogeneous graph representation learning method based on graph transformer, characterized in that: The following steps are involved: S1. Obtain the relationship between different types of entities through network data, represent the relationship with node-edge-node, and model it into a heterogeneous graph; S2, input the first-order neighbors of the target node in the heterogeneous graph into the node sequence S until S meets the predefined length; S3, use linear transformation to map all different types of nodes in the heterogeneous graph into a common vector space; S4. In the vector space, use the graph convolutional neural network GCN to learn the preliminary node representation of each node in the lth layer; S5. Based on the preliminary node representation, the final node representation containing type information is obtained through the graph transformer; S6. After obtaining the final node representation, it is used for the node classification task. The weights are optimized by minimizing the cross entropy loss using back propagation and gradient descent to learn the optimized node representation.

2. The heterogeneous graph representation learning method based on graph transformer according to claim 1, characterized in that: The specific implementation process of step S2 is as follows: The calculation formula of weight function D(·) is as follows: Among them, d v Represents the degree of node v; for the second-order neighbors of the target node, calculate the entropy H(S) incorporated into the node sequence: Where P(·) is the probability function, is the type of node, φ(·) is the node type mapping function; at the same time, the number of node types T(S) in the node sequence is calculated: T(S)=|φ(S)| Compute the score of a node sequence: After calculating the scores of the sequences composed of the neighbor nodes of all nodes in the sequence, the neighbor node pointed to by the highest score is selected and input into the node sequence.

3. The heterogeneous graph representation learning method based on graph transformer according to claim 2, characterized in that: The mapping of all different types of nodes in the heterogeneous graph to a common vector space is specifically as follows: h v =W φ(v) X v +b φ(v) Among them, W φ(v) is a weight matrix, b φ(v) is the deviation term.

4. The heterogeneous graph representation learning method based on graph transformer according to claim 3, characterized in that: The specific process of using the graph convolutional neural network GCN to learn the node representation of each node in the lth layer is as follows: Among them, A is the adjacency matrix of the heterogeneous graph, D is the degree matrix of the node, is a weight matrix; H (l) The i-th row is the node representation For the entire heterogeneous graph The obtained sampling node sequence matrix is Where s is the sequence length; after learning the structural information, the input of the heterogeneous graph transformer is obtained Where d is the node representation dimension.

5. The heterogeneous graph representation learning method based on graph transformer according to claim 4, characterized in that: The specific implementation process of step S5 is as follows: First, for the target node v, use a one-hot vector As the node type vector represents its node type, GCN is used as the encoder to integrate the node type information in the node sequence; the update process of the node type vector r is as follows: in, is the type weight matrix, is the parameter θ r GCN encoder of Secondly, the graph transformer Transforme is used to learn the attention coefficient based on node features; Then use the node type vector to learn the type attention coefficient; Finally, the two sets of attention coefficients are fused and the final node representation is read out.

6. The heterogeneous graph representation learning method based on graph transformer according to claim 5, characterized in that: The attention coefficient based on node features is calculated as follows: Among them, a and W are weight matrices; The type attention coefficient is calculated as follows: in, and is the weight matrix; the final fusion calculation of the attention coefficient is as follows: The calculation of the graph transformer layer is as follows: H1 S(l) =LN(α+H1 S(l-1) ) Where LN(·) is the layer normalization function, is the attention coefficient matrix, composed of α i,j composition; Finally, use the readout function to get the final representation: Z=Readout(H1 S(l) ) The target node representation in the sequence is used as the output node representation.

7. The heterogeneous graph representation learning method based on graph transformer according to claim 6, characterized in that: Each layer of the graph transformer Transforme removes the feedforward network.

Citation Information

Patent Citations

  • Heterogeneous graph classification method based on double-layer attention mechanism

    CN112381179A

  • Attribute-enhanced heterogeneous graph attention network representation learning method

    CN116341626A

  • Method and apparatus for classifying nodes of a graph

    WO2023087303A1