Conversion and classification prediction method for converting node classification into subgraph classification
Through improved random walk strategy and differentiated zero-filling strategy, anonymous inducing sub-graphs are generated for graph neural networks, and the traditional graph neural network is solved by using encoder based on the messaging framework and the maximum pooling aggregation feature representation. The problem of poor performance on different affinity pictures has achieved efficient classification prediction on homogeneous affinity pictures.
Patent Information
- Application Number
- CN202411527261.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The traditional graph neural network model performs poorly on heterogeneous graphs and is difficult to effectively fuse feature information of neighbors of different orders, resulting in low classification accuracy on heterogeneous graphs.
Anonymous induced subgraphs are generated for each node through an improved random walk strategy, and identity information is injected into the subgraph nodes based on the differentiated zero-filling strategy, and node information is encoded using a graph neural network encoder based on the message delivery framework. The feature representation is represented by a maximum pooling and feature scaling is performed using learnable factors, and category prediction is finally performed based on the feedforward neural network.
This method can effectively integrate sub-graph information with the features of a single node, dynamically adjust the feature weight, significantly improve the classification accuracy on homogeneous and heterogeneous graphs, alleviate label conflict problems, and improve the model's adaptability Capabilities and application prospects.
Smart Images

Figure CN119475019A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of graph neural network technology, and in particular to an efficient conversion and classification prediction method for converting node classification into subgraph classification. Background Art
[0002] Node classification is an important application of graph neural networks (GNNs). It aims to predict node categories based on the features of nodes in a graph and information about their neighbors. This task is of great significance in fields such as social network analysis, recommender systems, network security, and bioinformatics. By aggregating information about neighboring nodes, GNNs can effectively learn embedded representations of nodes, thereby improving classification accuracy. Node classification not only reveals relationships and patterns between nodes, supporting decision-making, but also identifies anomalous behavior, aids risk management, and promotes scientific research on biological networks. Therefore, node classification holds broad application prospects and enormous potential across various fields. However, traditional GNN models are often suitable for homologous graphs (i.e., connected nodes belong to the same class) and perform poorly on heterologous graphs, significantly limiting the development of graph learning. Therefore, numerous works have been devoted to alleviating this problem. One of the most common approaches is to consider how to fuse feature information from neighbors of different orders. For example, MixHop aggregates information from neighbors of different orders based on different powers of the adjacency matrix, and GCNII promotes the fusion of deeper information through initial residuals and identity mapping. There are also methods that emphasize improving feature aggregation through decoupling processes. For example, FSGNN decouples feature aggregation from network depth and uses softmax for feature selection. In H2GCN, this method separates self and neighbor embeddings while utilizing high-order neighborhoods. In addition, adaptive mechanisms are also adopted by methods such as ACM-GCN and GPR-GNN. The former uses adaptive channel mixing to extract richer local information, and the latter learns generalized PageRank weights to optimize the integration of node features and topology.
[0003] The node classification method in the existing technology models the classification task based on the node perspective, implicitly capturing the node dependency and the structural information of the neighbor subgraph through the cascading influence between adjacent nodes. The graph neural network model performs poorly on heterogeneous graphs and has not fundamentally alleviated the smoothing problem. Summary of the Invention
[0004] The purpose of the present invention is to provide a conversion and classification prediction method for converting node classification into subgraph classification in response to the deficiencies of the prior art. An improved random walk strategy is used to generate anonymized induced subgraphs for each node. Identity information is injected into subgraph nodes based on a differentiated zero-filling strategy. Node information is encoded using a graph neural network encoder based on a message passing framework. Feature representations of different layers of the central node and surrounding nodes are aggregated by maximum pooling. Different features are scaled using a learnable factor, and category prediction is performed based on a feedforward neural network. This method can effectively fuse subgraph information with the features of a single node and dynamically adjust feature weights based on the dependency between nodes and subgraphs in different data sets. Good results are achieved on both homologous and heterologous graphs, greatly alleviating the label conflict problem that exists in similar conversions, i.e., the same induced subgraph needs to be assigned different labels simply because the starting node type is different, resulting in the model being unable to distinguish and performance degradation. The method is simple, efficient and flexible, and can adaptively scale features based on the importance of different features on different data sets, ultimately achieving good results on both homologous and heterologous graphs, and has good application prospects.
[0005] The object of the present invention is achieved by providing a method for converting node classification into subgraph classification and classification prediction, wherein the method specifically comprises the following steps:
[0006] Step 1: Generate an anonymized induced subgraph for each node using an improved random walk strategy, converting the node classification dataset into a subgraph classification dataset. The improved random walk strategy starts from node v and randomly walks to the next node based on the directions of neighboring nodes and edges. This process is then iterated to obtain a walk sequence of a specified length. At the same time, at each walk, the algorithm returns to the starting point with a specified probability p and continues this process until the end.
[0007] Step 2: Inject identity information into subgraph nodes based on a differentiated zero-filling strategy.
[0008] Step 3: Encode the node information using the subgraph encoder GIN based on the message passing framework.
[0009] Step 4: Aggregate the feature representations of different layers of the central node and surrounding nodes through maximum pooling, and scale different features using learnable factors.
[0010] Step 5: Input the feature representation obtained in step 4 into the feedforward neural network to predict the subgraph label, and calculate the cross entropy loss between the predicted label and the true label. Based on this loss, adjust the model parameters and feature scaling factors.
[0011] The step 1 specifically includes:
[0012] 1.1: Starting from node v, randomly walk to the next node based on the direction of neighboring nodes and edges, and then iterate this process to obtain a walk sequence of specified length. At the same time, at each walk, with a specified probability p, return to the starting point and continue the process until the end.
[0013] 1.2: Get the subgraph g from the graph G according to the node index in the walk sequence, then randomly assign new indexes to the subgraph nodes while retaining the edge connection relationship to generate a new subgraph g'.
[0014] 1.3: Assign a label to the new subgraph g' that is the same as the starting node as the subgraph label, so that a node classification dataset can be converted into a new subgraph classification dataset.
[0015] The step 2 specifically includes:
[0016] 2.1: In each induced subgraph g', for each node's feature xi, if it is the starting node of the induced subgraph, a zero vector of the same length is spliced behind xi; otherwise, the zero vector is spliced with xi to obtain a new feature vector zi.
[0017] The step 3 specifically includes:
[0018] 3.1: Use k-layer subgraph encoder GIN to encode node information, the representation of node i in layer l As shown in the following formula (a):
[0019]
[0020] in, represents the representation of node i in the l-1 layer (i.e. the previous layer), ε (l) is a learnable parameter, and N(i) represents the neighbor nodes of node i in the subgraph g'.
[0021] The step 4 specifically includes:
[0022] 4.1: Aggregate the feature representations of different layers of the central node and surrounding nodes represented by (b) below through maximum pooling
[0023]
[0024] 4.2: The nodes in the subgraph g' are divided into the central node ego and the alter node. At the same time, because the zero vectors of equal length are filled in different positions, the aggregation operation will have different effects. Therefore, the front and back parts of each node are divided into left and right. The final representation of each node is h "# It is expressed by the following formula (c):
[0025] hfinal =α1·h ego-left ||α2·h ego-right ||α3·h pool-left ||α4·h pool-right ||(c).
[0026] Among them, α1…α4 are the scaling factors of each part of the features, which are initialized to 0.25 by default.
[0027] The step 5 specifically includes:
[0028] 5.1: Represent h in step 4 final Input the feedforward neural network to predict the subgraph label, and calculate the cross entropy loss between the predicted label and the true label. Based on this loss, adjust the graph neural network model parameters and feature scaling factors.
[0029] Compared with the prior art, the present invention has the following beneficial technical effects and significant technical progress:
[0030] 1) Strong modeling capabilities, which can better integrate node information with information of neighboring subgraphs. High adaptability, which can adaptively scale features based on the importance of different features in different data sets, ultimately achieving good results on both same-affinity and different-affinity graphs.
[0031] 2) The conversion method is more efficient and flexible, and can alleviate the label conflict problem that existed in previous similar conversion methods. That is, the same induced subgraph needs to be assigned different labels simply because the starting node types are different, resulting in the model being unable to distinguish and performance degradation. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 Flowchart of the present invention;
[0033] Figure 2 Schematic diagram of the specific operation of Example 1. DETAILED DESCRIPTION
[0034] See Figure 1 The present invention efficiently converts node classification into subgraph classification and classification prediction according to the following steps:
[0035] 1) Generate an anonymized induced subgraph for each node through an improved random walk strategy, and convert the node classification dataset into a subgraph classification dataset. The steps are as follows:
[0036] 1.1: Starting from node v, randomly walk to the next node based on the direction of neighboring nodes and edges, and then iterate this process to obtain a walk sequence of specified length. At the same time, at each walk, with a specified probability p, return to the starting point and continue the process until the end.
[0037] 1.2: Get the subgraph g from the graph G according to the node index in the walk sequence, then randomly assign new indexes to the subgraph nodes while retaining the edge connection relationship to generate a new subgraph g'.
[0038] 1.3: Assign a label to the new subgraph g' that is the same as the starting node as the subgraph label, so that a node classification dataset can be converted into a new subgraph classification dataset.
[0039] 2) Inject identity information into subgraph nodes based on a differentiated zero-filling strategy. The steps are as follows:
[0040] 2.1: In each induced subgraph g', for each node's feature xi, if it is the starting node of the induced subgraph, a zero vector of the same length is spliced behind xi; otherwise, the zero vector is spliced with xi to obtain a new feature vector zi.
[0041] 3) Use the subgraph encoder GIN based on the message passing framework to encode node information. The steps are as follows:
[0042] 3.1: Use k-layer subgraph encoder GIN to encode node information, the representation of node i in layer l The following formula (a) is expressed as:
[0043]
[0044] in, represents the representation of node i in the l-1 layer (i.e. the previous layer), ε (l) is a learnable parameter, N(i) represents the neighbor nodes of node i in the subgraph g'.
[0045] 4) Aggregate the feature representations of different layers of the central node and surrounding nodes through maximum pooling, and use learnable factors to scale different features. The steps are as follows:
[0046] 4.1: Through maximum pooling, the following (b) represents the feature representation of different layers of the central node and surrounding nodes.
[0047]
[0048] 4.2: The nodes in the subgraph g' are divided into the central node ego and the alter node. At the same time, because the zero vectors of equal length are filled in different positions, the aggregation operation will have different effects. Therefore, the front and back parts of each node are divided into left and right. The final representation of each node is h final It is expressed by the following formula (c):
[0049] h final =α1·hego-left ||α2·h ego-right ||α3·h pool-left ||α4·h pool-right ||(c).
[0050] Among them, α1…α4 are the scaling factors of each part of the features, which are initialized to 0.25 by default.
[0051] 5) Input the representation obtained in step 4 into the feedforward neural network to predict the subgraph label and calculate the cross entropy loss between the predicted label and the true label. Based on this loss, adjust the model parameters and feature scaling factors. The steps are as follows:
[0052] 5.1: The feature representation obtained in step 4 is h final Input the feedforward neural network to predict the subgraph label, and calculate the cross entropy loss between the predicted label and the true label, and adjust the model parameters and feature scaling factors based on the loss.
[0053] The present invention will be further described below with reference to specific embodiments and accompanying drawings:
[0054] Example 1
[0055] See Figure 2 , an anonymized induced subgraph is generated for each node through an improved random walk strategy, identity information is injected into the subgraph nodes based on a differentiated zero-filling strategy, node information is encoded using a graph neural network encoder based on a message passing framework, feature representations of different layers of the central node and surrounding nodes are aggregated through maximum pooling, different features are scaled using a learnable factor, and finally category prediction is performed based on a feedforward neural network. The specific steps are as follows:
[0056] Step 1: Generate an anonymized induced subgraph for each node through an improved random walk strategy, and convert the node classification dataset into a subgraph classification dataset, specifically including:
[0057] 1.1: Starting from node v, randomly walk to the next node based on the direction of neighboring nodes and edges, and then iterate this process to obtain a walk sequence of specified length. At the same time, at each walk, with a specified probability p, return to the starting point and continue the process until the end.
[0058] 1.2: Get the subgraph g from the graph G according to the node index in the walk sequence, then randomly assign new indexes to the subgraph nodes while retaining the edge connection relationship to generate a new subgraph g'.
[0059] 1.3: Assign a label to the new subgraph g' that is the same as the starting node as the subgraph label, so that a node classification dataset can be converted into a new subgraph classification dataset.
[0060] Step 2: Inject identity information into subgraph nodes based on a differentiated zero-filling strategy, specifically including:
[0061] 2.1: In each induced subgraph g', for each node's feature xi, if it is the starting node of the induced subgraph, a zero vector of the same length is spliced behind xi; otherwise, the zero vector is spliced with xi to obtain a new feature vector zi.
[0062] Step 3: Encode the node information using the subgraph encoder GIN based on the message passing framework, specifically including:
[0063] 3.1: Use k-layer subgraph encoder GIN to encode node information, the representation of node i in layer l It is expressed as follows (a):
[0064]
[0065] in, represents the representation of node i in the l-1 layer (i.e. the previous layer), ε () is a learnable parameter, and N(i) represents the neighbor nodes of node i in the subgraph g'.
[0066] Step 4: Aggregate the feature representations of the central node and surrounding nodes at different layers through maximum pooling, and use learnable factors to scale different features, including:
[0067] 4.1: Aggregate the feature representations of different layers of the central node and surrounding nodes represented by (b) below through maximum pooling
[0068]
[0069] 4.2: The nodes in the subgraph g' are divided into the central node ego and the alter node. At the same time, because the zero vectors of equal length are filled in different positions, the aggregation operation will have different effects. Therefore, the front and back parts of each node are divided into left and right. The final representation of each node is h final It is expressed by the following formula (c):
[0070] h final =α1·h ego-left ||α2·h ego-right ||α , ·h pool-left ||α4·h pool-right ||(c).
[0071] Among them, α1…α4 is the scaling factor of each part feature, which is initialized to 0.25 by default.
[0072] 5) The feature representation h obtained in step 4 final Input the feedforward neural network to predict the subgraph label, and calculate the cross entropy loss between the predicted label and the true label, and adjust the model parameters and feature scaling factors based on the loss.
[0073] The above is only a further explanation of the present invention and is not intended to limit this patent. Any equivalent implementation of the present invention should be included in the scope of the claims of this patent.
Claims
1. A method for converting node classification into subgraph classification and classification prediction, characterized in that: The method specifically comprises the following steps: Step 1: A random walk strategy is used to generate an anonymized induced subgraph for each node, and the node classification data set is converted into a subgraph classification data set. The random walk strategy is to start from node v, randomly walk to the next node according to the direction of neighboring nodes and edges, and then iterate the process to obtain a walk sequence of a specified length. At each walk, the specified probability p is returned to the starting point and the process is continued until the end; Step 2: Use a differentiation-based zero-filling strategy to inject identity information into subgraph nodes; Step 3: Encode node information using the subgraph encoder GIN based on the message passing framework; Step 4: Use maximum pooling to aggregate the feature representations of different layers of the central node and surrounding nodes, and use learnable factors to scale different features to obtain feature representations Step 5: Represent the features Input the feedforward neural network to predict the subgraph label, and calculate the cross entropy loss between the predicted label and the true label. According to the loss, adjust the graph neural network model parameters and feature scaling factors.
2. The method for converting node classification into subgraph classification and classification prediction according to claim 1, characterized in that: The step 1 specifically includes: 1.1: Starting from node v, randomly walk to the next node according to the direction of neighboring nodes and edges, and then iterate the process to obtain a walk sequence of specified length. At each walk, return to the starting point with a specified probability p and continue the process until the end; 1.2: Get subgraph g from graph G according to the node index in the walk sequence, then randomly assign new indexes to subgraph nodes while retaining edge connections to generate a new subgraph g'; 1.3: Assign a label that is the same as the starting node as the subgraph label to the new subgraph g'; thus converting a node classification dataset into a new subgraph classification dataset.
3. The method for converting node classification into subgraph classification and classification prediction according to claim 1, characterized in that: The step 2 specifically includes: 2.1: In each induced subgraph g', for each node's feature xi, if it is the starting node of the induced subgraph, a zero vector of the same length is spliced behind xi; otherwise, the zero vector is spliced with xi to obtain a new feature vector zi.
4. The method for converting node classification into subgraph classification and classification prediction according to claim 1, characterized in that: The step 3 specifically includes: 3.1: Use k-layer subgraph encoder GIN to encode node information, the representation of node i in layer l It is expressed by the following formula (a): in, is the representation of node i in layer l-1, i.e. the previous layer; ε () is a learnable parameter; N(i) is the neighbor node of node i in the subgraph g'.
5. The method for converting node classification into subgraph classification and classification prediction according to claim 1, characterized in that: The step 4 specifically includes: 4.1: Aggregate the feature representations of different layers of the central node and surrounding nodes represented by (b) below through maximum pooling 4.2: Divide the nodes in the subgraph g' into the central node ego and the alter node, and divide the front and back parts of each node into left and right. The final representation of each node is h "# It is expressed by the following formula (c): h " # =α·h %go %"( ||α2·h %go r g+( ||α , ·h -” %"( ||α . ·h -” r g+( || (c); Among them, α……α . are the scaling factors of each feature.
6. The method for converting node classification into subgraph classification and classification prediction according to claim 1, characterized in that: The step 5 specifically includes: 5.1: The final representation h "# Input the feedforward neural network to predict the subgraph label, calculate the cross entropy loss between the predicted label and the true label, and adjust the graph neural network model parameters and feature scaling factors based on the loss.
Citation Information
Patent Citations
Compound property prediction method based on subgraph network and comparative learning
CN115511145A