Graph node classification method for center node feature enhancement and information aggregation
Through the central node feature enhancement and information aggregation method, combining the output of local and global modules, differential constraints are introduced, which solves the limitations and excessive smoothness of graph neural networks in node classification, and improves the robustness and accuracy of the model Rate.
Patent Information
- Application Number
- CN202411514970.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2024-11-26
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
It is difficult for shallow graph neural networks to effectively extract local and global information of the graph, while the deep graph neural networks are overly smooth, resulting in poor node classification results.
The graph node classification method of central node feature enhancement and information aggregation is adopted. By constructing the central node feature enhancement graph convolution network module and the multi-hop neighbor information aggregation module based on the multi-scale linear attention mechanism, it is weighted in combination with the output of local and global modules. Fusion and introduce a differential constraint loss function optimization model.
The robustness and accuracy of graph neural networks are improved at a lower complexity, effectively improving the node classification effect, and overcoming the limitations of shallow networks and the excessive smoothness of deep networks.
Smart Images

Figure CN119025978A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of graph node classification algorithms, and specifically relates to a graph node classification method for central node feature enhancement and information aggregation. Background Art
[0002] Graph Neural Networks (GNN) is a deep learning method designed for processing and analyzing graph structured data. A graph consists of nodes and edges, where nodes represent entities and edges represent relationships between entities. The goal of a graph neural network is to learn the features of nodes and edges, build a mathematical model, and reveal the complex relationships and dynamic characteristics of the graph. Its core principle is to update the feature representation of nodes layer by layer through a message passing mechanism, thereby capturing local and global information in the graph.
[0003] Graph neural networks can be simply classified into shallow graph neural networks and deep graph neural networks. Shallow graph neural networks have certain limitations in information propagation and feature aggregation, which leads to their limited ability to capture complex relationships in the graph. When applied to large-scale graph structure networks, it is difficult to effectively extract local and global information of the graph. At the same time, the use of traditional attention mechanisms to extract local and global information of the graph has the defect of high computational complexity in large-scale graph networks. Deep graph neural networks increase the number of network layers, allowing information to propagate farther in the graph, so that the global structure and complex relationships of the graph can be learned more comprehensively. However, general deep graph neural networks will cause over-smoothing, making the features of graph nodes tend to be consistent, which limits the improvement of node classification effect. Summary of the invention
[0004] The technical problem to be solved by the present invention is to overcome the defects in the prior art that shallow graph neural networks cannot effectively extract local and global information of graphs and that deep graph neural networks have poor classification effect due to over-smoothness, thereby providing a graph node classification method with central node feature enhancement and information aggregation.
[0005] The present invention provides a graph node classification method for central node feature enhancement and information aggregation, comprising the following method steps: Step S1: constructing a node feature matrix, an adjacency matrix and a structure vector matrix based on graph structure data; Step S2: constructing a central node feature enhanced graph convolutional network module based on the node feature matrix and the adjacency matrix, wherein the central node feature enhanced graph convolutional network module includes a graph neural network layer with a message passing mechanism, and the central node feature enhanced graph convolutional network module calculates and forms an output node feature matrix; Step S3: constructing a multi-hop neighbor information aggregation module based on a multi-scale linear attention mechanism based on the output node feature matrix, and calculating the output matrix of the multi-hop neighbor information aggregation module; Step S4: weighted fusion of local module output and global module output to obtain the final output of the model; perform node classification prediction and verify the accuracy of the model; construct a loss function based on the final output, and optimize the model based on the loss function.
[0006] Furthermore, in step S1, The graph structure data includes n nodes and m edges, which can be expressed as: ; in, Representation diagram, represents a collection of nodes, where , Represents a node in the graph, represented by represents a set of edges, where , Represents an edge between two nodes in the graph; The node feature matrix is The matrix is expressed as: ; in, is the number of nodes, is the dimension of node features, Representation Node The eigenvector of The adjacency matrix for Square matrix, represented by: ; in Representation Node and nodes The connection relationship between nodes and nodes If there is an edge between ;otherwise, ; The structure vector matrix includes the structure vector of each node, and the structure vector is expressed as: ; in, They represent the node's degree, betweenness centrality, closeness centrality, eigenvector centrality, and PageRank, respectively.
[0007] Furthermore, in step S2, the graph neural network layer includes an aggregation phase and a combination phase, including: S2.1: In the aggregation phase, the nodes of the graph structure data aggregate the information of their neighbor nodes to form a neighbor message aggregation vector, which is expressed as: ; in, Indicates Layer Node Neighbor message aggregation vector; Indicates Neighbor message aggregation function of the layer, Representation Node The set of neighbor nodes of Indicates Layer Neighbor Node The feature representation of S2.2: In the combination stage, the neighbor message aggregation vector is combined with its upper self-representation to form a node feature vector, which is expressed as: ; in, Indicates The node feature vector of the layer, Indicates The layer fuses its own information and the combined function of the aggregated message.
[0008] Furthermore, in step S2.1, the neighbor message aggregation function is a weighted aggregation function, which is specifically expressed as: ; in, for Activation function, is the normalization factor.
[0009] Furthermore, in step S2.2, the combined function of the self-information and the aggregated message is specifically expressed as: ; in, Indicates The output node feature matrix of the layer, represents the updated gating weight vector; ; in, Represents the gate weight vector, the initial value is all zero vector; ; in, Represents the activation function.
[0010] Furthermore, step S3 includes the following method steps: Step S3.1: Perform a linear transformation on the output node feature matrix to obtain a query matrix and a key value matrix: ; ; in, Indicates The output node feature matrix of the layer, and Respectively represent the input-output linear mapping function, represents the query matrix, represents a key-value matrix; Step S3.2: Concatenate the query matrix and the structure vector matrix to form a weight vector: ; in, represents the activation function, represents the weight matrix; Step S3.3: The weight matrix is multiplied by the query matrix to form the node weight: ; in, represents the node weight; Step S3.4: Node weights perform weighted summation on the feature vectors of each node in the query matrix to obtain a global query vector: ; in, represents the global query vector, Represents a collection of node weights; Step S3.5: Perform a broadcast product operation on the global query vector and the key value matrix to obtain the node feature matrix: ; in, represents the node feature matrix; Step S3.6: Add the neighbor node feature matrix to the query matrix to obtain the output of the multi-hop neighbor information aggregation module: ; ; in, represents the output of the multi-hop neighbor information aggregation module, represents the output of the multi-hop neighbor information aggregation module at different scales, , as well as Represents a hyperparameter scalar weight.
[0011] Furthermore, in step S4, the calculation method of the final output is: ; in, Represents the node matrix of the final output, It indicates that the central node feature enhancement graph convolutional network module calculates and forms an output node feature matrix, represents the output matrix of the multi-hop neighbor information aggregation module, Represents a scalar weight with values in the range (0, 1).
[0012] Furthermore, the step S4 also includes the following method steps: Step S4.1: The final output node matrix is passed through the classifier layer to predict the node classification and organize it into a probability distribution in which the sum of all element probabilities is 1: ; ; in, represents the output matrix of the multi-hop neighbor information aggregation module, represents the probability vector, vector The elements, Represents the output vector The elements, represents the exponential sum of all elements; Step S4.2: Compare the probability distribution with the true node label and calculate the cross entropy loss: ; in, represents the number of samples, Indicates The true labels of samples, Represents the model for The predicted probability of samples; Step S4.3: Through the back-propagation algorithm, adjust the model parameters to reduce the cross entropy loss.
[0013] Furthermore, the method also includes the following steps: Based on the central node feature enhancement graph convolutional network module, the output node feature matrix and the output matrix of the multi-hop neighbor information aggregation module are calculated to aggregate global-local node features, including the following method steps: Step S4.3: Calculate the cross entropy loss: ; Step S4.4: construct a loss function based on the cross entropy loss, and update the model parameters based on the gradient of the loss function: ; in, Represents the feature vector matrix of the last layer output of the central node feature enhanced graph convolutional network module , represents the square of the F norm, N represents the number of nodes, represents the difference constraint loss; represents the cross entropy loss, represents the hyperparameter, Represents the loss function.
[0014] Beneficial effects: The present invention provides a graph node classification method with central node feature enhancement and information aggregation. For complex graph structures, a central node feature enhancement graph convolutional network module and a multi-hop neighbor information aggregation module based on a multi-scale linear attention mechanism are constructed. The local module output and the global module output are weightedly fused and output to achieve multi-level fusion and enhancement of node features. At the same time, the difference constraints of the global-local modules are introduced, and the loss function is constructed to further guide model learning and optimization, so as to achieve a graph neural network model with higher robustness and accuracy under a lower complexity model, effectively improving the node classification effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0016] Figure 1 The figure is a schematic block diagram of the method flow of the present invention. DETAILED DESCRIPTION
[0017] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present application, so the present application is not limited by the specific embodiments disclosed below. Reference Figure 1 As shown, this embodiment provides a graph node classification method for central node feature enhancement and information aggregation, which specifically includes the following method steps: Step S1: constructing a node feature matrix, an adjacency matrix and a structure vector matrix based on graph structure data; In step S1, The graph structure data includes n nodes and m edges, which can be expressed as: ; in, Representation diagram, represents a collection of nodes, where , Represents a node in the graph, represented by represents a set of edges, where , Represents an edge between two nodes in the graph; The node feature matrix is The matrix is expressed as: ; in, is the number of nodes, is the dimension of node features, Representation Node The eigenvector of The adjacency matrix for Square matrix, represented by: ; in Representation Node and nodes The connection relationship between nodes and nodes If there is an edge between ;otherwise, ; The structure vector matrix includes the structure vector of each node, and the structure vector is expressed as: ; in, They represent the node's degree, betweenness centrality, closeness centrality, eigenvector centrality, and PageRank, respectively.
[0018] Step S2: constructing a central node feature enhanced graph convolutional network module based on the node feature matrix and the adjacency matrix, wherein the central node feature enhanced graph convolutional network module includes a graph neural network layer with a message passing mechanism, and the central node feature enhanced graph convolutional network module calculates and forms an output node feature matrix; In step S2, the graph neural network layer includes an aggregation phase and a combination phase, including: S2.1: In the aggregation phase, the nodes of the graph structure data aggregate the information of their neighbor nodes to form a neighbor message aggregation vector, which is expressed as: ; in, Indicates Layer Node Neighbor message aggregation vector; Indicates Neighbor message aggregation function of the layer, Representation Node The set of neighbor nodes of Indicates Layer Neighbor Node The feature representation of S2.2: In the combination stage, the neighbor message aggregation vector is combined with its upper self-representation to form a node feature vector, which is expressed as: ; in, Indicates The node feature vector of the layer, Indicates The combined function of the layer fusion of its own information and aggregated messages can effectively fuse its own information and aggregated messages.
[0019] In step S2.1, the neighbor message aggregation function is a weighted aggregation function, which is specifically expressed as: ; in, for Activation function, is a normalization factor used to balance the impact of the number of neighbors of different nodes on the aggregation results. In this embodiment, the normalization process helps to reduce the deviation of the node degree on the result, thereby making the feature aggregation more fair. Neighbor message aggregation vector It is obtained by weighted summing of all neighbor node features, where the weights are affected by the degree of the neighbor nodes, thus ensuring that each neighbor's contribution to the aggregation result is relatively balanced.
[0020] In step S2.2, the combined function of the self-information and the aggregated message is specifically expressed as: ; in, Indicates The output node feature matrix of the layer, represents the updated gating weight vector; ; in, Represents the gate weight vector, the initial value is all zero vector; ; in, Represents the activation function.
[0021] In this embodiment, step S2.2 converts the Layer node neighbor message aggregation vector With Layer feature vector The column dimensions are concatenated to form a new feature vector. The concatenated vector is used as input and processed by a multi-layer neural network to obtain a gated weight vector. , the weight vector is used to measure and adjust and The importance of the combination process can ensure the stability of the calculation and the reasonable distribution of weights.
[0022] Step S2.2 uses a weighted approach to combine neighbor features and the previous layer features The organic combination realizes the multi-level aggregation and enhancement of node features. Through this central node feature enhancement mechanism, the multi-level feature information of the node can be better captured and utilized, improving the accuracy of feature expression and the performance of the model.
[0023] Step S3: constructing a multi-hop neighbor information aggregation module based on a multi-scale linear attention mechanism based on the output node feature matrix, and calculating the output matrix of the multi-hop neighbor information aggregation module; The step S3 comprises the following method steps: Step S3.1: Perform a linear transformation on the output node feature matrix to obtain a query matrix and a key value matrix: ; ; in, Indicates The output node feature matrix of the layer, and Respectively represent the input-output linear mapping function, represents the query matrix, represents a key-value matrix; and Specifically, two different linear neural network mapping functions are represented to transform input data into output data.
[0024] Step S3.2: Concatenate the query matrix and the structure vector matrix to form a weight vector: ; in, represents the activation function, represents the weight matrix; Step S3.3: The weight matrix is multiplied by the query matrix to form the node weight: ; in, Represents the node weight, with a dimension of 1×1, used to represent the The importance of each node in the graph; Step S3.4: Node weights perform weighted summation on the feature vectors of each node in the query matrix to obtain a global query vector: ; in, represents the global query vector, with dimension 1×d, Represents a collection of node weights; Step S3.5: Perform a broadcast product operation on the global query vector and the key value matrix to obtain the node feature matrix: ; in, represents the node feature matrix; The symbol denotes broadcast multiplication.
[0025] Step S3.6: Add the neighbor node feature matrix to the query matrix to obtain the output of the multi-hop neighbor information aggregation module: ; ; in, represents the output of the multi-hop neighbor information aggregation module, represents the output of the multi-hop neighbor information aggregation module at different scales, , as well as Represents the hyperparameter scalar weight with a value range of (0, 1). Its value is manually set during model training. The output matrix of the multi-hop neighbor information aggregation module at three scales , , 1, 2, and 3 are used to represent them respectively. In this embodiment, The calculation of introduces a residual mechanism, which can alleviate the gradient vanishing and gradient exploding problems caused by the increase of network depth.
[0026] Step S4: weighted fusion of local module output and global module output to obtain the final output of the model; perform node classification prediction and verify the accuracy of the model; construct a loss function based on the final output, and optimize the model based on the loss function.
[0027] In step S4, the calculation method of the final output is: ; in, Represents the node matrix of the final output, It indicates that the central node feature enhancement graph convolutional network module calculates and forms the output node feature matrix, represents the output matrix of the multi-hop neighbor information aggregation module, Represents a scalar weight whose value range is in (0, 1) and whose value is manually set during model training.
[0028] Furthermore, the step S4 also includes the following method steps: Step S4.1: Pass the final output node matrix through the classifier layer to predict the node classification and organize it into a probability distribution where the sum of all element probabilities is 1: ; ; in, represents the output matrix of the multi-hop neighbor information aggregation module, represents the probability vector, vector The elements, Represents the output vector The elements, Represents the exponential sum of all elements, which is used to ensure that the sum of the output probability distribution is 1.
[0029] Step S4.2: Compare the probability distribution with the true node label and calculate the cross entropy loss: ; in, represents the number of samples, Indicates The true labels of samples, Represents the model for The predicted probability of samples; Step S4.3: Through the back-propagation algorithm, adjust the model parameters to reduce the cross entropy loss.
[0030] In this embodiment, the introduction of cross entropy loss can minimize the difference between the predicted distribution and the true distribution, making the prediction results of the model more accurate.
[0031] As a further improvement of this embodiment, the following method steps are also included: Based on the central node feature enhancement graph convolutional network module, the output node feature matrix and the output matrix of the multi-hop neighbor information aggregation module are calculated to aggregate global-local node features, including the following method steps: Step S4.3: Calculate the cross entropy loss: ; Step S4.4: construct a loss function based on the cross entropy loss, and update the model parameters based on the gradient of the loss function: ; in, Represents the feature vector matrix of the last layer output of the central node feature enhanced graph convolutional network module , represents the square of the F norm, N represents the number of nodes, represents the difference constraint loss; represents the cross entropy loss, Represents a hyperparameter with a value range of (0-1) and is manually set during model training. Represents the loss function.
[0032] In this example, the cross entropy loss is constructed With the difference constraint loss The model focuses not only on correctly classifying graph nodes during training, but also on learning differentiated feature representations that reflect the global and local structures of nodes in the graph. , the model can better understand and utilize the structural information in the graph, thereby improving the performance on the graph node classification task. During the model training process, the model parameters are updated according to the gradient of the loss function L through the gradient descent optimization algorithm.
[0033] This embodiment provides a graph node classification method for central node feature enhancement and information aggregation. For complex graph structures, a central node feature enhancement graph convolutional network module and a multi-hop neighbor information aggregation module based on a multi-scale linear attention mechanism are constructed. The local module output and the global module output are weighted and fused to output, so as to achieve multi-level fusion and enhancement of node features. At the same time, the difference constraints of the global-local modules are introduced, and the loss function is constructed to further guide model learning and optimization, so as to achieve a graph neural network model with higher robustness and accuracy under a lower complexity model, thereby effectively improving the node classification effect.
[0034] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0035] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the patent application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent application shall be subject to the attached claims.
Claims
1. A graph node classification method with central node feature enhancement and information aggregation, characterized in that: The method comprises the following steps: Step S1: constructing a node feature matrix, an adjacency matrix and a structure vector matrix based on graph structure data; Step S2: constructing a central node feature enhanced graph convolutional network module based on the node feature matrix and the adjacency matrix, wherein the central node feature enhanced graph convolutional network module includes a graph neural network layer with a message passing mechanism, and the central node feature enhanced graph convolutional network module calculates and forms an output node feature matrix; Step S3: constructing a multi-hop neighbor information aggregation module based on a multi-scale linear attention mechanism based on the output node feature matrix, and calculating the output matrix of the multi-hop neighbor information aggregation module; Step S4: weighted fusion of the output of the central node feature enhanced graph convolutional network module and the output of the multi-hop neighbor information aggregation module to obtain the final output of the model; perform node classification prediction and verify the accuracy of the model; construct a loss function based on the final output, and optimize the model based on the loss function.
2. According to claim 1, a graph node classification method for central node feature enhancement and information aggregation is characterized in that: In step S1, The graph structure data includes n nodes and m edges, which can be expressed as: ; in, Representation diagram, represents a collection of nodes, where , Represents a node in the graph, represented by represents a set of edges, where , Represents an edge between two nodes in the graph; The node feature matrix is The matrix is expressed as: ; in, is the number of nodes, is the dimension of node features, Representation Node The eigenvector of The adjacency matrix for Square matrix, represented by: ; in Representation Node and nodes The connection relationship between nodes and nodes If there is an edge between ;otherwise, ; The structure vector matrix includes the structure vector of each node, and the structure vector is expressed as: ; in, They represent the node's degree, betweenness centrality, closeness centrality, eigenvector centrality, and PageRank, respectively.
3. According to claim 1, a graph node classification method for central node feature enhancement and information aggregation is characterized in that: In step S2, the graph neural network layer includes an aggregation phase and a combination phase, including: S2.1: In the aggregation phase, the nodes of the graph structure data aggregate the information of their neighbor nodes to form a neighbor message aggregation vector, which is expressed as: ; in, Represents the central node feature enhanced graph convolutional network module Layer Node Neighbor message aggregation vector; Indicates Neighbor message aggregation function of the layer, Representation Node The set of neighbor nodes of Indicates Layer Neighbor Node The feature representation of S2.2: In the combination stage, the neighbor message aggregation vector is combined with its upper self-representation to form a node feature vector, which is expressed as: ; in, Represents the central node feature enhanced graph convolutional network module The node feature vector of the layer, Indicates The layer fuses its own information and the combined function of the aggregated message.
4. According to claim 3, a graph node classification method for central node feature enhancement and information aggregation is characterized in that: In step S2.1, the neighbor message aggregation function is a weighted aggregation function, which is specifically expressed as: ; in, for Activation function, is the normalization factor.
5. According to claim 3, a graph node classification method for central node feature enhancement and information aggregation is characterized in that: In step S2.2, the combined function of the self-information and the aggregated message is specifically expressed as: ; in, Indicates The output node feature matrix of the layer, represents the updated gating weight vector; ; in, Represents the gate weight vector, the initial value is all zero vector; ; in, Represents the activation function.
6. A graph node classification method for central node feature enhancement and information aggregation according to claim 1, characterized in that: The step S3 comprises the following method steps: Step S3.1: Perform a linear transformation on the output node feature matrix to obtain a query matrix and a key value matrix: ; ; in, Indicates The output node feature matrix of the layer, and Respectively represent the input-output linear mapping function, represents the query matrix, represents a key-value matrix; Step S3.2: Concatenate the query matrix and the structure vector matrix to form a weight vector: ; in, represents the activation function, represents the weight matrix; Step S3.3: The weight matrix is multiplied by the query matrix to form the node weight: ; in, represents the node weight; Step S3.4: Node weights perform weighted summation on the feature vectors of each node in the query matrix to obtain a global query vector: ; in, represents the global query vector, Represents a collection of node weights; Step S3.5: Perform a broadcast product operation on the global query vector and the key value matrix to obtain the node feature matrix: ; in, represents the node feature matrix; Step S3.6: Add the neighbor node feature matrix to the query matrix to obtain the output of the multi-hop neighbor information aggregation module: ; ; in, represents the output of the multi-hop neighbor information aggregation module, represents the output of the multi-hop neighbor information aggregation module at different scales, , as well as Represents a hyperparameter scalar weight.
7. A graph node classification method for central node feature enhancement and information aggregation according to claim 1, characterized in that: In step S4, the calculation method of the final output is: ; in, Represents the node matrix of the final output, It indicates that the central node feature enhancement graph convolutional network module calculates and forms the output node feature matrix, represents the output matrix of the multi-hop neighbor information aggregation module, Represents a scalar weight with values in the range (0, 1).
8. A graph node classification method for central node feature enhancement and information aggregation according to claim 1, characterized in that: The step S4 also includes the following method steps: Step S4.1: Pass the final output node matrix through the classifier layer to predict the node classification and organize it into a probability distribution where the sum of all element probabilities is 1: ; ; in, represents the output matrix of the multi-hop neighbor information aggregation module, represents the probability vector, vector The elements, Represents the output vector The elements, represents the exponential sum of all elements; Step S4.2: Compare the probability distribution with the true node label and calculate the cross entropy loss: ; in, represents the number of samples, Indicates The true labels of samples, Represents the model for The predicted probability of samples; Step S4.3: Through the back-propagation algorithm, adjust the model parameters to reduce the cross entropy loss.
9. A graph node classification method for central node feature enhancement and information aggregation according to claim 1, characterized in that: The following method steps are also included: Based on the central node feature enhancement graph convolutional network module, the output node feature matrix and the output matrix of the multi-hop neighbor information aggregation module are calculated to aggregate global-local node features, including the following method steps: Step S4.3: Calculate the cross entropy loss: ; Step S4.4: construct a loss function based on the cross entropy loss, and update the model parameters based on the gradient of the loss function: ; in, Represents the feature vector matrix of the last layer output of the central node feature enhanced graph convolutional network module , represents the square of the F norm, N represents the number of nodes, represents the difference constraint loss; represents the cross entropy loss, represents the hyperparameter, represents the loss function.
Citation Information
Cited By
Active classification method and system supporting RPA and based on graph neural network
CN119598352A
