Graph-level data classification method based on pyramid graph pooling Transformer
Through the pyramid graph pooling Transformer method, the problem of limited receptive field of graph convolutional neural networks is solved, multi-scale feature extraction and classification of graph-level data are realized, and the performance of graph-level tasks is improved.
Patent Information
- Application Number
- CN202411328269.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2044-09-24
AI Technical Summary
In graph-level tasks, existing technologies such as graph convolutional neural networks have limited receptive field and are unable to effectively capture long-distance node relationships, resulting in over-smoothing and over-squeezing, which affects the performance of graph neural networks.
A pyramid graph pooling Transformer-based method is adopted to extract local neighborhood information through graph neural network. The pyramid pooling operation and Transformer network are combined to capture multi-scale features and perform graph-level data classification.
It effectively captures the dependencies between nodes at close or distant locations, reduces the length of node sequences in the Transformer, improves the model's representation learning capabilities, and enhances the accuracy of graph-level data classification.
Smart Images

Figure CN119445192B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a graph-level data classification method based on a pyramid graph pooling Transformer. Background Art
[0002] In the field of computer vision, convolutional neural networks (CNNs) have been widely used to process image, video, and audio data due to their powerful feature extraction capabilities. For graph-level data, CNNs increase the number of network layers to increase the receptive field. However, as the number of network layers increases, problems such as over-smoothing and over-squeezing can occur, leading to decreased performance of graph neural networks.
[0003] In graph-level tasks, it is necessary to predict a target value that describes the entire graph. This target value may depend on the dependencies of distant nodes. The limited receptive field of graph convolutional neural networks is not enough to capture the relationships between distant nodes. Increasing the number of network layers will bring about problems of over-smoothing and over-squeezing.
[0004] Therefore, it is crucial to design a new graph-level data classification architecture to break through the message passing limitation and solve the problems of over-smoothing and over-squeezing. Summary of the Invention
[0005] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a graph-level data classification method based on pyramid graph pooling Transformer to realize the classification of graph-level data under graph-level tasks.
[0006] The purpose of the present invention can be achieved by the following technical solutions:
[0007] One aspect of the present invention provides a graph-level data classification method based on a pyramid graph pooling Transformer, comprising the following steps:
[0008] Step S1: Obtain input graph-level data, use graph neural network to extract local neighborhood information of the graph, and obtain encoding features;
[0009] Step S2: Based on the encoding features, multiple pooled graphs are obtained through multiple parallel graph pooling operations and upsampled respectively, and pyramid features are obtained by superimposing node features at corresponding positions of the graphs;
[0010] Step S3: concatenate the pyramid features with the preset tokens and use the cls token to obtain an embedding vector representing the entire graph.
[0011] Step S4: Based on the embedding vector, a multi-layer perception mechanism is used to obtain a graph-level data classification result.
[0012] As a preferred technical solution, in step S1, the hidden embedding of the current node is updated by aggregating the messages of the nodes in the neighborhood of the current node in the graph, thereby realizing the extraction of the local neighborhood information of the graph.
[0013] As a preferred technical solution, the process of updating the hidden embedding of the current node with the messages of the nodes in the neighborhood of the current node in the aggregation graph is implemented by the following formula:
[0014]
[0015] Among them, h v Represents the hidden embedding of node v, l is the number of layers of the local GNN network, UPDATE() represents updating the hidden layer embedding, AGGREGATE() represents the aggregation operation, and N(v) represents the set of neighbor nodes of node v.
[0016] As a preferred technical solution, step S2 includes the following sub-steps:
[0017] Step S201, performing a plurality of pooling operations with different ratios on the coding features to obtain a plurality of upsampled pooled maps;
[0018] Step S202: For each pooled graph, the nodes discarded in the upsampled pooled graph are obtained through graph convolution and depooling operations, the features corresponding to the discarded nodes are filled, and the discarded nodes are put back into the pooled graph to obtain a restored pooled graph.
[0019] Step S203: Add the corresponding nodes of each pooling graph to obtain pyramid features.
[0020] As a preferred technical solution, in step S202, the process of obtaining the restored pooled graph through graph convolution and depooling operations is implemented using the following formula:
[0021]
[0022] in, Represents the feature matrix of the graph obtained by the unpooling operation, λ represents the feature dimension of the graph obtained by the unpooling operation, UnPool() represents the unpooling operation, GCN() represents the graph convolution operation, assignment(X,Y,Z) represents replacing the features in position Y except Z with X, where 0 N×C It is represented as a feature matrix initialized to 0, loc represents the index of the retained node in the pooling graph, N is the total number of nodes, and C is the feature dimension of the node.
[0023] As a preferred technical solution, in step S3, the process of obtaining the embedding vector of the entire graph using the transformer includes:
[0024] Step S301: Using the encoded feature as a query for a self-attention mechanism in a transformer, and the pyramid feature as a key and value of the self-attention mechanism in the transformer, to obtain a vector output by the self-attention mechanism;
[0025] In step S302, the vector output by the self-attention mechanism is processed through a feedforward neural network, residual connection, and normalization to obtain the embedding vector of the entire graph.
[0026] As a preferred technical solution, the vector output by the self-attention mechanism is obtained using the following formula:
[0027]
[0028] in, Represents the pyramid representation of node v, W is the learnable weight matrix, LayerNorm() represents the layer normalization operation, represents the embedding of the projection node v, denote the learnable query, key, and value matrices respectively, Θ denotes the number of attention heads, ∥ denotes concatenation, and d trans Represents the dimension of transformer, Softmax() represents the softmax activation function, represents the concatenated output of multiple attention heads, is the vector output by the self-attention mechanism.
[0029] As a preferred technical solution, the embedding vector of the entire graph is obtained through a feedforward neural network, residual connection and normalization using the following formula:
[0030]
[0031] in, is the intermediate representation, FFN() represents the feedforward network, is the embedding vector of the entire graph.
[0032] Another aspect of the present invention provides an electronic device, characterized in that it includes: one or more processors and a memory, wherein the memory stores one or more programs, and the one or more programs include instructions for executing the aforementioned graph-level data classification method based on the pyramid graph pooling Transformer.
[0033] Another aspect of the present invention provides a computer-readable storage medium comprising one or more programs for execution by one or more processors of an electronic device, wherein the one or more programs include instructions for executing the aforementioned graph-level data classification method based on the pyramid graph pooling Transformer.
[0034] Compared with the prior art, the present invention has at least one of the following beneficial effects:
[0035] (1) Realizing the classification of graph-level data: The present invention first uses a graph convolutional neural network to encode the node features in the graph data to obtain the encoded representation, then uses a pyramid pooling operation to perform downsampling of the representation at different scales to obtain multi-scale information of the nodes, and finally inputs the node information of different scales into the transformer network, obtains the classification result through the multi-layer perception mechanism, and realizes the classification of graph-level data.
[0036] (2) Using pyramid pooling transformer to realize multi-scale feature extraction: Since the limited receptive field of graph neural network makes it difficult to capture the dependency relationship between distant nodes on the graph, the present invention adopts pyramid pooling transformer, which can not only capture the dependency relationship between distant and close nodes, but also reduce the length of the node sequence in the transformer and extract multi-scale information, thereby improving the representation learning ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 Schematic diagram of the pyramid graph pooling Transformer in the embodiment;
[0038] Figure 2 Schematic diagram of the pyramid pooling operation in the embodiment. DETAILED DESCRIPTION
[0039] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0040] Example 1
[0041] To address the problems of the aforementioned existing technologies, this embodiment provides a graph-level data classification method based on a pyramid graph pooling transformer. It first uses a graph convolutional neural network to encode node features to obtain an encoded representation. It then uses a pyramid pooling operation to downsample the representation at different scales to obtain multi-scale node information. Finally, this node information at different scales is input into a transformer network. The pyramid pooling transformer not only captures dependencies between nodes at close or distant locations, but also reduces the length of node sequences in the transformer and extracts multi-scale information.
[0042] This embodiment mainly focuses on graph-level tasks. For a given graph The goal is to predict the category y of the entire image, where V = {v1,v2,…,v n} represents a collection of nodes, represents the feature matrix of the node, Is the adjacency matrix, which describes the relationship between nodes. If the i-th node v in the graph i With the jth node v j connected, then the element A in row i and column j of A i,j Otherwise it is recorded as 0.
[0043] See also Figure 1 The overall architecture of the pyramid graph pooling Transformer is mainly composed of modules such as graph neural network, pyramid pooling and transformer. The graph neural network is mainly used to encode the graph structure and extract local neighborhood structure information; pyramid pooling is mainly used to extract multi-scale information of the graph while reducing the length of the transformer node sequence; transformer is mainly used to extract the global structural information of the graph while capturing the long-distance dependencies between nodes.
[0044] For a given input graph, it first passes through a graph neural network module to extract the local neighborhood information of the graph and obtain the encoded features. Then, several parallel graph pooling operations are performed to generate multiple pooled graphs. The pooled graphs are upsampled, and the features of the discarded nodes in the pooled graphs are filled with 0. Then, the node features at the corresponding positions of the upsampled graph are added to obtain pyramid features. This embodiment adds a special CLS token on top of the pyramid features. The CLS token is obtained by random initialization. Before the model training begins, the embedding vector of the CLS token is randomly assigned, and these initial values are updated through the backpropagation algorithm during the training process to optimize the classification performance. The embedding output of the CLS token after the transformer can summarize the information of other nodes. Finally, a multi-layer perceptron can be used to complete the classification and downstream tasks. In addition, this embodiment further modifies the multi-head self-attention, using the encoded features after the graph neural network encoding as the query of the self-attention, and the pyramid features as the key and value of the self-attention.
[0045] The following will be divided into three parts: graph neural network, pyramid pooling and Transformer.
[0046] Graph Neural Network: The message passing in the graph neural network of this embodiment is represented by aggregating the messages of its neighboring nodes to update its own hidden embedding. This process can be described by the following formula:
[0047]
[0048] where h v Represents the hidden embedding of node v, and l is the number of layers of the local GNN network. For the original graph, the graph neural network can effectively extract the local neighborhood information of the graph.
[0049] Pyramid pooling: see Figure 2 This is a schematic diagram of the pyramid pooling operation module, which mainly includes two operations: pooling and upsampling. Pooling is used to reduce the number of nodes on the graph and increase the receptive field. After the encoded graph is obtained using the graph neural network, graph pooling operations of different ratios are performed to obtain pooled graphs of different ratios. The original graph is encoded by the graph convolutional network to obtain the representation matrix H l , the operation process of pyramid pooling can be expressed as:
[0050]
[0051] in denotes the feature matrices of the pooled maps obtained with different pooling ratios, and m denotes the number of pooling operations. After obtaining multiple pooled maps, this embodiment performs an upsampling operation on the encoded pooled maps to restore the structure of the original map to better utilize multi-scale information.
[0052] In the image field, existing upsampling operations cannot be directly applied to graph data. To address this issue, this embodiment provides a depooling operation for graph data. This is the inverse of the pooling operation and can restore the pooled graph to its previous structure. Specifically, it first records the positions of the discarded nodes in the pooled graph in the original graph, fills the features on the discarded nodes with 0, and then puts the discarded nodes back to the corresponding positions in the original graph to obtain the restored graph. This process can be expressed as:
[0053]
[0054] in Represents the feature matrix of the graph obtained after the unpooling operation, where λ represents the feature dimension of the graph obtained after the unpooling operation. The unpooling operation can be specifically expressed as:
[0055]
[0056] where 0 N×C It is represented as a feature matrix initialized to 0, loc represents the index of the retained node in the pooling graph, and for The row vector containing the loc index is copied to 0 N×C At the corresponding position, other row vectors that do not contain the loc index remain unchanged at 0.
[0057] After performing the unpooling operation to obtain multiple graphs, the features of the corresponding nodes of each graph are added, and the vectors whose node features are all 0 are discarded.
[0058] Transformer: After obtaining the pyramid features, they are input into the transformer. The transformer in this embodiment is used to capture the long-range dependencies between nodes. First, a linear projection is applied to the pyramid representation to transform it into the transformer dimension, and layer normalization is used to normalize the pyramid representation. This can be expressed as:
[0059]
[0060] Where W is the learnable weight matrix, Represents the pyramid representation of node v. The embedding of projected node v is sent to the transformer, and the node representation update process can be expressed as:
[0061]
[0062] in denote the learnable query, key, and value matrices respectively, Θ denotes the number of attention heads, ∥ denotes concatenation, and d trans Represents the dimension of transformer. Output It will be passed to a feedforward neural network, which is used to enhance the feature expression capability, followed by a residual connection and a normalization layer. The above process can be expressed as:
[0063]
[0064] in In graph-level tasks, an embedding vector representing the entire graph is required. This embodiment adds a special CLS token to the sequence input to the transformer. The transformer performs a multi-head self-attention operation to calculate the attention value of the CLS token and other tokens. In this way, the CLS token of the corresponding sequence output by the transformer contains information about the entire graph. Finally, a multi-layer perceptron is used to complete the downstream task. This process can be expressed as follows:
[0065]
[0066] in Represents the representation of the entire graph, which is the pyramid representation output through multiple transformer layers, and y represents the output category.
[0067] In order to verify the effectiveness of the method in this embodiment, we selected A Collection of Benchmark Datasets for Learning with Graphs (TUDatasets), Benchmarking GNNs and Open Graph Benchmark (OGB) to carry out experiments.
[0068] The experiments used two graph learning benchmark datasets, three graph neural network benchmark datasets, and two open-source graph benchmark datasets. Among the graph learning benchmark datasets, NCI1 and NCI109 are chemical molecule datasets; among the graph neural network benchmark datasets, CIFAR10 and MNIST are image classification datasets, and ZINC is a chemical molecule dataset; among the open-source graph benchmark datasets, OGBG-MOLHIV is a chemical molecule dataset, and OGBG-CODE2 is a programming code dataset. Table 1 describes the details of each dataset.
[0069] NCI1 and NCI109 are datasets for screening compounds for anticancer activity against ovarian cancer cells and non-small cell lung cancer, respectively. Graphs in these datasets represent compound molecules, with nodes and edges representing atoms and chemical bonds, respectively. For each dataset, we randomly split it into training, validation, and test sets in an 8:1:1 ratio.
[0070] The ZINC dataset is a molecular graph dataset used to regress restricted solubility properties of molecules. It consists of 12,000 graphs from the commercial compound screening database ZINC. Each graph in the ZINC dataset has between 9 and 37 nodes. The feature of each node represents the type of heavy atom, with 28 possible atom types. Each edge in the graph represents a chemical bond, with three possible bond types. The ZINC dataset includes 10,000 training graphs, 1,000 validation graphs, and 1,000 test graphs.
[0071] CIFAR10 and MNIST use superpixels to transform image classification datasets into graph structures. Superpixels represent small, adjacent regions in an image with similar texture, brightness, and color features. These can be obtained using the SLIC technique. For each image sample, a neighborhood graph containing eight superpixels is constructed, with the maximum number of superpixels in CIFAR10 and MNIST being 150 and 75, respectively. The image datasets are split in the same way as the original CIFAR10 and MNIST datasets for image classification: the CIFAR10 dataset contains 45,000 training images, 5,000 validation images, and 5,000 test images. The MNIST dataset contains 55,000 training images, 5,000 validation images, and 10,000 test images. The 5,000 validation images in CIFAR10 and MNIST are randomly sampled from the training images.
[0072] ogbg-molhiv is a small molecular property prediction dataset from MoleculeNet. The molecules in the dataset are preprocessed using RDKit. Each graph represents a molecule, the nodes in the graph represent atoms, and the edges between the nodes represent chemical bonds. Its goal is to predict molecular properties, which is a binary classification problem. For example, it determines whether a molecule can inhibit the replication of HIV.
[0073] ogbg-code2 is a collection of Abstract Syntax Trees (ASTs) extracted from 450,000 Python methods, drawn from the 13,887 most popular projects on GitHub. The primary task of this dataset is to predict the subtokens that form a method from its AST representation, a task known as code summarization.
[0074] Table 1 Detailed information of the dataset
[0075]
[0076] The pyramid graph pooling transformer provided in this example is compared with multiple methods on a benchmark dataset, including basic graph neural network methods, classic global pooling and layered pooling methods, and the latest graph transformer methods. The graph neural network models used are mainly GCN, GIN, and GAT; the classic global pooling and layered pooling methods are mainly Set2Set, SortPool, SAGPool g 、SAGPool h ; The latest graph transformer methods include GT, GraphTrans, SAN, Graphormer, SAT and EGT.
[0077] This example is tested on a Tesla V100 (32GB) GPU. To ensure fairness in the experiment, we use the same parameter configuration as the previous method. Specifically, we use the adamW optimizer and a weight decay of 1e -5 The model was trained with a learning rate of 0.001. To reduce the number of parameters, the most basic Top-k pooling method was used. For each block, three different pyramid pooling ratios were set, with pooling ratios of 0.9, 0.6, and 0.3, respectively. The graph neural network encoding layer was set to three layers. The pooled features generated at each pooling ratio were passed through a layer-by-layer encoder network for encoding. Ten seeds were randomly selected and each experiment was run 10 times. The mean and standard deviation were used to evaluate the model.
[0078] The performance of pyramid graph pooling transformer on the graph learning benchmark dataset is shown in Table 2, where SAGPool g and SAGPool h Represent self-attention pooling using global pooling and hierarchical pooling architectures, respectively.
[0079] Table 2 Performance of pyramid graph pooling transformer on two graph learning benchmark datasets
[0080]
[0081] From Table 2 we have the following findings:
[0082] (1) and SortPool and SAGPool h In comparison, the pure transformer model performs worse than these two pooling methods on the graph learning benchmark dataset. The main reason is that the dataset size is relatively small, and directly applying the transformer to the graph data cannot bring out the performance of the transformer.
[0083] (2) The pyramid graph pooling transformer and GT methods perform better than pure transformer models on graph learning benchmark datasets. This is mainly because both the pyramid graph pooling transformer and GT adopt an architecture that combines graph neural networks and transformers, which can overcome the problem of poor performance of transformers on small-scale data.
[0084] (3) The pyramid graph pooling transformer achieved good performance on two graph learning benchmark datasets, outperforming conventional graph neural network methods, classic global pooling and layered pooling methods, and graph transformer methods.
[0085] The experimental results of the pyramid graph pooling transformer on the graph neural network benchmark dataset are shown in Table 3. The experimental results of the baseline method are from the results published in the article, and '-' indicates that they are not provided.
[0086] Table 3 Performance of pyramid graph pooling transformer on three graph neural network benchmark datasets
[0087]
[0088] By comparing with previous methods, the following conclusions can be drawn:
[0089] (1) Compared with the classic graph neural network model, the graph transformer performs better. This is mainly due to the fact that the graph transformer adopts the idea of self-attention, calculates the attention scores of all nodes, and can better capture long-distance dependencies.
[0090] (2) Compared with the graph transformer method, the pyramid graph pooling transformer has better performance. This is mainly because our method not only takes advantage of the transformer, but also uses the pyramid graph pooling operation to fuse more multi-scale features.
[0091] (3) The pyramid graph pooling transformer performs better than previous graph neural network methods and graph transformer methods on graph neural network benchmark datasets. This is mainly because the pyramid graph pooling transformer not only takes advantage of the graph neural network to capture local information and the graph transformer to capture global information, but also takes advantage of the pyramid pooling operation to extract multi-scale features.
[0092] To further verify the performance of the model, the pyramid graph pooling transformer is applied to the open source graph benchmark dataset. The experimental results are shown in Table 4.
[0093] Table 4 Performance of pyramid graph pooling transformer on two open source graph benchmark datasets
[0094]
[0095] GraphTrans and SAT are top-ranked methods on the open-source graph benchmark dataset ogbg-code2. Compared to them, the method in this embodiment maintains its leading edge, primarily due to the pyramid pooling operation, which not only reduces the number of nodes but also integrates multi-scale features. As the number of nodes in a graph increases, global information becomes extremely important, while GNNs struggle to capture information about distant nodes. Therefore, as the scale of graphs increases, the advantages of graph transformers become more apparent.
[0096] To verify the effectiveness of this method, this example also conducted an ablation experiment. The pyramid graph pooling transformer not only extracts multi-scale features but also reduces the length of node sequences in the transformer, lowering the computational complexity of the model. This ablation experiment evaluated the impact of the pyramid pooling operation on the model and ultimately removed it.
[0097] Table 5 Effects of pyramid pooling operation on ZINC and ogbg-code2 datasets
[0098]
[0099] As can be seen from Table 5, when the pyramid pooling transformer is removed, the performance of the model on ZINC and CIFAR10 decreases, which shows that the pyramid pooling operation can extract multi-scale features, and the fusion of multi-scale features can improve the performance of the model.
[0100] Graph neural networks are primarily used to capture local neighborhood information, while graph transformers are primarily used to capture global dependencies and extract information about distant nodes on the graph. To test the impact of the transformer module on the performance of the entire model, the relevant modules were removed from the pyramid pooling transformer. The pyramid pooling operation was used to obtain the representation of the fused node, which was then aggregated through the readout function to aggregate all node representations. A multi-layer perceptron was then used to complete the downstream task. The experimental results are shown in Table 6.
[0101] Table 6 Performance of Graph Transformer on two graph neural network benchmark datasets
[0102]
[0103] It can be observed from the table that when the transformer module is removed, the performance of the model decreases, which shows that the transformer plays an important role in extracting global information.
[0104] In summary, this embodiment addresses the problem that the limited receptive field of graph neural networks makes it difficult to capture the dependencies between distant nodes on the graph, and provides a graph-level data classification method based on a pyramid graph pooling transformer. The pyramid pooling transformer can not only reduce the length of the node sequence, but also extract multi-scale information. The pyramid pooling transformer is mainly divided into three modules: graph neural network, pyramid pooling, and transformer, among which the graph neural network mainly extracts local neighborhood information; pyramid pooling mainly extracts multi-scale information of the graph and reduces the length of the transformer sequence; and the transformer mainly extracts global information and captures long-distance dependencies between nodes. Experiments were conducted on graph learning benchmark datasets, graph neural network benchmark datasets, and open source graph benchmark datasets. The experimental results show that the pyramid graph pooling transformer can significantly improve the processing capabilities of graph-level representation learning methods on graph-level tasks.
[0105] Example 2
[0106] This embodiment provides an electronic device, including: one or more processors and a memory, wherein the memory stores one or more programs, and the one or more programs include instructions for executing the graph-level data classification method based on the pyramid graph pooling Transformer as described in Example 1.
[0107] Example 3
[0108] This embodiment provides a computer-readable storage medium, including one or more programs for execution by one or more processors of an electronic device, wherein the one or more programs include instructions for executing the graph-level data classification method based on the pyramid graph pooling Transformer as described in Example 1.
[0109] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and such modifications or substitutions are intended to be within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.
Claims
1. A graph-level data classification method based on pyramid graph pooling Transformer, characterized by: The steps include: Step S1: Obtain input graph-level data, use graph neural network to extract local neighborhood information of the graph, and obtain encoding features; Step S2: Based on the encoding features, multiple pooled graphs are obtained through multiple parallel graph pooling operations and upsampled respectively, and pyramid features are obtained by superimposing node features at corresponding positions of the graphs; Step S3: concatenate the pyramid features with the preset tokens and use a transformer to obtain an embedding vector representing the entire graph. Step S4: Based on the embedding vector, a multi-layer perception mechanism is used to obtain a graph-level data classification result. The step S2 includes the following sub-steps: Step S201, performing a plurality of pooling operations with different ratios on the coding features to obtain a plurality of upsampled pooled maps; Step S202: For each pooled graph, the nodes discarded in the upsampled pooled graph are obtained through graph convolution and depooling operations, the features corresponding to the discarded nodes are filled, and the discarded nodes are put back into the pooled graph to obtain a restored pooled graph. Step S203, add the corresponding nodes of each pooling graph to obtain the pyramid features, The graph-level data includes a set of nodes, a feature matrix of the nodes, and an adjacency matrix.
2. A graph-level data classification method based on pyramid graph pooling Transformer according to claim 1, characterized in that: In step S1, the hidden embedding of the current node is updated by aggregating the messages of the nodes in the neighborhood of the current node in the graph, thereby realizing the extraction of the local neighborhood information of the graph.
3. A graph-level data classification method based on pyramid graph pooling Transformer according to claim 2, characterized in that: The process of updating the hidden embedding of the current node with messages from nodes in the neighborhood of the current node in the aggregation graph is implemented as follows: in, Representation node The hidden embedding of is the number of layers of the local GNN network, represents the update of hidden layer embedding, Represents an aggregation operation, Representation node The set of neighbor nodes.
4. A graph-level data classification method based on pyramid graph pooling Transformer according to claim 1, characterized in that: In step S202, the process of obtaining the restored pooled graph through graph convolution and depooling operations is implemented using the following formula: in, Represents the feature matrix of the graph obtained after the unpooling operation, Indicates the feature dimension of the graph obtained after the unpooling operation, Represents the unpooling operation, represents the graph convolution operation, Indicates that Middle position Replace all features except ,in Represented as a feature matrix initialized to 0, represents the index of the retained node in the pooled graph, is the total number of nodes, is the feature dimension of the node.
5. A graph-level data classification method based on pyramid graph pooling Transformer according to claim 1, characterized in that: In step S3, the process of using the transformer to obtain the embedding vector of the entire graph includes: Step S301: Using the encoded feature as a query for a self-attention mechanism in a transformer, and the pyramid feature as a key and value of the self-attention mechanism in the transformer, to obtain a vector output by the self-attention mechanism; In step S302, the vector output by the self-attention mechanism is processed through a feedforward neural network, residual connection, and normalization to obtain the embedding vector of the entire graph.
6. A graph-level data classification method based on pyramid graph pooling Transformer according to claim 5, characterized in that: The embedding vector of the entire graph is obtained using the following formula: in, Representation node The pyramid representation of is the learnable weight matrix, Representation layer normalization operation, Represents a projection node Embedded, , , denote the learnable query, key, and value matrices respectively, represents the number of attention heads, Indicates splicing, represents the dimension of transformer, represents the softmax activation function, represents the concatenated output of multiple attention heads, is the vector output by the self-attention mechanism, is an intermediate representation, represents a feedforward network, is the embedding vector of the entire graph.
7. An electronic device, characterized in that: include: One or more processors and a memory, wherein the memory stores one or more programs, wherein the one or more programs include instructions for executing the graph-level data classification method based on the pyramid graph pooling Transformer as described in any one of claims 1-6.
8. A computer-readable storage medium, characterized in that It includes one or more programs for execution by one or more processors of an electronic device, wherein the one or more programs include instructions for executing the graph-level data classification method based on the pyramid graph pooling Transformer as described in any one of claims 1-6.