Node classification model acquisition method, electronic equipment and storage medium
By using Dirichlet distribution sampling attention weights in the graph neural network and updating node characteristics, the oversmoothing problem in the graph neural network is solved, and the accuracy of node classification and model stability are improved.
Patent Information
- Application Number
- CN202411309666.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2024-12-13
AI Technical Summary
Existing graph neural networks are prone to oversmoothing when processing graph structure data, resulting in the node representation tending to be consistent, affecting the performance of node classification. Existing regularization methods such as Dropout strategy still have information after multi-layer graph convolution. deviation.
By obtaining the graph data set and dividing the training, verification and test sets, using the graph neural network to obtain the fixed attention weight of the node, constructing the Dirichlet distribution to extract the random attention weight, as the convergence factor of the graph convolution layer, and updating the node characteristics Vectors control the variance of node feature representation to alleviate the oversmoothing problem.
The accuracy of node classification is improved, and the excessive smoothing problem caused by stacking multi-layer graph convolutional layers is avoided, while the original features is not lost, which enhances the stability and performance of the model.
Smart Images

Figure CN119128604A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to a node classification model acquisition method, electronic equipment and storage medium. Background Art
[0002] Close associations between data are ubiquitous, such as social networks, citation networks, and biological networks. Graph-structured data usually includes topological relationships between nodes and the attributes of nodes, which can well represent the association characteristics between data. As a non-Euclidean structured data, the complex associations between graph data put forward higher requirements on existing deep learning models and machine learning algorithms. Unlike regular Euclidean data such as images, the order of nodes in graphs is not fixed, and the number of neighbors of nodes varies. Early methods for learning on graphs were mainly based on recurrent neural networks. These methods include a process of iteratively propagating node features until the node features reach a stable point. At present, graph neural networks have achieved great success in graph machine learning as an effective graph embedding tool. In particular, graph convolutional networks (GCNs) have received widespread attention and play a fundamental role in the subsequent development of graph neural networks. Graph convolution updates node features by aggregating neighborhood information. Compared with recursion-based methods, GCNs are more efficient in learning graph-structured data. However, after stacking multiple layers of graph convolution blocks, over-smoothing occurs, that is, the node representations tend to be consistent, resulting in vertices from different clusters becoming indistinguishable, which affects the performance of downstream tasks such as node classification. Some work has attempted to alleviate the over-smoothing problem and build deep graph convolutional network models. Regularization is a common technique for training general deep neural networks and has been developed to solve the over-smoothing problem. The Dropout strategy is to discard node information and edge information to solve the over-smoothing problem. The above two methods can alleviate the over-smoothing problem, but as the number of graph convolution layers increases, over-smoothing will still occur. The dropout strategy randomly discards the original data, which may cause information bias. Summary of the invention
[0003] In view of the above technical problems, the technical solution adopted by the present invention is:
[0004] According to a first aspect of the present invention, a method for obtaining a node classification model is provided, the method comprising the following steps:
[0005] S100, obtain a graph dataset G and divide the obtained G into a training set, a test set and a validation set, where G = (V, A, X), V is the node set corresponding to G, A is the adjacency matrix corresponding to G, and X is the original feature matrix corresponding to G.
[0006] S200, using the feature matrix, adjacency matrix and classification label corresponding to G to train the current node classification model, the initial value of the current node classification model is the initial node classification model, the node classification model includes N layers of graph neural network, each layer of graph neural network has M attention heads.
[0007] S300, input the adjacency matrix, classification label and current feature matrix corresponding to G into the k-th layer graph neural network of the current node classification model, and obtain the fixed attention weight set α corresponding to any node i in the training set i k ={α i k1 , α i k2 , ..., α i kp , ..., α i kM}, α i kp is the fixed attention weight set corresponding to node i obtained based on the p-th attention head of the k-th graph neural network layer. The value of i ranges from 1 to n, n is the number of nodes in G, and the value of p ranges from 1 to M. α i kp ={α i1 kp , α i2 kp , ..., α ij kp , ..., α in kp}, α ij kp is the fixed attention weight between node i and node j, the value of j ranges from 1 to n, the initial value of the current feature matrix corresponding to node i is the original feature matrix corresponding to node i, and the value of k ranges from 1 to N.
[0008] S400, with α i kp As the base distribution b i kp ,by As the diffusion intensity, the corresponding Dirichlet distribution DD is constructed i kp And from DD i kp Extraction and b i kp The corresponding distribution is the random attention weight π of node i i kp , is the convergence factor corresponding to node i in the input k-th graph neural network layer.
[0009] S500, using π i kp The current feature vector corresponding to the node i is updated to obtain the updated feature vector as the current feature vector corresponding to the node i; k=k+1 is set, if k≤N, S300 is executed, otherwise, S600 is executed.
[0010] S600, based on the training result of the current node classification model, determine whether the current loss function value corresponding to the current node classification model meets the preset model convergence condition. If so, execute S700; otherwise, update the current node classification model based on the current loss function value and execute S200; the training result is the classification result of the node corresponding to the training set.
[0011] S700, use the feature matrix, adjacency matrix and classification label corresponding to the verification set to verify the current node classification model. If the verification result indicates that the loss function value of the current node classification model meets the preset model convergence condition, use the test set to test the current node classification model. If the test result indicates that the loss function value of the current node classification model meets the preset model convergence condition, use the current node classification model as the target node classification model. Otherwise, execute S200.
[0012] According to a second aspect of the present invention, there is provided a node classification model construction device, comprising:
[0013] The data acquisition module obtains the graph data set G and divides the obtained G into a training set, a test set and a validation set, where G = (V, A, X), V is the node set corresponding to G, A is the adjacency matrix corresponding to G, and X is the original feature matrix corresponding to G.
[0014] The attention weight acquisition module is used to input the adjacency matrix, classification label and current feature matrix corresponding to G into the k-th layer graph neural network of the current node classification model, and obtain the fixed attention weight set α corresponding to any node i in the training set i k ={α i k1 , α i k2 , ..., α i kp , ..., α i kM}, α i kp is the fixed attention weight set corresponding to node i obtained based on the p-th attention head of the k-th graph neural network layer. The value of i ranges from 1 to n, n is the number of nodes in G, and the value of p ranges from 1 to M. α i kp ={α i1kp , α i2 kp , ..., α ij kp , ..., α in kp}, α ij kp is the fixed attention weight between node i and node j, j ranges from 1 to n, the initial value of the current feature matrix corresponding to node i is the original feature matrix corresponding to node i, k ranges from 1 to N, and N is the number of graph neural network layers of the node classification model.
[0015] The attention weight sampling module is used to i kp As the base distribution b i kp ,by As the diffusion intensity, the corresponding Dirichlet distribution DD is constructed i kp And from DD i kp Extraction and b i kp The corresponding distribution is the random attention weight π of node i i kp , is the convergence factor corresponding to node i in the input k-th graph neural network layer.
[0016] Node aggregation module for utilizing π i kp The current feature vector corresponding to the node i is updated, and the updated feature vector is obtained as the current feature vector corresponding to the node i.
[0017] The training and testing module is used to determine whether the current loss function value corresponding to the current node classification model meets the preset model convergence condition based on the training results of the current node classification model. If it does, the current node classification model is verified and tested using the verification set and the test set respectively, and based on the verification results and the test results, it is determined whether the current node classification model is the target node classification model.
[0018] According to a third aspect of the present invention, there is provided an electronic device comprising a processor and a memory; the processor is used to execute the steps of the method described in the first aspect of the present invention by calling a program or instruction stored in the memory.
[0019] According to a fourth aspect of the present invention, there is provided a non-transitory computer-readable storage medium storing a program or instructions, wherein the program or instructions enable a computer to execute the steps of the method described in the first aspect of the present invention.
[0020] The present invention has at least the following beneficial effects:
[0021] The node classification model acquisition method provided by the embodiment of the present invention first obtains the attention weights between nodes based on the attention mechanism, and uses the attention weights as the base distribution of the Dirichlet distribution. Then, random attention weights are sampled from the Dirichlet distribution, aggregated with the corresponding neighbor nodes, and the final node representation is obtained after stacking the graph convolution layer to perform node classification. The model constructed in this way can improve the accuracy of node classification on the one hand, and on the other hand, the over-smoothing problem caused by stacking multiple layers of graph convolution layers can be alleviated by controlling the variance of the node feature representation without losing the original features.
[0022] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0024] Figure 1 A flowchart of a method for obtaining a node classification model provided by an embodiment of the present invention;
[0025] Figure 2 Schematic diagram of the experimental results. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0027] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more related listed items.
[0028] It should be noted that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the steps as sequential processes, many of the steps can be implemented in parallel, concurrently or simultaneously. In addition, the order of the steps can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0029] The embodiment of the present invention provides a method for obtaining a node classification model, which is used to classify nodes in graph data, such as Figure 1 As shown, the method may include the following steps:
[0030] S100, obtain a graph dataset G and divide the obtained G into a training set, a test set and a validation set, where G = (V, A, X), V is the node set corresponding to G, A is the adjacency matrix corresponding to G, and X is the original feature matrix corresponding to G.
[0031] In an embodiment of the present invention, the graph dataset may be a public dataset. In an exemplary embodiment, for example, it may be a dataset such as Cora, CiteSeer, or Pubmed. The nodes in these three datasets represent paper documents, and the edges represent citation relationships, that is, in an embodiment of the present invention, the graph dataset may be a citation network.
[0032] In the embodiment of the present invention, the original feature matrix corresponding to G may be composed of feature vectors of the nodes included therein. The feature vector of a node may be obtained by vectorizing the corresponding node name.
[0033] In the embodiment of the present invention, the specific division method of the training set, the test set and the validation set can be set based on actual needs, and the present invention does not make any special limitation.
[0034] In the embodiment of the present invention, the adjacency matrix and the feature matrix in the training set, the test set and the validation set are all matrices obtained after normalization preprocessing.
[0035] S200, using the feature matrix, adjacency matrix and classification label corresponding to G to train the current node classification model, the initial value of the current node classification model is the initial node classification model, the node classification model includes N layers of graph neural network, each layer of graph neural network has M attention heads.
[0036] In an embodiment of the present invention, the number of graph neural networks and the number of attention heads of each layer of the graph neural network can be obtained based on the actual training effect. In an exemplary embodiment, N = 12 and M = 8. Multiple attention heads can enhance the expression ability of the attention mechanism and better obtain the association information between nodes.
[0037] S300, input the adjacency matrix, classification label and current feature matrix corresponding to G into the k-th layer graph neural network of the current node classification model, and obtain the fixed attention weight set α corresponding to any node i in the training set i k ={α i k1 , α i k2 , ..., α i kp , ..., α i kM}, α i kp is the fixed attention weight set corresponding to node i obtained based on the p-th attention head of the k-th graph neural network layer. The value of i ranges from 1 to n, n is the number of nodes in G, and the value of p ranges from 1 to M. α i kp ={α i1 kp , α i2 kp , ..., α ij kp , ..., α in kp}, α ij kp is the fixed attention weight between node i and node j, the value of j ranges from 1 to n, the initial value of the current feature matrix corresponding to node i is the original feature matrix corresponding to node i, and the value of k ranges from 1 to N.
[0038] In the embodiment of the present invention, α ij kp The following conditions must be met:
[0039] in, is the vector to be learned corresponding to the p-th attention head of the k-th graph neural network layer, W kp is the weight matrix to be learned corresponding to the p-th attention head of the k-th graph neural network layer, is the feature vector corresponding to the neighbor node j of node i input into the k-th layer neural network, for The corresponding feature mean, is the feature vector corresponding to the neighbor node s of node i input into the k-th layer neural network, for The corresponding feature mean, N i is the set of neighbor nodes corresponding to node i, exp{} is an exponential function with the natural constant e as the base, and LeakyReLU() is the activation function.
[0040] S400, with α i kp As the base distribution b i kp ,by As the diffusion intensity, the corresponding Dirichlet distribution DD is constructed i kp And from DD i kp Extraction and b i kp The corresponding distribution is the random attention weight π of node i i kp , is the convergence factor corresponding to node i in the input k-th graph neural network layer.
[0041] It is known to those skilled in the art that any method for constructing a corresponding Dirichlet distribution based on a given basis distribution and diffusion intensity falls within the protection scope of the present invention.
[0042] In the embodiment of the present invention, due to the introduction of Dirichlet distribution, random attention weights are extracted from it. As the number of graph convolutional layers increases, the cumulative variance of node representations will gradually accumulate, and it is necessary to control it through the convergence factor in the distribution. When the difference between adjacent nodes in the k-1th layer is large, that is, the randomness of the representation between nodes is strong, the corresponding convergence factor value increases, the diffusion intensity decreases, and it converges more and more to the base distribution to reduce the variance increment of the kth layer nodes. On the contrary, when the difference between adjacent nodes is small, the random attention weights of the neighborhood nodes diverge more, increasing the variance of the kth layer nodes to expand the randomness.
[0043] Furthermore, in an embodiment of the present invention, The following conditions must be met:
[0044]
[0045] Among them, β is a setting parameter, and its value ranges from 0 to 1. is the feature vector corresponding to the t1 node in the neighboring node corresponding to the node i in the k-th layer neural network, is the feature vector corresponding to the t2 node in the neighboring node corresponding to the node i in the k-th layer neural network, s i E() represents the expectation of the number of neighbor nodes corresponding to node i, ||||2 is the vector second normal form, and t is a real number greater than 1.
[0046] In an embodiment of the present invention, It can be obtained through the following content:
[0047] From the expectation and variance of the Dirichlet distribution, we can get that given the feature X of the previous node (k-1)Under the condition of The distribution of the calculation node i features variance
[0048]
[0049] in, is the convergence factor corresponding to node i, is the neighbor node feature of node i, is the fixed attention weight between node i and its neighbor nodes.
[0050] when When Get the maximum value, that is
[0051]
[0052] where n i is the number of neighbor nodes of node i.
[0053] The cumulative variance vector of all nodes in the kth layer Analyze the variance of a specific node
[0054] Introducing the diagonal matrix Row-normalized adjacency matrix A, variance residual vector
[0055] Then there is d k <Λ k-1 Ad k-1 +r k-1 ,when When bounded, Bounded.
[0056] make Where k is the number of graph convolutional network layers. With the help of the infinite series convergence characteristics, Bounded, at this time Get
[0057] S500, using π i kp The current feature vector corresponding to the node i is updated to obtain the updated feature vector as the current feature vector corresponding to the node i; k=k+1 is set, if k≤N, S300 is executed, otherwise, S600 is executed.
[0058] Further, in S500, the current feature vector corresponding to node i is conditioned on the following conditions: To update: For ij kp The corresponding random attention weights, is the feature vector corresponding to node i input into the k-th layer of the neural network, and β is the set parameter. That is, the feature vector of node i is updated using the random attention weights of the neighboring nodes corresponding to node i, the feature vector of node i output by the previous network layer, and the feature vector of the neighboring nodes.
[0059] S600, based on the training result of the current node classification model, determine whether the current loss function value corresponding to the current node classification model meets the preset model convergence condition. If so, execute S600; otherwise, update the current node classification model based on the current loss function value and execute S200; the training result is the classification result of the node corresponding to the training set.
[0060] S700, use the feature matrix, adjacency matrix and classification label corresponding to the verification set to verify the current node classification model. If the verification result indicates that the loss function value of the current node classification model meets the preset model convergence condition, use the test set to test the current node classification model. If the test result indicates that the loss function value of the current node classification model meets the preset model convergence condition, use the current node classification model as the target node classification model. Otherwise, execute S200.
[0061] In an embodiment of the present invention, the loss function value can be obtained based on the output result of the model and the corresponding real result, and can be calculated based on an existing loss function. The preset model training end condition can be set based on actual needs. For example, the loss is less than or equal to the set loss threshold and remains unchanged within a set time period. In addition, the method for updating the model based on the loss function value can also be an existing update method, such as optimizing model parameters by gradient descent.
[0062] The present invention conducts a semi-supervised node classification experiment on the cora dataset, and tests GCN, GraphSAGE, GAT and the model proposed by the present invention at 2, 4, 8 and 16 layers respectively. The comparison results are shown in Figure 2. Figure 2 As shown. Figure 2 It can be seen that: as the number of network layers increases, the node classification accuracy obtained by testing the model constructed in the embodiment of the present invention is higher than that of the other three models, which alleviates the over-smoothing problem to a certain extent.
[0063] When the node classification model constructed by the method provided by the embodiment of the present invention is used in actual application, the relevant information of the graph data to be predicted can be input into the node classification model, and then the corresponding node classification result can be obtained.
[0064] In summary, the node classification model acquisition method provided by the embodiment of the present invention uses the Dirichlet distribution to model the randomness of the attention weight, and uses the Dirichlet process convergence factor to control the randomness of the node representation. Specifically, first, based on the attention mechanism, the attention weights between nodes are obtained, and the attention weights are used as the basis distribution of the Dirichlet distribution process. Then, random attention weights are sampled from the Dirichlet distribution, aggregated with the corresponding neighbor nodes, and after stacking the graph convolution layer, the final node representation is obtained and the node classification is performed. On the one hand, the model constructed in this way can improve the accuracy of node classification. On the other hand, without losing the original features, the over-smoothing problem caused by stacking multiple layers of graph convolution layers can be alleviated by controlling the variance of the node feature representation.
[0065] Based on the same inventive concept, an embodiment of the present invention further provides a node classification model acquisition device, comprising:
[0066] The data acquisition module obtains the graph data set G and divides the obtained G into a training set, a test set and a validation set, where G = (V, A, X), V is the node set corresponding to G, A is the adjacency matrix corresponding to G, and X is the original feature matrix corresponding to G.
[0067] The attention weight acquisition module is used to input the adjacency matrix, classification label and current feature matrix corresponding to G into the k-th layer graph neural network of the current node classification model, and obtain the fixed attention weight set α corresponding to any node i in the training set i k ={α i k1 , α i k2 , ..., α i kp , ..., α i kM}, α i kp is the fixed attention weight set corresponding to node i obtained based on the p-th attention head of the k-th graph neural network layer. The value of i ranges from 1 to n, n is the number of nodes in G, and the value of p ranges from 1 to M. α i kp ={α i1 kp , α i2 kp , ..., α ij kp , ..., α in kp}, α ij kpis the fixed attention weight between node i and node j, j ranges from 1 to n, the initial value of the current feature matrix corresponding to node i is the original feature matrix corresponding to node i, k ranges from 1 to N, and N is the number of graph neural network layers of the node classification model.
[0068] The attention weight sampling module is used to i kp As the base distribution b i kp ,by As the diffusion intensity, the corresponding Dirichlet distribution DD is constructed i kp And from DD i kp Extraction and b i kp The corresponding distribution is the random attention weight π of node i i kp , is the convergence factor corresponding to node i in the input k-th graph neural network layer.
[0069] Node aggregation module for utilizing π i kp The current feature vector corresponding to the node i is updated, and the updated feature vector is obtained as the current feature vector corresponding to the node i.
[0070] The training and testing module is used to determine whether the current loss function value corresponding to the current node classification model meets the preset model convergence condition based on the training results of the current node classification model. If it does, the current node classification model is verified and tested using the verification set and the test set respectively, and based on the verification results and the test results, it is determined whether the current node classification model is the target node classification model.
[0071] The training and testing module is specifically used for: judging whether the current loss function value corresponding to the current node classification model meets the preset model convergence conditions based on the training result of the current node classification model; if the current loss function value corresponding to the current node classification model meets the preset model convergence conditions, verifying the current node classification model using the feature matrix, adjacency matrix and classification label corresponding to the verification set; if the verification result indicates that the loss function value of the current node classification model meets the preset model convergence conditions, testing the current node classification model using the test set; if the test result indicates that the loss function value of the current node classification model meets the preset model convergence conditions, taking the current node classification model as the target node classification model; if the test result indicates that the loss function value of the current node classification model does not meet the preset model convergence conditions, continuing to train the model; if the current loss function value corresponding to the current node classification model does not meet the preset model convergence conditions, updating the current node classification model based on the current loss function value, and continuing to train the model; the training result is the classification result of the node corresponding to the training set.
[0072] Furthermore, α ij kp The following conditions must be met:
[0073] in, is the vector to be learned corresponding to the p-th attention head of the k-th graph neural network layer, W kp is the weight matrix to be learned corresponding to the p-th attention head of the k-th graph neural network layer, is the feature vector corresponding to the neighbor node j of node i input into the k-th layer neural network, for The corresponding feature mean, is the feature vector corresponding to the neighbor node s of node i input into the k-th layer neural network, for The corresponding feature mean, N i is the set of neighbor nodes corresponding to node i, exp{} is an exponential function with the natural constant e as the base, and LeakyReLU() is the activation function.
[0074] Furthermore, the current feature vector corresponding to node i is To update:
[0075] For ij kp The corresponding random attention weights,
[0076] is the feature vector corresponding to node i input into the k-th layer of the neural network, and β is the set parameter.
[0077] Further, The following conditions must be met:
[0078]
[0079] Among them, β is the setting parameter, is the feature vector corresponding to the t1 node in the neighboring node corresponding to the node i in the k-th layer neural network, is the feature vector corresponding to the t2 node in the neighboring node corresponding to the node i in the k-th layer neural network, s i E() represents the expectation of the number of neighbor nodes corresponding to node i, ||||2 is the vector second normal form, and t is a real number greater than 1.
[0080] An embodiment of the present invention also provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are configured to execute the method described in the embodiment of the present invention.
[0081] The embodiment of the present invention further provides a non-transitory computer-readable storage medium storing computer-executable instructions, wherein the computer instructions are used to execute the method described in the embodiment of the present invention.
[0082] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in the present invention can be achieved, and this document does not limit this.
[0083] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for obtaining a node classification model, characterized in that: The method comprises the following steps: S100, obtaining a graph dataset G and dividing the obtained G into a training set, a test set, and a validation set, wherein G = (V, A, X), V is a node set corresponding to G, A is an adjacency matrix corresponding to G, and X is an original feature matrix corresponding to G; S200, training the current node classification model using the feature matrix, adjacency matrix and classification label corresponding to G, where the initial value of the current node classification model is the initial node classification model, and the node classification model includes N layers of graph neural network, and each layer of graph neural network has M attention heads; S300, input the adjacency matrix, classification label and current feature matrix corresponding to G into the k-th layer graph neural network of the current node classification model, and obtain the fixed attention weight set α corresponding to any node i in the training set i k ={α i k1 , α i k2 , ..., α i kp , ..., α i kM }, α i kp is the fixed attention weight set corresponding to node i obtained based on the p-th attention head of the k-th graph neural network layer. The value of i ranges from 1 to n, n is the number of nodes in G, and the value of p ranges from 1 to M. α i kp ={α i1 kp , α i2 kp , ..., α ij kp , ..., α in kp }, α ij kp is the fixed attention weight between node i and node j, and the value of j ranges from 1 to n; the initial value of the current feature matrix corresponding to node i is the original feature matrix corresponding to node i, and the value of k ranges from 1 to N; S400, with α i kp As the base distribution b i kp ,by As the diffusion intensity, the corresponding Dirichlet distribution DD is constructed i kp And from DD i kp Extraction and b i kp The corresponding distribution is the random attention weight π of node i i kp , is the convergence factor corresponding to node i in the input k-th graph neural network layer; S500, using π i kp Update the current feature vector corresponding to the node i, and obtain the updated feature vector as the current feature vector corresponding to the node i; set k=k+1, if k≤N, execute S300, otherwise, execute S600; S600, judging whether the current loss function value corresponding to the current node classification model meets the preset model convergence condition based on the training result of the current node classification model, if so, executing S700, otherwise, updating the current node classification model based on the current loss function value, and executing S200; the training result is the classification result of the node corresponding to the training set; S700, use the feature matrix, adjacency matrix and classification label corresponding to the verification set to verify the current node classification model. If the verification result indicates that the loss function value of the current node classification model meets the preset model convergence condition, use the test set to test the current node classification model. If the test result indicates that the loss function value of the current node classification model meets the preset model convergence condition, use the current node classification model as the target node classification model. Otherwise, execute S200.
2. The method according to claim 1, characterized in that α ij kp The following conditions must be met: in, is the vector to be learned corresponding to the p-th attention head of the k-th graph neural network layer, W kp is the weight matrix to be learned corresponding to the p-th attention head of the k-th graph neural network layer, is the feature vector corresponding to the neighbor node j of node i input into the k-th layer neural network, for The corresponding feature mean, is the feature vector corresponding to the neighbor node s of node i input into the k-th layer neural network, for The corresponding feature mean, N i is the set of neighbor nodes corresponding to node i, exp{} is an exponential function with the natural constant e as the base, and LeakyReLU() is the activation function.
3. The method according to claim 2, characterized in that In S500, the current feature vector corresponding to node i is To update: For ij kp The corresponding random attention weights, is the feature vector corresponding to node i input into the k-th layer of the neural network, and β is the set parameter.
4. The method according to claim 1, characterized in that: The following conditions must be met: Among them, β is the setting parameter, is the feature vector corresponding to the t1 node in the neighboring node corresponding to the node i in the k-th layer neural network, is the feature vector corresponding to the t2 node in the neighboring node corresponding to the node i in the k-th layer neural network, s i is the number of neighbor nodes corresponding to node i, E() means to find the expectation, ||||2 is the vector second normal form, and t is a real number greater than 1.
5. A node classification model construction device, characterized in that: include: The data acquisition module acquires the graph data set G and divides the acquired G into a training set, a test set, and a validation set, where G = (V, A, X), V is the node set corresponding to G, A is the adjacency matrix corresponding to G, and X is the original feature matrix corresponding to G; The attention weight acquisition module is used to input the adjacency matrix, classification label and current feature matrix corresponding to G into the k-th layer graph neural network of the current node classification model, and obtain the fixed attention weight set α corresponding to any node i in the training set i k ={α i k1 , α i k2 , ..., α i kp , ..., α i kM }, α i kp is the fixed attention weight set corresponding to node i obtained based on the p-th attention head of the k-th graph neural network layer. The value of i ranges from 1 to n, n is the number of nodes in G, and the value of p ranges from 1 to M. α i kp ={α i1 kp , α i2 kp , ..., α ij kp , ..., α in kp }, α ij kp is the fixed attention weight between node i and node j, the value of j ranges from 1 to n, the initial value of the current feature matrix corresponding to node i is the original feature matrix corresponding to node i, the value of k ranges from 1 to N, and N is the number of graph neural network layers of the node classification model; The attention weight sampling module is used to i kp As the base distribution b i kp ,by As the diffusion intensity, the corresponding Dirichlet distribution DD is constructed i kp And from DD i kp Extraction and b i kp The corresponding distribution is the random attention weight π of node i i kp , is the convergence factor corresponding to node i in the input k-th graph neural network layer; Node aggregation module for utilizing π i kp Update the current feature vector corresponding to node i, and obtain the updated feature vector as the current feature vector corresponding to node i; The training and testing module is used to determine whether the current loss function value corresponding to the current node classification model meets the preset model convergence condition based on the training results of the current node classification model. If it does, the current node classification model is verified and tested using the verification set and the test set respectively, and based on the verification results and the test results, it is determined whether the current node classification model is the target node classification model.
6. The device according to claim 5, characterized in that α ij kp The following conditions must be met: in, is the vector to be learned corresponding to the p-th attention head of the k-th graph neural network layer, W kp is the weight matrix to be learned corresponding to the p-th attention head of the k-th graph neural network layer, is the feature vector corresponding to the neighbor node j of node i input into the k-th layer neural network, for The corresponding feature mean, is the feature vector corresponding to the neighbor node s of node i input into the k-th layer neural network, for The corresponding feature mean, N i is the set of neighbor nodes corresponding to node i, exp{} is an exponential function with the natural constant e as the base, and LeakyReLU() is the activation function.
7. The device according to claim 5, characterized in that The current feature vector corresponding to node i is calculated by the following conditions To update: For ij kp The corresponding random attention weights, is the feature vector corresponding to node i input into the k-th layer of the neural network, and β is the set parameter.
8. The device according to claim 5, characterized in that The following conditions must be met: Among them, β is the setting parameter, is the feature vector corresponding to the t1 node in the neighboring node corresponding to the node i in the k-th layer neural network, is the feature vector corresponding to the t2 node in the neighboring node corresponding to the node i in the k-th layer neural network, s i E() represents the expectation of the number of neighbor nodes corresponding to node i, ||||2 is the vector second normal form, and t is a real number greater than 1.
9. An electronic device, characterized in that: including a processor and a memory; The processor is used to execute the steps of the method according to any one of claims 1 to 5 by calling the program or instruction stored in the memory.
10. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium is used to store a program or instruction, and the program or instruction enables a computer to execute the steps of the method according to any one of claims 1 to 5.
