Node classification method and system based on graph neural network, and related device

By predicting the category distribution of multiple neighbor nodes in the graph neural network, multiple sampling nodes are obtained by sampling, which solves the problems of high computational complexity and low prediction accuracy in the graph neural network, and achieves more efficient prediction accuracy.

WO2025045151A1PCT designated stage expired Publication Date: 2025-03-06HUAWEI TECH CO LTD

Patent Information

Application Number
PCT/CN2024/115551
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-08-31
Filing Date
2024-08-29
Publication Date
2025-03-06

AI Technical Summary

Technical Problem

In the graph neural network, the number of neighbor nodes in the central node is large, the calculation complexity of direct aggregation features is high, and the prediction accuracy is low, making it difficult to meet application requirements.

Method used

By predicting the category distribution of multiple neighbor nodes, sampling can obtain multiple sampling nodes, reducing the computational complexity and improving prediction accuracy.

Benefits of technology

This reduces the computational complexity, improves the prediction accuracy, and avoids the problem of poor prediction effect of the model in a few categories caused by sample imbalance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024115551_06032025_PF_FP_ABST
    Figure CN2024115551_06032025_PF_FP_ABST
Patent Text Reader

Abstract

A node classification method and system based on a graph neural network, and a related device. The method comprises: when a model is trained, firstly predicting the categories of a plurality of neighbor node samples in a graph data sample, to obtain a category distribution for the plurality of neighbor node samples; and then performing sampling on the plurality of neighbor node samples on the basis of the category distribution and sampling parameters inputted by a user, so as to obtain a plurality of sampled nodes, such that a category distribution for the plurality of sampled nodes is similar to or consistent with the category distribution for the plurality of neighbor node samples. In this way, the features of the sampled nodes obtained through sampling can cover the features of all neighbor nodes, thereby reducing the calculation complexity; in addition, the category distribution for the sampled nodes is more in line with the real distribution for the neighbor nodes, thereby improving the performance of a graph neural network.
Need to check novelty before this filing date? Find Prior Art

Description

A node classification method, system and related equipment based on graph neural network

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on August 31, 2023, with application number 202311130100.1 and application name “A node classification method, system and related equipment based on graph neural network”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of computers, and in particular to a node classification method, system, and related equipment based on graph neural networks. Background Art

[0003] A graph neural network (GNN) is a neural network used to process graph data. Traditional neural networks can process data in the form of vectors or matrices, but GNNs are specifically designed to process graph data with complex relationships. Graph data typically consists of multiple nodes and edges. Nodes represent individuals or entities in the graph, such as users. Each node has its own characteristics, such as the user's name. Edges between nodes represent relationships between nodes, such as friendships. Edges can contain weights or labels to indicate the strength or type of relationship. A graph neural network obtains aggregated features by aggregating the features of the central node itself and the features of its neighboring nodes. The aggregated features are then used to train the neural network. The trained model can predict the category of the node to be detected based on the input graph data of the node to be detected.

[0004] However, a central node in a graph neural network may have many neighboring nodes. If the features of all neighboring nodes are aggregated with the features of the central node, the computational complexity will be very high and the prediction accuracy will be low, which will be difficult to meet application requirements.

[0005] Summary of the Invention

[0006] The present application provides a node classification method, system and related equipment based on graph neural network, which are used to solve the problem of poor prediction effect of graph neural network.

[0007] In a first aspect, a node classification method is provided, which includes the following steps: first, obtaining graph data and inference sampling parameters of a node to be detected, wherein the graph data includes the node to be detected and multiple neighbor nodes connected to the node to be detected; second, inputting the graph data into a node classification model to obtain the category distribution of multiple neighbor nodes; then, sampling the multiple neighbor nodes according to the inference sampling parameters and the category distribution of the multiple neighbor nodes to obtain multiple sampling nodes; finally, inputting the features of the multiple sampling nodes and the features of the node to be detected into the node classification model to obtain the predicted category of the node to be detected.

[0008] The method described in the first aspect is implemented by first predicting the category distribution of multiple neighbor nodes in the graph data, then using the category distribution to sample multiple neighbor nodes to obtain multiple sampling nodes, and then predicting the predicted category of the node to be detected based on the characteristics of the sampling nodes, thereby reducing the computational complexity. At the same time, the sampling distribution of the sampling node is obtained based on the prediction results of multiple neighbor nodes, rather than based on the labels of a small number of labeled neighbor nodes, so that the sampling node can obtain the features of more neighbor nodes, thereby improving the prediction accuracy.

[0009] In a possible implementation, a similarity between the category distributions of the plurality of sampling nodes and the category distributions of the plurality of neighboring nodes is higher than a first threshold.

[0010] In the above implementation, when sampling multiple neighbor nodes, the sampling distribution is the same as or similar to the category distribution of multiple neighbor nodes. In this way, the features of the sampled nodes obtained by sampling can not only summarize the features of all neighbor nodes, but also avoid the problem of poor prediction effect of the model on minority categories due to sample imbalance.

[0011] In one possible implementation, the nodes to be detected include labeled nodes and unlabeled nodes. The category distribution of multiple neighbor nodes is obtained based on the labels of the labeled nodes and the prediction results of the unlabeled nodes. The prediction results of the unlabeled nodes are obtained after inputting the graph data into the node classification model.

[0012] In the above implementation method, the category distribution of neighbor nodes used in this application is obtained based on the labels of labeled neighbor nodes and the predicted results of unlabeled neighbor nodes. The existing technology will input the node classification model based on the feature input of labeled neighbor nodes and the feature input of the node to be detected. There is a gap between the category distribution of labeled neighbor nodes and the category distribution of real neighbor nodes, because not every neighbor node has a label. This application obtains the category distribution of multiple neighbor nodes through prediction, so that each neighbor node has a labeled classification or a predicted classification. Therefore, the predicted category distribution will be closer to the real distribution than the category distribution of labeled neighbor nodes, and the category distribution of the sampling nodes obtained by sampling will also be closer to the real distribution. Using sampling nodes close to the real distribution for reasoning can not only reduce the amount of calculation and improve the reasoning efficiency, but also obtain more accurate results and improve the prediction effect.

[0013] In one possible implementation, the inference sampling parameters include the number of sampling nodes, that is, the total number of neighbor nodes that need to be sampled. Based on the total number and the category distribution of the neighbor nodes, the number of sampling nodes of each category sampled can be determined, so that the category distribution of the sampling nodes finally obtained is similar to or consistent with the category distribution of the neighbor nodes.

[0014] Optionally, the inference sampling parameters include the number of sampling layers, and the number of sampling layers is used to perform stratified sampling on multiple neighbor nodes according to the category distribution of multiple neighbor nodes to obtain multiple sampling nodes, wherein each sampling layer includes multiple sampling nodes of the same category, and each category of sampling nodes corresponds to one or more sampling layers. In a specific implementation, after obtaining the category distribution of multiple neighbor nodes, the multiple neighbor nodes can be divided into multiple levels according to the number of sampling layers, and each level is of the same category. Then, stratified sampling is performed in different sampling layers, so that the category distribution of the multiple sampling nodes obtained after sampling is similar or consistent with the category distribution of the multiple neighbor nodes. Different stratified sampling methods can be used according to needs, such as equidistant stratified sampling, geometric stratified sampling, etc., which are not specifically limited in this application.

[0015] It should be noted that the number of sampling layers input by the user can be the same as or different from the number of categories of neighbor nodes. In other words, the same category can be divided into one level or multiple levels. For example, if the neighbor nodes have 5 categories and the user sets the number of sampling layers to 10, then the neighbor nodes of one category are divided into 2 levels. This application does not make specific restrictions.

[0016] In the above implementation method, users can flexibly set the number of samples or sampling parameters according to business needs, so that the solution provided by this application can be flexibly adapted to various application scenarios. At the same time, the number of neighbor nodes in certain categories may be significantly less than that in other categories. By dividing a category into multiple levels and sampling in each level, the impact of the classification imbalance problem of neighbor nodes on model training can be reduced. By extracting neighbor nodes from the same category in multiple different levels, the sampled neighbor nodes can better represent the characteristics of the entire category and better cover the different characteristics and change trends of the category. The model trained using such sampling nodes can better adapt to changes in each level when processing new unseen samples, thereby making the trained model have stronger generalization capabilities.

[0017] In one possible implementation, the inference sampling parameters include the number of samplings, which is used to perform multiple samplings on multiple neighboring nodes. The multiple collection nodes include multiple collection node sets, and one collection node set corresponds to one sampling. The predicted category of the node to be detected is obtained based on multiple prediction results, and one prediction result is obtained by inputting a sampling node set into a node classification model.

[0018] In a specific implementation, the prediction category of the node to be detected can be determined based on multiple prediction results through voting strategies such as majority voting, weighted voting, probability fusion, and voting threshold, where majority voting refers to voting based on the prediction results, and the category with the most votes is determined as the prediction category of the node to be detected; weighted voting refers to assigning a weight to each prediction result, calculating the average value based on the weight to obtain the final prediction result, and determining the prediction category of the node to be detected based on the final prediction result; probability fusion can calculate the average probability or maximum probability of the probability value corresponding to each prediction result to obtain the fusion probability, and then determine the prediction category of the node to be detected based on the fusion probability; voting threshold refers to setting a threshold. When the number of votes for the category with the most votes exceeds the threshold, the category can be confirmed as the prediction category of the node to be detected. It should be understood that the above examples are for illustration only, and this application does not limit the voting strategy.

[0019] In the above implementation, multiple neighbor nodes are sampled multiple times according to the sampling times input by the user, multiple prediction results are obtained, and then the final prediction category is obtained by voting. The sampling node sets obtained by different sampling times have the same or different neighbor nodes, thereby ensuring to the greatest extent that the characteristics of each neighbor node can participate in the reasoning of the model and improve the prediction accuracy of the model.

[0020] In one possible implementation, before obtaining the graph data and inference sampling parameters of the node to be detected, the method also includes the following steps: obtaining a graph data sample and training parameters of the central node, the graph data sample includes the central node and multiple neighbor node samples connected to the central node, the training sampling parameters include the number of sampling nodes or the number of sampling layers, the graph data of the node to be detected and the graph data sample of the central node are different subgraphs in the same graph, the graph data sample is input into the initial model, and the category distribution of multiple neighbor node samples is obtained, and according to the training sampling parameters and the category distribution of the neighbor node samples, the multiple neighbor node samples are sampled to obtain multiple sampling node samples, the similarity between the category distribution of the multiple sampling nodes and the category distribution of the multiple neighbor nodes is higher than a second threshold, and the features of the multiple sampling node samples and the features of the central node are input into the initial model for training to obtain a node classification model.

[0021] In the above implementation method, when training the node classification model, multiple neighbor node samples are first predicted to obtain the category distribution of multiple neighbor node samples. Such category distribution is closer to the real distribution. It should be understood that the number of labeled neighbor nodes in the graph data sample is limited, and many neighbor node samples are not labeled, so there is a certain gap between the data distribution of labeled neighbor nodes and the data distribution of potential real neighbor nodes. This application is based on the prediction results of the neighbor node samples combined with the data distribution determined by the labels of the labeled neighbor node samples, which is more consistent with the real distribution. Then, the neighbor node samples are sampled according to such data distribution. The obtained sampled node samples can not only summarize the characteristics of the neighbor node samples, but also this feature is a feature that fits the characteristics of the potential real distribution. Using such sampled node samples to participate in model training can not only reduce the computational complexity, but also improve the model performance.

[0022] In a possible implementation, the generation time of the samples of the multiple sampling nodes is earlier than the generation time of the central node.

[0023] In a specific implementation, each node in the graph data sample has corresponding feature information, and the generation time can be a feature of the neighbor node sample and the central node. The definition of generation time is different in different scenarios. For example, in the graph data sample of the transaction network in the above example, each node represents a transaction, so the generation time can be the transaction time, and the transaction time of the corresponding transaction of the neighbor node sample in the subgraph sample is earlier than the transaction time of the corresponding transaction of the central node. For another example, in the graph data sample of the social network, each node represents a social media account, and the generation time can be the creation time of the account, so the creation time of the corresponding account of the neighbor node sample in the subgraph sample is earlier than the creation time of the corresponding account of the central node. The above examples are for illustration only and are not specifically limited in this application.

[0024] In the above implementation method, when training the node classification model, the sample generation time of the sampling nodes participating in the training is the same as the generation time of the node to be detected. This is because the future neighbor nodes cannot participate in the reasoning in the actual reasoning process. Therefore, during the model training process, the neighbor node samples with a generation time earlier than the central node are also used to participate in the model training. This can make the multiple neighbor node samples in the subgraph sample more consistent with the actual distribution. Model training based on the subgraph sample can improve the accuracy of the trained model in the reasoning stage.

[0025] In one possible implementation, the feature vectors of the sampling node samples and the feature vector of the central node can be obtained first, and then the feature aggregation of multiple sampling node samples and the central node can be realized through the aggregation function to obtain the aggregated features of the central node. The initial model is then trained according to the aggregated features until the model converges to obtain a trained first model.

[0026] Specifically, when the initial model is trained based on the aggregated features, the aggregated features can be first input into the initial model to obtain the output result, and then the loss value (loss) is obtained based on the gap between the output result and the label of the central node. The model parameters of the initial model are then adjusted based on the loss to obtain an updated initial model. The graph data sample of the new central node is then input into the updated initial model to generate a new subgraph sample. The new subgraph sample is sampled to obtain a new sampling node. The features of the new sampling node are aggregated with the features of the new central node to obtain a new aggregated feature. The new aggregated feature is then input into the updated initial model to obtain a new output result. The loss is obtained based on the gap between the new output result and the label of the new central node. The model parameters of the updated initial model are adjusted again based on the loss to obtain an updated initial model again. This process is repeated many times until the model converges and the first model is obtained.

[0027] For example, suppose a central node has 100 neighbor nodes. Of these 100 neighbor nodes, 61 are actually Class A nodes and 39 are Class B nodes, resulting in a potential true distribution ratio of 61:39. However, there are only 10 labeled neighbor nodes, and the remaining 90 are unlabeled. Of these, 5 are Class A and 5 are Class B. Therefore, the class distribution obtained based on the labeled neighbor nodes is 1:1, significantly different from the potential true distribution ratio of 61:39. Sampling based on the class distribution of labeled neighbor nodes results in a significant discrepancy between the sampled data distribution and the true distribution, resulting in poor model training results.

[0028] Using the node classification method provided in this application, the initial model is first used to predict 90 unlabeled neighbor nodes. Assuming that 60 unlabeled neighbor nodes are predicted to be class A and 30 unlabeled neighbor nodes are predicted to be class B, then based on the prediction results of the unlabeled neighbor nodes and the labels of the labeled neighbor nodes, it can be determined that the category distribution of these 100 neighbor nodes in the first round is 65:35=13:7. If the number of sampling nodes is 20, then there are 13 sampling nodes of class A and 7 sampling nodes of class B. It should be understood that compared with the category distribution of 1:1 obtained based on the labeled neighbor nodes, the category distribution of 13:7 obtained based on the prediction results of the unlabeled neighbor nodes and the labels of the labeled neighbor nodes is closer to the potential true distribution of 61:39. Sampling based on the category distribution obtained according to the prediction results of the unlabeled nodes and the labels of the labeled nodes can obtain sampling nodes that are closer to the true distribution. Model training in this way can improve model performance.

[0029] Furthermore, the model is trained for the first round using the 20 sampling nodes that are close to the potential true distribution to obtain a trained first model. The prediction ability of the first model is better than that of the initial model used in the first round. Using the first model to predict the category of unlabeled neighbor nodes can obtain more accurate prediction results than the initial model. The category distribution of multiple neighbor nodes obtained in this way will be closer to the potential true distribution than the category distribution of the first round obtained according to the initial model. Still taking the above example, the first model obtained in the first round of training is used to predict the above 90 unlabeled neighbor nodes, and 55 neighbor nodes of category A and 35 neighbor nodes of category B are determined. Combined with the labels of the 10 labeled neighbor nodes, the category distribution of the neighbor nodes in the second round can be obtained as 60:40=3:2. Compared with the category distribution of 65:35=13:7 in the first round, the category distribution of 60:40=3:2 determined in the second round is closer to the potential true distribution of 61:39. If the number of sampling nodes is 20, then there are 12 sampling nodes of category A and 8 sampling nodes of category B in the second round of sampling. Based on these 20, it is closer to the potential true distribution. A second model is obtained by performing a second round of training on the first model at the sampling nodes of the true distribution. The performance of the second model is better than that of the first model. Using the second model to predict the unlabeled neighbor nodes, a more accurate prediction result can be obtained than the first model. The category distribution of the third round determined in this way will be closer to the potential true distribution 61:39 than the second round. Then the third round of sampling is performed, and so on, until the model converges. The above method makes the distribution of neighbor nodes used in each round of training gradually approach the potential true distribution during multiple rounds of training. Using the category distribution close to the true distribution for sampling, the obtained sampling nodes are used to train the model to improve model performance.

[0030] The above implementation method predicts the category of neighbor node samples to obtain the category distribution of multiple neighbor node samples, then samples multiple neighbor nodes based on the category distribution, and then trains the model based on the sampled nodes, and backpropagates the model parameters. The trained new model continues to predict the category of neighbor node samples in the second round of training, and then trains the model based on the predicted category distribution. The trained new model continues to repeat the above steps in the third round of training until the model converges. In this way, multiple rounds of training make the category distribution of neighbor node samples predicted by the model gradually fit the true distribution, thereby making the training effect better and better, and improving the performance of the model.

[0031] In one possible implementation, features of samples of multiple sampling nodes are input into an initial model for training to obtain a first model, pseudo labels of graph data samples are generated based on the first model, and the pseudo labels are used to train the first model to obtain a node classification model.

[0032] The above implementation method predicts the unlabeled neighbor nodes, obtains the pseudo labels of the unlabeled neighbor nodes, and then uses the pseudo labels to continue training the first model, which can increase the number of samples participating in training and improve model performance.

[0033] In a possible implementation, the training sampling parameters include a pseudo label threshold, and the confidence of the pseudo label is higher than the pseudo label threshold.

[0034] Optionally, the pseudo-label threshold can be a user-defined threshold or a default threshold, which is not specifically limited in this application. Confidence refers to the degree of confidence or certainty that the model has in its prediction results. In classification tasks, confidence generally refers to the model's predicted probability or score for a certain category.

[0035] The above implementation method, by retaining high-confidence pseudo-labels, can improve the accuracy of the pseudo-labels involved in training, reduce the introduction of noise, and improve the effectiveness of model training. At the same time, the number of labeled neighbor nodes in the graph data sample is limited, and many neighbor nodes are unlabeled. Therefore, there is a certain gap between the data distribution of labeled neighbor nodes and the data distribution of true neighbor nodes. By labeling high-confidence pseudo-labels, the training set participating in the next round of training includes both labeled neighbor nodes and pseudo-labeled neighbor nodes. The data distribution of neighbor nodes in this training set is more consistent with the data distribution of potential true neighbor nodes. Using such a training set to further train the model can further improve the accuracy of the model.

[0036] In one possible implementation, a first model is trained using graph data samples labeled with the above-mentioned pseudo-labels. The training process can refer to the above-mentioned content. Then, the second model is verified using the verification set to obtain a verification result. If the verification result shows that the model performance has decreased, the above-mentioned pseudo-labels are removed. If the verification result shows that the model performance has improved, the above-mentioned pseudo-labels are retained. Then the next round of training is carried out, and so on, until the model converges and a trained node classification model is obtained. The model convergence at this time can be that the performance reaches the preset index, or it can be that the pseudo-labels can no longer improve the model performance. This application does not limit the specific criteria for model convergence.

[0037] Among them, the evaluation criteria of the above performance can be determined according to the specific application scenario. For example, the evaluation criteria of the model performance may include accuracy, which indicates the proportion of samples correctly predicted by the model to the total number of samples; it may also include precision and recall. Precision and recall are a pair of interrelated indicators. Precision indicates the proportion of samples predicted by the model as positive examples that are actually positive examples, while recall indicates the proportion of samples predicted as positive examples by the model that are actually positive examples; it may also include F1 score, which is the harmonic mean of precision and recall, and can comprehensively consider the accuracy and recall performance of the model. It should be understood that the above examples are for illustration only and are not specifically limited in this application.

[0038] The above implementation method, by training the model for multiple rounds and verifying the generated pseudo-labels in each round of training, can ensure that the pseudo-labels used in each round of training are pseudo-labels that can provide positive and beneficial effects to the model, so that the information in the unlabeled neighbor node samples can be maximized during the model training process to achieve the effect of data enhancement. In some scenarios where the number of real labels is small and difficult to label, a large number of unlabeled neighbor node samples can also be used to complete the model training, so that the node classification model obtained through training has better accuracy and robustness.

[0039] At the same time, in the above training method, when sampling neighbor node samples, the sampling distribution fits the data distribution of neighbor node samples. When using pseudo labels to further train the model, the data distribution of neighbor node samples marked with pseudo labels fits the data distribution of neighbor node samples with real labels, so that the data distribution of neighbor node samples participating in model training fits the real distribution, which can avoid the problem of poor prediction effect of the model on a few categories due to sample imbalance. It should be understood that in some application scenarios, such as risk control scenarios, the number of fraudulent nodes is much lower than the number of normal nodes, and the influence of small category samples on the loss function is very small, which can be easily ignored during the optimization process. Sample imbalance can easily make it difficult for the model to predict fraudulent nodes. The training method provided in this application can greatly avoid the occurrence of such situations.

[0040] In one possible implementation, the graph data includes any one of social media network graph data, transaction network graph data, commodity network graph data, knowledge graph, and biological molecular structure graph data.

[0041] It should be understood that the node classification method provided in this application is applicable to a wide range of scenarios, and users can flexibly set the inference sampling parameters and training sampling parameters according to actual business needs, making the node classification method of this application more universal and more feasible.

[0042] On the second aspect, a node classification system based on a graph neural network is provided, characterized in that the system includes: an acquisition unit for acquiring graph data and inference sampling parameters of a node to be detected, the graph data including the node to be detected and multiple neighboring nodes connected to the node to be detected; a prediction unit for inputting the graph data into a node classification model to obtain the category distribution of multiple neighboring nodes; a prediction unit for sampling multiple neighboring nodes according to the inference sampling parameters and the category distribution of multiple neighboring nodes to obtain multiple sampling nodes; and a prediction unit for inputting features of the multiple sampling nodes and features of the node to be detected into the node classification model to obtain a predicted category of the node to be detected.

[0043] The method described in the first aspect is implemented by first predicting the category distribution of multiple neighbor nodes in the graph data, then using the category distribution to sample multiple neighbor nodes to obtain multiple sampling nodes, and then predicting the predicted category of the node to be detected based on the characteristics of the sampling nodes, thereby reducing the computational complexity. At the same time, the sampling distribution of the sampling node is obtained based on the prediction results of multiple neighbor nodes, rather than based on the labels of a small number of labeled neighbor nodes, so that the sampling node can obtain the features of more neighbor nodes, thereby improving the prediction accuracy.

[0044] In a possible implementation, a similarity between the category distributions of the plurality of sampling nodes and the category distributions of the plurality of neighboring nodes is higher than a first threshold.

[0045] In one possible implementation, the nodes to be detected include labeled nodes and unlabeled nodes. The category distribution of multiple neighbor nodes is obtained based on the labels of the labeled nodes and the prediction results of the unlabeled nodes. The prediction results of the unlabeled nodes are obtained after inputting the graph data into the node classification model.

[0046] In one possible implementation, the inference sampling parameter includes the number of sampling nodes, or the inference sampling parameter includes the number of sampling layers, and the number of sampling layers is used to perform stratified sampling on multiple neighbor nodes according to the category distribution of multiple neighbor nodes to obtain multiple sampling nodes, wherein each sampling layer includes multiple sampling nodes of the same category, and each category of sampling nodes corresponds to one or more sampling layers.

[0047] In one possible implementation, the inference sampling parameters include the number of samplings, which is used to perform multiple samplings on multiple neighboring nodes. The multiple collection nodes include multiple collection node sets, and one collection node set corresponds to one sampling. The predicted category of the node to be detected is obtained based on multiple prediction results, and one prediction result is obtained by inputting a sampling node set into a node classification model.

[0048] In one possible implementation, the system also includes a training unit and a sampling unit. The training unit is used to obtain graph data samples and training parameters of the central node before the acquisition unit obtains the graph data and inference sampling parameters of the node to be detected. The graph data samples include the central node and multiple neighbor node samples connected to the central node. The training sampling parameters include the number of sampling nodes or the number of sampling layers. The graph data of the node to be detected and the graph data sample of the central node are different subgraphs in the same graph. The training unit is used to input the graph data samples into the initial model to obtain the category distribution of multiple neighbor node samples. The sampling unit is used to sample multiple neighbor node samples according to the training sampling parameters and the category distribution of the neighbor node samples to obtain multiple sampling node samples. The similarity between the category distribution of the multiple sampling nodes and the category distribution of the multiple neighbor nodes is higher than a second threshold. The training unit is used to input the features of the multiple sampling node samples and the features of the central node into the initial model for training to obtain a node classification model.

[0049] In a possible implementation, the generation time of the plurality of sampling node samples is earlier than the generation time of the node to be detected.

[0050] In one possible implementation, the system includes a label generation unit, a training unit for inputting features of samples of multiple sampling nodes into an initial model for training to obtain a first model, a label generation unit for generating pseudo labels for graph data samples based on the first model, and training the first model using the pseudo labels to obtain a node classification model.

[0051] In a possible implementation, the training sampling parameters include a pseudo label threshold, and the confidence of the pseudo label is higher than the pseudo label threshold.

[0052] In one possible implementation, the graph data includes any one of social media network graph data, transaction network graph data, commodity network graph data, knowledge graph, and biological molecular structure graph data.

[0053] In a third aspect, a computing device is provided. The computing device includes a processor and a memory, the memory is used to store instructions, and the processor is used to execute instructions, so that the computing device implements the method described in the first aspect.

[0054] In a fourth aspect, a computing device cluster is provided, which includes at least one computing device, each of the at least one computing device includes a processor and a memory, and the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster implements the method described in the first aspect.

[0055] In a fifth aspect, a computer-readable storage medium is provided, in which instructions are stored. When the instructions are executed by a computing device or a computing device cluster, the method described in the first aspect is implemented.

[0056] In a sixth aspect, a computer program product comprising instructions is provided, wherein the computer program product includes instructions that can be run on a computing device or stored in software or program products in any available medium, and when the computer program product is run on a computing device or a computing device cluster, the computing device or computing device cluster executes the method described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] FIG1 is an architecture diagram of a node classification method provided by this application;

[0058] FIG2 is a schematic diagram of the structure of the node classification system provided by this application;

[0059] FIG3 is a schematic diagram of the steps of a node classification method provided by the present application during the training phase;

[0060] FIG4 is a flowchart showing the steps of the training phase of a node classification method provided by the present application in an application scenario;

[0061] FIG5 is a schematic diagram of the steps of a node classification method provided by the present application in the reasoning stage;

[0062] FIG6 is a schematic flow chart of the steps of the reasoning phase of a node classification method provided by the present application in an application scenario;

[0063] FIG7 is an exemplary interface display diagram of the node classification method provided by the present application;

[0064] FIG8 is a schematic diagram of the structure of a computing device provided by the present application. DETAILED DESCRIPTION

[0065] First, the application scenario "graph neural network algorithm" involved in this application is explained.

[0066] A graph neural network (GNN) is a neural network used to process graph data. Traditional neural networks can process data in the form of vectors or matrices, but GNNs are specifically designed to process graph data with complex relationships. Graph data typically consists of multiple nodes and edges. Nodes represent individuals or entities in the graph, such as users. Each node has its own characteristics, such as the user's name. Edges between nodes represent relationships between nodes, such as friendships. Edges can contain weights or labels to indicate the strength or type of relationship. A graph neural network obtains aggregated features by aggregating the features of the central node itself and the features of its neighboring nodes. The aggregated features are then used to train the neural network. The trained model can obtain inference results corresponding to the node to be detected based on the input graph data of the node to be detected.

[0067] For example, in a recommendation task scenario, if you want to recommend friends to a user, you need to input information about the user and the user's friends, place of residence, interests, and hobbies. This information can be represented by graph structure data, where nodes represent users and edges between nodes represent friendships between users. The features recorded on the nodes may include the features of the user corresponding to the node, including information such as friends, place of residence, and interests. Graph neural networks aggregate the features of the central node with the features of the surrounding neighboring nodes, input the aggregated features into the neural network for training, and backpropagate the model parameters of the neural network based on the labels and the prediction results of the neural network. After the model converges, a trained model is obtained. After receiving the graph structure data of a new central node, the model can obtain the recommendation results for the user corresponding to the central node based on the graph structure data.

[0068] However, a central node in a graph neural network may have many neighboring nodes. Aggregating the features of all neighboring nodes with the features of the central node would result in high computational complexity, low training and inference efficiency of the graph neural network, and poor model performance, making it difficult to meet application requirements. While sampling neighboring nodes and then aggregating the sampled features with the features of the central node can reduce complexity, the sampled features of the neighboring nodes cannot summarize the features of all neighboring nodes, resulting in poor model performance.

[0069] In order to solve the problem that graph neural networks are difficult to aggregate the features of all neighbor nodes with the features of the central node, resulting in high computational complexity and poor model performance, the present application provides a node classification system, which first predicts the category distribution of multiple neighbor nodes in the graph data, then obtains the training sampling parameters input by the user, samples multiple neighbor node samples in the graph data sample to obtain multiple sampling nodes, so that the category distribution of the multiple sampling nodes is similar or consistent with the category distribution of the predicted multiple neighbor node samples. In this way, the features of the sampled sampling nodes can not only summarize the features of all neighbor nodes, but also avoid the problem of poor prediction effect of the model on a few categories due to sample imbalance; and the node classification system takes into account the future neighbor node distribution in the actual reasoning process. Points cannot participate in reasoning, so the generation time of the sampling nodes participating in training is earlier than that of the central node, which can make the sampling nodes participating in training more consistent with the actual distribution in the reasoning stage, further improving the model performance; finally, the model is trained for multiple rounds according to the sampling nodes until the model converges. At the end of each round of training, the converged model will be used to predict the pseudo labels of the neighboring nodes, and the pseudo labels will be verified through the validation set. The pseudo labels that are beneficial to the model are retained, and the pseudo labels that are not beneficial to the model are removed, and then the next round of training is carried out. In this way, the pseudo labels used in each round of training are pseudo labels that can provide positive and beneficial effects to the model. During the model training process, the information in the unlabeled neighbor node samples can be maximized to achieve the effect of data enhancement and improve the performance of the graph neural network.

[0070] FIG1 is an architecture diagram of a node classification method provided by the present application. As shown in FIG1 , the architecture includes a client 100, a node classification system 200, and a storage system 300. The client 100, the node classification system 200, and the storage system 300 establish a communication connection through a network, which can be a wired connection or a wireless connection, which is not specifically limited in the present application. The number of clients 100 and storage systems 300 that establish a communication connection with the node classification system 200 can be one or more, which is not specifically limited in the present application.

[0071] The client 100 is used to implement human-computer interaction and can be deployed on terminal devices, including personal computers, smart phones, wearable devices, handheld processing devices, tablet computers, mobile notebooks, augmented reality (AR) devices, virtual reality (VR) devices, integrated handheld devices, wearable devices, vehicle-mounted devices, smart conferencing devices, smart advertising devices, smart home appliances, etc. Smart home appliances can be sweeping robots, mopping robots, etc., which are not specifically limited here.

[0072] In a specific implementation, the above-mentioned client 100 can be a software or application running on a terminal device or computing device controlled by the user, such as a personal computer (PC) client, or a web client accessed based on a browser, or an application (APP) client running on a mobile terminal. This application does not make specific limitations.

[0073] Optionally, the client 100 can be a client specifically used for node classification, and the predicted node categories are different in different application scenarios. For example, in a risk control scenario, the client 100 can be a client for predicting user risk categories or risk coefficients. The client can receive graph data input by the user and feedback the risk coefficients of each node in the graph data to the user. In a recommendation scenario, the client 100 can be a client for product recommendation. The client can receive graph data input by the user and feedback the recommendation coefficients or preferences of the products corresponding to each node in the graph data to the user. Of course, it can also be applied to other fields, which are not explained here one by one. It should be understood that the recommendation coefficient, preference or risk coefficient of the predicted node can also be regarded as a classification task of a continuous value, and this continuous value can also be discretized and then trained. For example, the recommendation coefficient is discretized and divided into three categories: low, medium and high. Then, a classification algorithm is used to train the model for prediction. The above examples are for illustration only and are not specifically limited in this application.

[0074] The client 100 may also be an application client that includes a node classification plug-in. For example, in a risk control scenario, the client 100 may be an e-commerce management application that includes a submodule for e-commerce risk control specifically for predicting the risk coefficient or risk category of users who purchase e-commerce products. The node category here is the risk coefficient or risk category. For example, in a recommendation scenario, the client 100 may be a social media application that includes a submodule for user recommendation specifically for predicting the friends a user may want to make or the products they may want to purchase. The node category here is the recommendation coefficient of the user or product. Of course, it can also be applied to other fields, which will not be exemplified here.

[0075] Optionally, the client 100 can also be a console of the cloud platform, which provides the node classification function of the node to the user as a sub-service of the cloud platform. The user can use the node classification method provided by this application by purchasing cloud services. Optionally, the user can purchase the training service of the node classification method provided by this application. The cloud platform can provide the user with a training platform. The user can input the training sampling parameters and graph data samples in combination with business needs through the training platform. The cloud platform uses the node classification method provided by this application to train the node classification model. The node classification model obtained in this way can adapt to the user's business needs. The user can flexibly customize the node classification model that matches its own business function. Optionally, the user can also purchase the reasoning service of the node classification method provided by this application. The cloud platform can provide the user with a trained node classification model. The user can input the graph data to be detected and the reasoning sampling parameters into the node classification model to obtain the prediction result. The node classification model obtained in this way is usually a general model. The performance effect is not as strong as the above-mentioned flexible customized classification model, but the user does not need to train the model by himself, and the operation is more convenient. The user can choose to use the training service or reasoning service in combination with his own business needs. This application does not make specific restrictions. The console may be a web-based client, an application client, or an application programming interface (API), which is not specifically limited in this application.

[0076] The node classification system 200 is used to receive the node graph data sent by the client 100, classify the nodes according to the graph data, obtain the node category, and then return the category to the client 100. In some application scenarios, the node classification system 200 can also send the node category to the storage system 300 for storage.

[0077] The storage system 300 is used to receive the category of the node sent by the node classification system 200 and store the category of the node. In different application scenarios, the storage system 300 may have different functions. For example, in a risk control scenario, the category of the node may be the risk category of the user corresponding to the node. The storage system 300 may store records of multiple high-risk users, so that a reminder can be given directly the next time a high-risk user visits. It should be understood that the above examples are for illustration only and are not specifically limited in this application. In a specific implementation, the storage system 300 may be a database, a file system, a cloud storage system, etc., which is not specifically limited in this application.

[0078] The node classification system 200 and storage system 300 can be deployed on computing devices, computing device clusters, or terminal devices. Computing devices include bare metal servers (BMSs), virtual machines, containers, or edge computing devices. A BMS refers to a general-purpose physical server, such as an ARM server or an X86 server. A virtual machine is a complete computer system with complete hardware system functionality, running in a completely isolated environment, simulated by software. Any work that can be performed on a physical computer can also be performed on a virtual machine. When creating a virtual machine on a computing device, part of the physical machine's hard disk and memory capacity is used as the virtual machine's hard disk and memory capacity. Each virtual machine has an independent basic input / output system (CMOS), hard disk, and operating system, allowing it to be operated like a physical machine. A container is a portable software unit that combines an application and all its dependencies into a single software package. This package is not restricted by the underlying host operating system, eliminating the need to build a complex environment and simplifying the process from application development to deployment. Edge computing devices are devices that are closer to data sources and end users and feature low latency and high bandwidth, such as smart routers and edge servers. The computing device cluster may include multiple computing devices as described above, such as a data center, which is not specifically limited in this application; the description of the terminal device can refer to the above content and will not be repeated here.

[0079] Optionally, the node classification system 200 can be deployed on the same terminal device as the client 100; or, the node classification system 200 is deployed on a computing device, and the client 100 is deployed on a terminal device; or, the node classification system 200 is deployed in a computing device cluster, and the client 100 is deployed on a terminal device. It should be understood that the above examples are for illustration only, and the specific deployment of the node classification system 200 and the client 100 can be determined based on the actual application scenario.

[0080] Optionally, the node classification system 200 and the storage system 300 can be deployed on the same computing device; or, the node classification system 200 and the storage system 300 can be deployed on different computing devices in the same computing device cluster; or, the node classification system 200 and the storage system 300 can be deployed on different computing devices in different computing device clusters. This application does not make any specific limitations. For example, the node classification system 200 can be any one in a data center, and the storage system 300 can be deployed on another computing device in the data center, or the storage system 300 can be deployed in another data center. The above examples are for illustration only and are not specifically limited in this application.

[0081] The node classification system provided in this application can be applied to node classification scenarios of graph neural networks, including but not limited to social network analysis, recommendation scenarios, knowledge graph scenarios, risk control scenarios, bioinformatics scenarios, etc., and this application does not make specific limitations. Among them, the social network analysis scenario can use the node classification system 200 provided in this application to predict users' interests and hobbies, users' community affiliations, etc., and the recommendation scenario can use the node classification system 200 provided in this application to predict users' preferences for products; the knowledge graph scenario can use the node classification system 200 provided in this application to perform tasks such as entity classification; the bioinformatics scenario can use the node classification system 200 provided in this application to predict the functional classification of proteins. It should be understood that the above examples are some examples of node classification scenarios, and the node classification system 200 can also be applied to other node classification scenarios. In the process of explaining the node classification system 200 below, some examples introduced are to enable this application to be better understood, and are not intended to limit the application scenarios of this application. This application does not limit the specific application scenarios of the node classification system 200.

[0082] Furthermore, the node classification system 200 in FIG2 can be further divided into multiple unit modules. For example, FIG2 is a schematic diagram of the structure of the node classification system 200 provided by the present application. As shown in FIG2, the node classification system 200 may include a training module 220 and a reasoning module 210, wherein the training module 220 may include a training unit 221, a subgraph generation unit 222, a sampling unit 223, an aggregation unit 224, and a label generation unit 225, and the reasoning module 210 may include an acquisition unit 211, a prediction unit 212, a voting unit 213, and an output unit 214. It should be understood that FIG1 is an exemplary division method, and the node classification system 200 may also include more or fewer units, such as the reasoning module 210 may also include a reasoning sampling unit, for example, the training module 220 may not have a label generation unit 225, or the aggregation unit 224 and the training unit 221 may be combined into one training unit 221, or the training module 220 may not have a subgraph generation unit 222. The unit modules may be determined according to the actual application scenario and are not specifically limited in this application.

[0083] Among them, the training unit 221, the subgraph generation unit 222, the sampling unit 223, the aggregation unit 224, the label generation unit 225, the acquisition unit 211, the prediction unit 212, the voting unit 213, and the output unit 214 can be implemented by software or by hardware. For example, the implementation of the training unit 221 is described below using the training unit 221 as an example. Similarly, the implementation of the subgraph generation unit 222, the sampling unit 223, the aggregation unit 224, the label generation unit 225, the acquisition unit 211, the prediction unit 212, the voting unit 213, and the output unit 214 can refer to the implementation of the training unit 221.

[0084] As an example of a software functional unit, training unit 221 may include code running on a computing instance. A computing instance may include at least one of a physical host (computing device), a virtual machine, or a container. Furthermore, the computing instance may be one or more. For example, training unit 221 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers running the code may be deployed in the same data center or in different data centers. When the multiple hosts / virtual machines / containers running the code are deployed in different data centers, the different data centers may be located in the same region or in different regions. A region describes the location of a data center. Data centers within the same region share common services such as elastic computing, block storage, and object storage. The different data centers may also be located in the same availability zone (AZ) or in different AZs. Each AZ includes one data center or multiple geographically close data centers. An AZ is a collection of one or more physical data centers, and computing, network, storage, and other resources within the AZ are logically divided into multiple clusters. Typically, a region can include multiple AZs, and multiple AZs in a region are connected via high-speed optical fibers to meet users' needs for building high-availability systems across AZs.

[0085] The training unit 221 is an example of a hardware functional unit. The training unit 221 can also be implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. For example, the training unit 221 can be implemented by a data processing unit (DPU), which is not limited in this application.

[0086] It should be noted that the structure shown in Figure 2 can be an implementation method of the node classification system 200 deployed on a single computing device. When the node classification system 200 is deployed on a computing device cluster composed of multiple computing devices, different computing devices in the computing device cluster can respectively store instructions for implementing the functions of the training unit 221, the subgraph generation unit 222, the sampling unit 223, the aggregation unit 224, the label generation unit 225, the acquisition unit 211, the prediction unit 212, the voting unit 213 and the output unit 214. For example, the computing device A in the computing device cluster stores instructions for implementing the training module 220, specifically including instructions for implementing the functions of the training unit 221, the subgraph generation unit 222, the sampling unit 223, the aggregation unit 224 and the label generation unit 225. The computing device B stores instructions for implementing the reasoning module 210, specifically including instructions for implementing the functions of the acquisition unit 211, the prediction unit 212, the voting unit 213 and the output unit 214. This application does not make specific limitations. Of course, different computing devices may also store the same instructions. For example, computing device B and computing device C both store instructions of the acquisition unit 211, the prediction unit 212, the voting unit 213, and the output unit 214, which are used to combine and implement the functions of the acquisition unit 211, the prediction unit 212, the voting unit 213, and the output unit 214. This application does not make specific limitations.

[0087] Among them, the training unit 221, subgraph generation unit 222, sampling unit 223, and aggregation unit 224 in the training module 220 are used to train the node classification model and run in the model training phase. The acquisition unit 211, prediction unit 212, voting unit 213, and output unit 214 in the inference module 210 are used to use the node classification model for inference and run in the model inference phase.

[0088] The functions of each unit module in the training module 220 in the node classification system 200 are described below.

[0089] The acquisition unit 211 is used to obtain the graph data sample and the initial model of the central node, and send the graph data sample and the initial model to the training unit 221. The training unit 221 is used to input the graph data sample into the initial model to obtain the prediction results of one or more neighbor node samples of the central node.

[0090] Optionally, the initial model can be obtained by training a graph neural network using labeled samples or unlabeled samples. The graph neural network may include graph sample and aggregated networks (GraphSAGE), graph convolutional networks (GCN), graph attention networks (GAT), etc. The initial model can also be a supervised model, such as random forests, multilayer perceptron (MLP), etc., which is not specifically limited in this application.

[0091] Optionally, the graph data sample input into the initial model is a graph structured data, and the graph data sample includes multiple nodes and multiple edges. Different nodes are used to represent different things, and edges are connected between related nodes. In a specific implementation, the nodes and edges of the graph data sample can represent different information in different application scenarios. For example, in the case of describing a commodity network, each node in the graph data sample can be used to represent a different commodity. If two commodities are often purchased by the same user, the purchase relationship between them can be represented by an edge. If one commodity depends on the use or existence of another commodity, this dependency can also be represented by an edge. In the case of describing a transaction network, each node in the graph data sample can be used to represent a different transaction. If the delivery address of two transactions is the same, the association relationship between them can be represented by an edge. If the consignee of two transactions is the same, the association relationship between them can also be represented by an edge. It should be understood that in the above examples, there is only one type of node category, that is, all nodes are commodities or all nodes are users. In some embodiments, the number of node categories and the number of edge categories can also be multiple, that is, the graph data sample can be a heterogeneous graph containing different types of nodes and edges. At the same time, the edges of the graph data sample can be directed or undirected, and this application does not limit this.

[0092] It should be noted that the graph data samples participating in the training can be obtained after submitting an application to the user or relevant department and obtaining approval and authorization. Unauthorized and unapproved graph data cannot be used as samples in the training.

[0093] Furthermore, the nodes in the graph data sample also have corresponding feature information, which is used to describe the characteristics of the nodes. These features can be the attributes, status or content of the nodes, etc., which can be determined according to the actual application scenario. For example, the feature information of the nodes in the above-mentioned commodity network can be the type of commodity (such as daily necessities, clothing, food, etc.), purchase time, purchasing user, etc. The feature information of the nodes in the above-mentioned transaction network can be the time of the transaction, the delivery address of the transaction, the payee of the transaction, the payee of the transaction, etc., which are not specifically limited in this application. It should be understood that the above examples are for illustration, and the node classification method provided in this application can also be used to process graph data samples in other application scenarios, and this application does not make specific limitations on this.

[0094] Furthermore, the nodes in the graph data sample may also include labels, and the labels of the nodes are the actual categories of the nodes. In addition, the graph data sample may include labeled nodes and unlabeled nodes. That is to say, each node in the graph data sample may have a label or may not have a label, or some nodes may have labels and some nodes may not have labels. This application does not make any specific limitations. In an embodiment of the present application, the categories corresponding to the labels vary in different application scenarios. For example, in the application scenario of product recommendation, the label of the node may be the category corresponding to the node. The category may be a continuous value, such as a recommendation coefficient, or a discrete category, such as labels divided into very recommended, relatively recommended, and not recommended. In a risk control scenario, the label of the node may be the category corresponding to the node. The category may be a continuous value, such as a risk coefficient, or a discrete category, such as labels divided into high risk, medium risk, and low risk. This application does not make any specific limitations.

[0095] Optionally, the neighbor node samples of the central node can be nodes directly connected to the central node, that is, other nodes connected to the central node through edges are all neighbor node samples of the central node; the neighbor node samples can also be nodes indirectly connected to the central node, that is, the first neighbor node sample is directly connected to the central node, and the second neighbor node sample connected to the first neighbor node sample can also be called the neighbor node sample of the central node. This type of neighbor node sample can be called a 2-hop neighbor node sample. Similarly, 3-hop neighbor node samples, 4-hop neighbor node samples, etc. can be obtained. This application does not make specific limitations. It should be understood that the neighbor node samples involved in the embodiments of the present application may include 1-hop neighbor node samples or may include neighbor node samples of more than 2 hops. The specific details can be determined according to the actual application scenario and this application does not make specific limitations.

[0096] Optionally, the prediction results of one or more neighbor node samples obtained by the initial model can be the prediction category or prediction score obtained for each neighbor node sample. For example, in a product recommendation application scenario, the prediction result can be the recommendation score or recommendation category of the neighbor node sample, such as highly recommended, relatively recommended, and not recommended. For example, in a risk control scenario, the prediction result can be the risk coefficient or risk level of the neighbor node sample, such as high risk, medium risk, and low risk. The above examples are for illustrative purposes only and are not specifically limited in this application.

[0097] Optionally, the initial model can predict the unlabeled neighbor node samples in the graph data sample to obtain the prediction results of the unlabeled neighbor node samples, and the neighbor node samples with labels can be not predicted. In the specific implementation, the initial model can predict the category of each unlabeled neighbor node sample in the graph data sample, and can also predict some unlabeled neighbor node samples. The specific method can be determined according to the actual application scenario. For example, in the actual application scenario, if the scale of the graph data sample is small, the initial model can directly predict the classification results of all unlabeled neighbor node samples. If the scale of the graph data sample is large, the initial model cannot predict the classification results of all unlabeled neighbor node samples. Then, the neighboring subgraph can be extracted from the graph data sample according to the preset extraction strategy, and then the unlabeled neighbor node samples in the neighboring subgraph are predicted. The extraction strategy here may include but is not limited to: sorting multiple neighbor nodes according to the degree of proximity to the generation time of the central node, and extracting the neighboring subgraph according to the sorting result. It should be understood that the above examples are for illustration. The extraction strategies adopted in different application scenarios are different, and this application does not make specific limitations.

[0098] The subgraph generation unit 222 is used to obtain a subgraph sample of the graph data sample based on the generation time of the central node and the generation time of the neighbor node samples. The subgraph sample includes a central node and multiple neighbor node samples, wherein the central node of the subgraph sample is the central node in the graph data sample, and the multiple neighbor node samples in the subgraph sample are neighbor node samples in the graph data sample whose generation time is earlier than that of the central node.

[0099] Referring to the foregoing content, it can be seen that each node in the graph data sample has corresponding feature information, and the generation time can be a certain feature of the neighbor node sample and the central node. The definition of generation time is different in different scenarios. For example, in the graph data sample of the transaction network in the above example, each node represents a transaction, then the above generation time can be the transaction time, and the transaction time of the corresponding transaction of the neighbor node sample in the subgraph sample is earlier than the transaction time of the corresponding transaction of the central node. For another example, in the graph data sample of the social network, each node represents a social media account, and the above generation time can be the creation time of the account, then the creation time of the corresponding account of the neighbor node sample in the subgraph sample is earlier than the creation time of the corresponding account of the central node. The above examples are for illustration only and are not specifically limited in this application.

[0100] It is understandable that during the model inference process, the generation time of neighbor node samples is earlier than that of the central node. Because future neighbor nodes cannot participate in the inference process in the actual inference process, the neighbor node samples with a generation time earlier than the central node are also used to participate in the model training during the model training process. This can make the multiple neighbor node samples in the subgraph samples more consistent with the actual distribution. Model training based on the subgraph samples can improve the accuracy of the trained model in the inference stage.

[0101] In the above implementation, the graph data sample is first input into the initial model to obtain the prediction results of the neighbor node samples in the graph data sample, and then the subgraph sample is obtained according to the generation time of the neighbor node sample. In another possible implementation, the node classification system 200 may also first obtain the initial subgraph of the graph data sample through the subgraph generation unit 222. The generation time of the neighbor node samples in the initial subgraph is earlier than that of the central node, but the neighbor node samples in the initial subgraph include true labels, and some neighbor node samples may be unlabeled nodes. The initial subgraph is then input into the initial model through the training unit 221 to obtain the prediction results of each unlabeled neighbor node sample in the initial subgraph, thereby obtaining a subgraph sample in which the generation time of the neighbor node samples is earlier than that of the central node, and each neighbor node sample includes a true label or a prediction result.

[0102] Sampling unit 223 is configured to sample the subgraph sample based on the prediction results of the plurality of neighbor node samples, thereby obtaining a plurality of sampled nodes. Specifically, the plurality of sampled nodes are nodes selected from the plurality of neighbor node samples in the subgraph sample according to the sampling strategy. It should be understood that by sampling the plurality of neighbor node samples in the subgraph sample and performing model training based on the sampled nodes, computational complexity can be reduced, thereby improving model training efficiency.

[0103] In one possible implementation, the sampling strategy may include: the similarity between the category distribution of multiple sampled nodes and the category distribution of multiple neighbor node samples in the subgraph sample is higher than a second threshold. The category distribution of the multiple neighbor node samples here refers to the category distribution of labeled neighbor nodes and unlabeled neighbor nodes. The category of the unlabeled neighbor nodes can be determined based on the prediction results, and the category of the labeled neighbor nodes can be determined based on their labels. In this way, each neighbor node can have its corresponding category, thereby obtaining the category distribution of multiple neighbor node samples. It should be understood that the number of labeled neighbor nodes in the graph data sample is limited, and many neighbor node samples are unlabeled. Therefore, there is a certain gap between the data distribution of labeled neighbor nodes and the data distribution of potential true neighbor nodes. The data distribution determined by the present application based on the prediction results of the neighbor node samples combined with the labels of the labeled neighbor nodes is more consistent with the true distribution. Then, the neighbor nodes are sampled according to such data distribution. The obtained sampling nodes can not only summarize the characteristics of the neighbor nodes, but also this feature is a feature that is consistent with the characteristics of the potential true distribution. Using such sampling nodes to participate in model training can not only reduce computational complexity but also improve model performance.

[0104] For example, suppose the central node in a subgraph node includes 100 neighbor nodes. Suppose that among these 100 neighbor nodes, there are 61 Class A nodes and 39 Class B nodes, which means the potential true distribution ratio is 61:39. However, there are only 10 labeled neighbor nodes, and the remaining 90 nodes are unlabeled neighbor nodes. Of these, 5 labeled neighbor nodes are Class A and 5 are Class B. Therefore, the class distribution obtained based on the labeled neighbor nodes is 1:1, which is significantly different from the potential true distribution ratio of 61:39. Sampling based on the class distribution of labeled neighbor nodes will result in a large gap between the sampled data distribution and the true distribution, resulting in poor model training results.

[0105] Using the node classification method provided in this application, the initial model is first used to predict 90 unlabeled neighbor nodes. Assuming that 60 unlabeled neighbor nodes are predicted to be class A and 30 unlabeled neighbor nodes are predicted to be class B, then based on the prediction results of the unlabeled neighbor nodes and the labels of the labeled neighbor nodes, it can be determined that the category distribution of these 100 neighbor nodes in the first round is 65:35=13:7. If the number of sampling nodes is 20, then there are 13 sampling nodes of class A and 7 sampling nodes of class B. It should be understood that compared with the category distribution of 1:1 obtained based on the labeled neighbor nodes, the category distribution of 13:7 obtained based on the prediction results of the unlabeled neighbor nodes and the labels of the labeled neighbor nodes is closer to the potential true distribution of 61:39. Sampling based on the category distribution obtained according to the prediction results of the unlabeled nodes and the labels of the labeled nodes can obtain sampling nodes that are closer to the true distribution. Model training in this way can improve model performance.

[0106] Furthermore, the model is trained for the first round using the 20 sampling nodes that are close to the potential true distribution to obtain a trained first model. The prediction ability of the first model is better than that of the initial model used in the first round. Using the first model to predict the category of unlabeled neighbor nodes can obtain more accurate prediction results than the initial model. The category distribution of multiple neighbor nodes obtained in this way will be closer to the potential true distribution than the category distribution of the first round obtained according to the initial model. Still taking the above example, the first model obtained in the first round of training is used to predict the above 90 unlabeled neighbor nodes, and 55 neighbor nodes of category A and 35 neighbor nodes of category B are determined. Combined with the labels of the 10 labeled neighbor nodes, the category distribution of the neighbor nodes in the second round can be obtained as 60:40=3:2. Compared with the category distribution of 65:35=13:7 in the first round, the category distribution of 60:40=3:2 determined in the second round is closer to the potential true distribution of 61:39. If the number of sampling nodes is 20, then there are 12 sampling nodes of category A and 8 sampling nodes of category B in the second round of sampling. Based on these 20, it is closer to the potential true distribution. A second model is obtained by performing a second round of training on the first model at the sampling nodes of the true distribution. The performance of the second model is better than that of the first model. Using the second model to predict the unlabeled neighbor nodes, a more accurate prediction result can be obtained than the first model. The category distribution of the third round determined in this way will be closer to the potential true distribution 61:39 than the second round. Then the third round of sampling is performed, and so on, until the model converges. The above method makes the distribution of neighbor nodes used in each round of training gradually approach the potential true distribution during multiple rounds of training. Using the category distribution close to the true distribution for sampling, the obtained sampling nodes are used to train the model to improve model performance.

[0107] In a specific implementation, the category distribution of the multiple neighbor node samples around the central node can be determined based on the prediction results of the multiple neighbor node samples obtained by the training unit 221 and the labels of the neighbor node samples. Then, the multiple neighbor node samples are sampled based on the category distribution and the training sampling parameters. In a specific implementation, the above-mentioned training sampling parameters can be set in advance by the user.

[0108] Optionally, the training sampling parameters may include the number of sampling nodes, that is, the number of neighbor node samples to be sampled. The number of sampling nodes of each category to be sampled can then be determined based on the category distribution of the neighbor node samples, so that the category distribution of the sampled nodes ultimately obtained is similar or consistent with the category distribution of the neighbor node samples.

[0109] Optionally, the training sampling parameters may include the number of sampling layers, which is used to perform stratified sampling on multiple neighbor node samples so that the category distribution of the finally obtained sampling nodes is similar or consistent with the category distribution of the neighbor node samples. In a specific implementation, after obtaining the category distribution of multiple neighbor node samples, the multiple neighbor node samples can be divided into multiple levels according to the number of sampling layers, and the samples in each level are samples of the same category. Then, stratified sampling is performed in different sampling layers so that the category distribution of the multiple sampling nodes obtained after sampling is similar or consistent with the category distribution of the multiple neighbor node samples. Different stratified sampling methods can be used according to needs, such as equidistant stratified sampling, geometric stratified sampling, etc., which are not specifically limited in this application.

[0110] It should be noted that the number of sampling layers input by the user can be the same as or different from the number of categories of neighbor node samples. In other words, samples of the same category can be divided into one level or multiple levels. For example, if the neighbor node samples have 5 categories and the number of sampling layers set by the user is 10, then the neighbor node samples of one category are divided into 2 levels. This application does not make specific restrictions. It is understandable that the number of neighbor node samples of certain categories may be significantly less than that of other categories. By dividing a category into multiple levels and sampling in each level, the impact of the classification imbalance problem of neighbor node samples on model training can be reduced. At the same time, by extracting neighbor node samples from the same category in multiple different levels, the sampled neighbor node samples can better represent the characteristics of the entire category and better cover the different characteristics and change trends of the category. The model trained using such sampling nodes can better adapt to the changes at each level when processing new unseen samples, thereby making the trained model have stronger generalization capabilities.

[0111] It should be understood that sampling can be completed only by the number of samples and the category distribution of samples of neighboring nodes, sampling can also be completed only by the number of sampling layers and the sample distribution of neighboring nodes, and sampling can also be completed based on the number of samples, the number of sampling layers and the category distribution of samples of neighboring nodes. This application does not limit the training sampling parameters. At the same time, although the above-mentioned number of sampling layers and number of samples are specific implementation methods of the training sampling parameters provided by this application, Figure 2 takes the training sampling parameters including the number of sampling layers as an example, however, the training sampling parameters can also be other parameters that can make the category distribution of the multiple sampling nodes finally collected similar or consistent with the category distribution of the neighboring node samples. This application does not limit this.

[0112] In some application scenarios, the features of the nodes in the graph data sample do not include the features of the time dimension. In this case, the graph data sample can be sampled directly to obtain multiple sampling nodes. That is to say, after obtaining the prediction results of the neighbor node samples through the initial model, each neighbor node sample in the graph data sample has a corresponding classification. This classification may be the real classification provided by the true label, or it may be the classification predicted by the prediction result. Then, according to the category distribution formed by multiple neighbor node samples, combined with the training sampling parameters input by the user, the multiple neighbor node samples in the graph data sample are stratified and sampled to obtain multiple sampling nodes.

[0113] It should be understood that the above solutions are only some possible implementation methods provided by this application, but the scope of protection of this application is not limited thereto. Any technician familiar with this technical field can easily think of various equivalent repairs or replacements within the technical scope disclosed in this application, and these repairs or replacements should be included in the scope of protection of this application.

[0114] The aggregation unit 224 is used to aggregate the features of multiple sampling nodes with the features of the central node to obtain the aggregated features of the central node.

[0115] In a specific implementation, the features of the sampling nodes and the central node can be vectorized first to obtain the feature vectors of the sampling nodes and the feature vectors of the central node, and then the feature aggregation of multiple sampling nodes and the central node can be achieved through the aggregation function.

[0116] Optionally, the aggregation function may include a sum pooling function, an average pooling function, a maximum pooling function, an attention function, etc. Sum pooling refers to weighted summing of the feature vectors of the sampling nodes and the feature vectors of the central node to obtain aggregate features; average pooling refers to weighted averaging of the feature vectors of the sampling nodes and the feature vectors of the central node to obtain aggregate features; maximum pooling refers to taking the maximum value of the feature vectors of the sampling nodes and the feature vectors of the central node as the aggregate feature; the attention function is used to calculate the weights of the central node and different sampling nodes, so that the aggregation process can automatically focus on important node features, and then obtain aggregate features by weighted summation or weighted averaging. In specific implementation, the most appropriate aggregation function can be selected to obtain the aggregate features of the central node according to the actual application scenario and business needs, and this application does not limit this.

[0117] In an embodiment of the present application, after the aggregation unit 224 obtains the aggregation features of the central node, the training unit 221 trains the initial model according to the aggregation features until the model converges to obtain a trained first model. In a specific implementation, the training unit 221 can input the aggregation features into the initial model to obtain the output result of the model, obtain the loss value (loss) according to the difference between the output result and the label of the central node, and then backpropagate the model parameters of the initial model according to the loss value to obtain an updated initial model, and then use the new central node graph data sample to input the updated initial model, generate a new subgraph sample through the subgraph generation unit 222, and then sample the new subgraph sample through the sampling unit 223 to obtain a new sampling node, and aggregate the features of the new sampling node with the features of the new central node through the aggregation unit 224 to obtain a new aggregation feature, and then input the new aggregation feature into the updated initial model to obtain a new output result, and obtain the loss value according to the difference between the new output result and the label of the new central node, and then backpropagate the updated initial model again according to the loss value to obtain a further updated initial model, and so on, through multiple rounds of iterative updates until the model converges to obtain the first model.

[0118] In a specific implementation, the multiple graph data samples participating in the training can be different subgraphs of the same large graph or graph data set at the same time. Each subgraph may include the same or different nodes. The graph data samples used in each round of training are subgraphs corresponding to different central nodes in the large graph or graph data. For example, the graph data at a certain moment includes nodes 1 to 10, then graph data sample 1 can be node 1 as the central node, and nodes 2 to 10 as neighbor node samples, graph data sample 2 can be node 2 as the central node, and nodes 1 and nodes 3 to 10 as neighbor node samples, and so on. This application does not limit this. The graph data samples participating in the training can also be different subgraphs of the same large graph at different times. For example, graph data sample 1 is a transaction network composed of transaction records before August 8, and graph data sample 2 is a transaction network composed of transaction records before August 9. Graph data sample 2 includes part of the content in graph data sample 1. The above examples are for illustration only and this application does not limit this.

[0119] It should be understood that the present application obtains subgraph samples based on graph data samples, then samples the subgraph samples to obtain sampling nodes, and then trains the model based on the aggregated features of the sampling nodes and the central node. This not only ensures that the generation time of the neighbor node samples participating in the training is earlier than that of the central node, but also ensures that the data distribution of the neighbor node samples participating in the training is consistent with the data distribution of all neighbor node samples, so that the features learned in the training phase are more consistent with the features in the inference phase, thereby improving the accuracy of the model.

[0120] Label generation unit 225 is configured to input the graph data sample into the trained first model, obtain prediction results for neighbor node samples in the graph data sample, and generate pseudo labels for the neighbor node samples based on the prediction results. As previously mentioned, the graph data sample includes both labeled and unlabeled nodes. Label generation unit 225 can generate pseudo labels for the unlabeled nodes while retaining the true labels for the labeled nodes.

[0121] Optionally, the confidence of the pseudo-label generated by the label generation unit 225 is higher than a pseudo-label threshold, where the pseudo-label threshold can be a user-set threshold or a default threshold, which is not specifically limited in this application. Confidence refers to the degree of confidence or certainty of the model in its prediction results. In classification tasks, confidence generally refers to the model's predicted probability or score for a certain category.

[0122] It should be understood that by retaining high-confidence pseudo-labels, the accuracy of the pseudo-labels involved in training can be improved, the introduction of noise can be reduced, and the effect of model training can be improved. At the same time, the number of labeled neighbor nodes in the graph data sample is limited, and many neighbor nodes are unlabeled. Therefore, there is a certain gap between the data distribution of labeled neighbor nodes and the data distribution of real neighbor nodes. By labeling high-confidence pseudo-labels, the training set participating in the next round of training includes labeled neighbor nodes and pseudo-labeled neighbor nodes. The data distribution of neighbor nodes in this training set is more consistent with the data distribution of potential real neighbor nodes. Using such a training set to further train the model can further improve the accuracy of the model.

[0123] In one embodiment, the training unit 221 can use the graph data samples marked with the above-mentioned pseudo-labels to perform a round of training on the first model. The training process can refer to the description of the aforementioned subgraph generation unit 222, sampling unit 223 and aggregation unit 224 to obtain a second model, and then use the verification set to verify the second model to obtain a verification result. If the verification result shows that the model performance has decreased, the above-mentioned pseudo-labels are removed. If the verification result shows that the model performance has improved, the above-mentioned pseudo-labels are retained. Then the next round of training is carried out, and so on, until the model converges to obtain a trained node classification model 230. The model convergence at this time can be that the performance reaches the preset index, or it can be that the pseudo-labels can no longer improve the model performance. This application does not limit the specific standard for model convergence.

[0124] Among them, the evaluation criteria of the above performance can be determined according to the specific application scenario. For example, the evaluation criteria of the model performance may include accuracy, which indicates the proportion of samples correctly predicted by the model to the total number of samples; it may also include precision and recall. Precision and recall are a pair of interrelated indicators. Precision indicates the proportion of samples predicted by the model as positive examples that are actually positive examples, while recall indicates the proportion of samples predicted as positive examples by the model that are actually positive examples; it may also include F1 score, which is the harmonic mean of precision and recall, and can comprehensively consider the accuracy and recall performance of the model. It should be understood that the above examples are for illustration only and are not specifically limited in this application.

[0125] The above training method performs multiple rounds of training on the model, and verifies the generated pseudo labels in each round of training, so that the pseudo labels used in each round of training are pseudo labels that can provide positive and beneficial effects to the model, so that the information in the unlabeled neighbor node samples can be maximized during the model training process to achieve the effect of data enhancement. In some scenarios where the number of real labels is small and difficult to label, a large number of unlabeled neighbor node samples can also be used to complete the model training, so that the node classification model 230 obtained through training has better accuracy and robustness.

[0126] At the same time, in the above training method, when sampling neighbor node samples, the sampling distribution fits the data distribution of neighbor node samples. When using pseudo labels to further train the model, the data distribution of neighbor node samples marked with pseudo labels fits the data distribution of neighbor node samples with real labels, so that the data distribution of neighbor node samples participating in model training fits the real distribution, which can avoid the problem of poor prediction effect of the model on a few categories due to sample imbalance. It should be understood that in some application scenarios, such as risk control scenarios, the number of fraudulent nodes is much lower than the number of normal nodes, and the influence of small category samples on the loss function is very small, which can be easily ignored during the optimization process. Sample imbalance can easily make it difficult for the model to predict fraudulent nodes. The training method provided in this application can greatly avoid the occurrence of such situations.

[0127] The functions of each unit module in the reasoning module 210 are described below.

[0128] The acquisition unit 211 is used to receive the graph data of the node to be predicted and the inference sampling parameters sent by the client 100.

[0129] In a specific implementation, graph data may include the node to be predicted and multiple neighboring nodes of the node to be predicted. The node to be predicted here is the central node mentioned above. In order to distinguish the central nodes in the training phase and the inference phase, the central nodes in the training phase are collectively referred to as central nodes, and the central nodes in the inference phase are collectively referred to as nodes to be predicted.

[0130] Optionally, the graph data of the node to be predicted and the graph data samples used in the training phase can be different subgraphs of the same graph, or different subgraphs of the same graph in different time periods. For example, the node to be predicted can be a newly added node in the graph data sample. For example, after the model is trained using the graph data samples corresponding to the transaction network to obtain the node classification model 230, a new transaction is added to the transaction network, and it is necessary to predict whether the transaction is a high-risk transaction. Then, the new transaction can be used as the node to be predicted, and other nodes associated with the new transaction can be used as neighbor nodes to generate graph data of the node to be predicted. For another example, after the node classification model 230 is obtained by training using the graph data samples corresponding to the product recommendation network, when a new product is added to the product recommendation network, and it is necessary to predict the user's preference for the product, then the new product can be used as the node to be predicted, and other products associated with the new product can be used as neighbor nodes to generate graph data of the node to be detected. It should be understood that the above examples are for illustration only and are not specifically limited in this application.

[0131] In the specific implementation, the above-mentioned inference sampling parameters include the number of samples or the number of sampling layers. The description of the number of samples and the number of sampling layers can refer to the relevant description under the training stage, which will not be repeated here. It should be noted that the number of sampling layers and the number of samplings input by the user in the inference stage can be the same or different from the number of sampling layers and the number of samplings in the training stage, and this application does not make any collective limitation.

[0132] The prediction unit 212 is used to input the graph data of the node to be predicted into the node classification model 230, and obtain one or more prediction results of the node to be detected according to the inference sampling parameters and sampling times input by the user.

[0133] Optionally, the prediction unit 212 can input graph data into the node classification model 230 to obtain the predicted categories of multiple neighboring nodes of the node to be detected, and then sample the multiple neighboring nodes based on the predicted categories of the multiple neighboring nodes and the category distribution of the true labels, combined with the inference sampling parameters input by the user, to obtain multiple sampling nodes, and then aggregate the features of the multiple sampling nodes with the features of the node to be detected to obtain aggregated features, and input the aggregated features into the node classification model 230 to obtain the prediction result of the node to be detected.

[0134] Optionally, the above-mentioned inference sampling parameters may further include a sampling count. The prediction unit 212 may further perform multiple samplings on multiple neighboring nodes based on the sampling count input by the user. Each sampling may obtain a sampling node set. Feature aggregation is then performed based on the multiple sampling node sets obtained from the multiple samplings to obtain aggregated features corresponding to each sampling, thereby obtaining multiple prediction results. The sampling count is the same as the number of prediction results. The sampling node sets obtained from different sampling counts have different neighboring nodes, thereby ensuring that the features of each neighboring node can participate in the model inference to the greatest extent possible, thereby improving the model's prediction accuracy.

[0135] It should be noted that if there are neighboring nodes in the graph data whose generation time is later than that of the node to be detected, then according to the description of the subgraph generation unit 222, the prediction unit 212 can first generate the subgraph to be detected corresponding to the graph data, and the generation time of the neighboring nodes in the subgraph to be detected is earlier than that of the node to be detected, and then the subgraph to be detected is sampled multiple times based on the above-mentioned inference sampling parameters and the number of sampling times. The specific description of sampling can refer to the relevant description of the aforementioned sampling unit 223, which will not be repeated here. Among them, the number of samples and the number of sampling layers in the above-mentioned inference sampling parameters can be the same as or different from the training sampling parameters in the training stage, which can be determined according to the actual application scenario and is not specifically limited in this application.

[0136] The voting unit 213 is used to determine the predicted category of the node to be detected according to the sampling times input by the user and the multiple prediction results generated by the prediction unit 212.

[0137] In a specific implementation, the voting unit 213 can determine the predicted category of the node to be detected through voting strategies such as majority voting, weighted voting, probability fusion, and voting threshold, wherein majority voting refers to voting based on the prediction results, and the category with the most votes is determined as the predicted category of the node to be detected; weighted voting refers to assigning a weight to each prediction result, calculating the average value based on the weight to obtain the final prediction result, and determining the predicted category of the node to be detected based on the final prediction result; probability fusion can calculate the average probability or maximum probability of the probability value corresponding to each prediction result to obtain the fusion probability, and then determine the predicted category of the node to be detected based on the fusion probability; voting threshold refers to setting a threshold. When the number of votes for the category with the most votes exceeds the threshold, the category can be confirmed as the predicted category of the node to be detected. It should be understood that the above examples are for illustration, and this application does not limit the voting strategy used by the voting unit 213.

[0138] It should be noted that the above voting strategy may also be a voting strategy set by the user. Specifically, the node classification system 200 may provide the user with multiple voting strategies for selection, or the voting strategy may be a voting strategy written by the user himself. This application does not limit this.

[0139] The output unit 214 is configured to feed back the predicted category determined by the voting unit 213 to the client 100 .

[0140] In a specific implementation, the output unit 214 can also send the predicted category to the storage system 300 for storage. Specifically, it can be determined based on the actual business scenario whether the prediction result is sent to the client 10 or the storage system 300, or both are fed back. This application does not make specific restrictions.

[0141] In summary, the present application provides a node classification system, which first predicts the category distribution of multiple neighbor node samples in the graph data sample, then obtains the training sampling parameters input by the user, samples the multiple neighbor node samples in the graph data sample to obtain multiple sampling nodes, so that the data distribution of the multiple sampling nodes is similar or consistent with the data distribution of the predicted multiple neighbor node samples, so that the data distribution of the sampling nodes obtained by sampling is closer to the distribution of potential real neighbor nodes, and the sampling nodes obtained by this method are used to participate in model training to improve model performance; and, the node classification system takes into account that the future neighbor nodes cannot participate in reasoning in the actual reasoning process, so the generation time of the sampling nodes participating in the training is earlier than that of the central node, so that the sampling nodes participating in the training can be more consistent with the real distribution in the reasoning stage, further improving the model. model performance; finally, the model is trained for multiple rounds according to the sampling nodes until the model converges. At the end of each round of training, the converged model will be used to predict high-confidence pseudo-labels of neighboring nodes, and the pseudo-labels will be verified through the validation set. The pseudo-labels that are beneficial to the model are retained, and the pseudo-labels that are not beneficial to the model are removed. Then, the next round of training is carried out. In this way, the pseudo-labels used in each round of training are pseudo-labels that can provide positive and beneficial effects to the model. During the model training process, the information in the unlabeled neighbor node samples can be maximized to achieve the effect of data enhancement. At the same time, by marking high-confidence pseudo-labels, the category distribution of the new training set formed by the labeled and pseudo-labeled samples is more consistent with the potential true distribution. Using such a training set to further train the model can further improve the accuracy of the model and improve the performance of the graph neural network.

[0142] The node classification system provided by this application is described in detail above in conjunction with Figures 1 and 2. The node classification method provided by this application will be described below in conjunction with Figures 3 to 6. Figures 3 and 4 describe the steps in the model training phase of the node classification method provided by this application, and Figures 5 and 6 describe the steps in the model inference phase of the node classification method provided by this application.

[0143] FIG3 is a flowchart of steps in a training phase of a node classification method provided by the present application. The method can be applied to the node classification system 200 shown in FIG1 and FIG2 . As shown in FIG3 , the model training method in the node classification method may include the following steps:

[0144] S310: The client 100 sends graph data samples and training sampling parameters to the node classification system 200. This step can be implemented by the acquisition unit 211 in the embodiment of FIG2.

[0145] The graph data sample is a graph data sample of a central node, including the central node and one or more neighboring nodes connected to the central node. The central node of the graph data sample may include a label, and the multiple neighboring nodes may include labeled nodes and unlabeled nodes. The label here is the actual category of the node. The central node and neighboring nodes both have corresponding feature information. For a detailed explanation of the graph data sample, please refer to the relevant description in the embodiment of Figure 2 and will not be repeated here.

[0146] In an embodiment of the present application, the training sampling parameters may include one or more of the number of samples, the number of sampling layers, and the pseudo-label threshold. The description of the number of samples, the number of sampling layers, and the pseudo-label threshold in the training sampling parameters can refer to the relevant description in the embodiment of Figure 2, and will not be repeated here.

[0147] S320: The node classification system 200 inputs the graph data sample into the initial model to obtain the category distribution of multiple neighbor node samples. This step can be implemented by the training unit 221 in the embodiment of FIG2 .

[0148] Referring to the above content, it can be seen that the multiple neighbor nodes in the graph data sample include labeled nodes and unlabeled nodes. The initial model can predict the unlabeled nodes to obtain the predicted category of the unlabeled nodes, and then determine the category distribution of the multiple neighbor nodes in the graph data sample based on the labels of the labeled nodes and the predicted category of the unlabeled nodes, that is, the proportion of neighbor nodes of each category in the multiple neighbor nodes. Among them, the initial model can be obtained by training the graph neural network using labeled samples or unlabeled samples. The graph neural network may include GraphSAGE, GCN, GAT, etc. The initial model can also be a supervised model, such as Random Forests, Multilayer Perceptron (MLP), etc., which is not specifically limited in this application.

[0149] For details, please refer to the relevant description in the embodiment of Figure 2, which will not be repeated here.

[0150] S330: The node classification system 200 determines a subgraph sample of the graph data sample according to the generation time of the central node. This step can be implemented by the subgraph generation unit 222 in the second embodiment of FIG.

[0151] In an embodiment of the present application, the subgraph sample includes a central node and multiple neighbor node samples, wherein the central node of the subgraph sample is the central node in the graph data sample, and the multiple neighbor node samples in the subgraph sample are neighbor node samples in the graph data sample whose generation time is earlier than that of the central node. It can be understood that during the model inference process, the generation time of the neighbor node samples is earlier than that of the central node. Because the future neighbor nodes cannot participate in the reasoning in the actual reasoning process, the neighbor node samples whose generation time is earlier than that of the central node are also used to participate in the training of the model during the model training process. This can make the multiple neighbor node samples in the subgraph sample more consistent with the actual distribution. Model training based on the subgraph sample can improve the accuracy of the trained model in the reasoning stage. For the specific description of the generated event, please refer to the relevant description in the embodiment of Figure 2, which will not be repeated here.

[0152] The subgraph samples obtained in the above steps S310 to S330 are one possible implementation method. In another possible implementation method, the node classification system 200 may also first obtain an initial subgraph of the graph data sample, in which the generation time of the neighbor node samples in the initial subgraph is earlier than that of the central node, but the neighbor node samples in the initial subgraph include true labels, and some neighbor node samples may be unlabeled nodes. The initial subgraph is then input into the initial model to obtain the prediction results of each unlabeled neighbor node sample in the initial subgraph, thereby obtaining a subgraph sample in which the generation time of the neighbor node samples is earlier than that of the central node, and each neighbor node sample includes a true label or a prediction result.

[0153] S340: The node classification system 200 samples multiple neighboring nodes in the subgraph sample according to the training sampling parameters and the category distribution of multiple neighboring node samples to obtain multiple sampled node samples. This step can be implemented by the sampling unit 223 in the embodiment of FIG2 .

[0154] In this embodiment of the present application, the similarity between the category distribution of the multiple sampled nodes and the category distribution of the multiple neighboring node samples in the subgraph sample is greater than a second threshold. This sampling method helps maintain a balanced category of sampled nodes, ensuring that neighboring node samples of each category are sufficiently involved during model training, thereby improving model accuracy.

[0155] In one possible implementation, multiple sampling nodes can be obtained based on the sampling number in the training sampling parameters. Specifically, the category distribution of the sampling nodes can be determined based on the category distribution of the neighboring nodes, which are the same or similar category distributions. Then, the number of sampling nodes of each category is determined based on the category distribution and sampling number of the sampling nodes. Then, neighbor nodes of corresponding numbers and categories are extracted from multiple neighboring nodes to obtain multiple sampling nodes.

[0156] In another possible implementation, multiple sampling nodes can be obtained according to the number of sampling layers in the training sampling parameters. In a specific implementation, after obtaining the category distribution of multiple neighbor node samples, the number of neighbor node samples of each category can be determined according to the total number of neighbor node samples, and then the number of neighbor node samples contained in each sampling layer can be determined according to the number of sampling layers input by the user in combination with the category of the neighbor node samples, wherein the samples of a sampling layer are samples of the same category, and the samples of a category can correspond to one or more sampling layers, and then sampling is performed in different sampling layers, so that the category distribution of the multiple sampling nodes obtained after sampling is similar or consistent with the category distribution of the multiple neighbor node samples. Different sampling methods can be used according to needs, such as simple random sampling, stratified cluster sampling, etc., which are not specifically limited in this application.

[0157] It should be noted that the number of sampling layers input by the user can be the same as or different from the number of categories of neighbor node samples. In other words, samples of the same category can be divided into one level or multiple levels. It is understandable that the number of neighbor node samples of certain categories may be significantly less than that of other categories. By dividing a category into multiple levels and sampling in each level, the impact of the classification imbalance problem of neighbor node samples on model training can be reduced.

[0158] For example, assuming that the number of sampling layers input by the user is 6, and the category distribution of neighbor node samples is 1:2:3, that is, the number of categories of neighbor node samples is 3, so the first category can be assigned to the first layer, the second category to the second and third layers, and the third category to the fourth to sixth layers. Assuming that the total number of neighbor node samples is N, then the number of neighbor node samples in each layer is N / 6. Then, a neighbor node sample is randomly selected from each layer as a round of sampling, and multiple rounds of random sampling are performed. In this way, no matter how many rounds of sampling are performed, the category distribution of the collected nodes obtained is 1:2:3. This ensures that the category distribution of the obtained sampling nodes is the same or similar to the category distribution of the neighbor nodes. The above examples are for illustration only and are not specifically limited in this application.

[0159] In some application scenarios, the features of the nodes in the graph data sample do not include the features of the time dimension. In this case, the graph data sample can be sampled directly to obtain multiple sampling nodes. That is to say, after obtaining the prediction results of the neighbor node samples through the initial model, each neighbor node sample in the graph data sample has a corresponding classification. This classification may be the real classification provided by the true label, or it may be the classification predicted by the prediction result. Then, according to the category distribution formed by multiple neighbor node samples, combined with the training sampling parameters input by the user, the multiple neighbor node samples in the graph data sample are stratified and sampled to obtain multiple sampling nodes.

[0160] S350: The node classification system 200 inputs the features of the plurality of sampled node samples into the initial model for training to obtain a first model. This step can be implemented by the aggregation unit 224 and the training unit 221 in the embodiment of FIG2 .

[0161] In an embodiment of the present application, the features of the sampling node samples and the features of the central node can be vectorized first to obtain the feature vectors of the sampling node samples and the feature vectors of the central node, and then the features of multiple sampling node samples and the central node are aggregated through an aggregation function to obtain the aggregated features of the central node, and then the initial model is trained according to the aggregated features until the model converges to obtain a trained first model.

[0162] Optionally, the aggregation function may include a sum pooling function, an average pooling function, a maximum pooling function, an attention function, etc. The specific explanation of the above multiple functions can refer to the relevant description of the aggregation unit 224 in the embodiment of Figure 2. They will not be repeated here. In the specific implementation, the most appropriate aggregation function can be selected according to the actual application scenario and business needs to obtain the aggregation characteristics of the central node. This application does not limit this.

[0163] In an embodiment of the present application, when the initial model is trained based on the aggregated features, the aggregated features can be first input into the initial model to obtain the output result, and then the loss is obtained based on the gap between the output result and the label of the central node. The model parameters of the initial model are then adjusted based on the loss to obtain an updated initial model. The graph data sample of the new central node is then input into the updated initial model to generate a new subgraph sample. The new subgraph sample is sampled to obtain a new sampling node. The features of the new sampling node are aggregated with the features of the new central node to obtain a new aggregated feature. The new aggregated feature is then input into the updated initial model to obtain a new output result. The loss is obtained based on the gap between the new output result and the label of the new central node. The model parameters of the updated initial model are adjusted again based on the loss to obtain a further updated initial model. This process is repeated many times until the model converges and the first model is obtained.

[0164] It should be understood that the present application obtains subgraph samples based on graph data samples, then samples the subgraph samples to obtain sampling nodes, and then trains the model based on the aggregated features of the sampling nodes and the central node. This not only ensures that the generation time of the neighbor node samples participating in the training is earlier than that of the central node, but also ensures that the data distribution of the neighbor node samples participating in the training is consistent with the data distribution of all neighbor node samples, so that the features learned in the training phase are more consistent with the features in the inference phase, thereby improving the accuracy of the model.

[0165] S360: The node classification system 200 generates pseudo labels for the graph data samples based on the first model and the pseudo label threshold, and uses the pseudo labels to train the first model to obtain a node classification model. This step can be implemented by the label generation unit 225 and the training unit 221 in the embodiment of FIG2 .

[0166] In the embodiment of the present application, the confidence of the pseudo-label is higher than the pseudo-label threshold input by the user. It should be understood that by retaining the high-confidence pseudo-label, the accuracy of the pseudo-label involved in the training can be improved, the introduction of noise can be reduced, and the effect of model training can be improved. At the same time, the number of labeled samples in the graph data samples is limited, and many samples are unlabeled. Therefore, there is a certain gap between the data distribution of the labeled samples and the actual true distribution. By labeling the high-confidence pseudo-label, the category distribution of the new training set formed by the labeled and pseudo-labeled samples is more consistent with the potential true distribution. Using such a training set to further train the model can further improve the accuracy of the model.

[0167] In the embodiment of the present application, a first model is trained using graph data samples labeled with the pseudo-labels to obtain a second model. The second model is then validated using a validation set to obtain a validation result. If the validation result shows that the model performance has degraded, the pseudo-labels are removed. If the validation result shows that the model performance has improved, the pseudo-labels are retained. The next round of training is then performed until the model converges, resulting in a trained node classification model.

[0168] The above implementation method can ensure that the pseudo labels used in each round of training are pseudo labels that can provide positive and beneficial effects to the model by training the model for multiple rounds and verifying the pseudo labels generated in each round of training. This allows the model training process to maximize the use of information in the unlabeled neighbor node samples to achieve data enhancement. In some scenarios where the number of real labels is small and difficult to label, a large number of unlabeled neighbor node samples can also be used to complete the model training, so that the node classification model 230 obtained by training has better accuracy and robustness. At the same time, when the model is further trained using pseudo labels, the data distribution of the training set formed by the pseudo labels and the real labels is more consistent with the real data distribution, which can improve the model performance. It should be understood that in some application scenarios, such as risk control scenarios, the number of fraudulent nodes is much lower than the number of normal nodes, and the influence of small category samples on the loss function is very small. They are easily ignored during the optimization process. Sample imbalance can easily make it difficult for the model to predict fraudulent nodes. The training method provided by this application can greatly avoid the occurrence of such situations.

[0169] S370: The node classification system 200 returns a training completion message to the client 100.

[0170] In one embodiment, the user can generate graph data based on his or her historical business data, and then input the graph data and training sampling parameters into the node classification system 200, and then wait for the node classification system 200 to complete the training of the node classification model based on the graph data. After receiving the message from the node classification system 200 that the training is completed, the user can input the graph data updated over time into the node classification model to obtain the predicted category of the newly added node. The node classification model obtained using this training method can fit the user's business scenario and can obtain more accurate classification results in the prediction stage.

[0171] The step flow shown in FIG3 is a possible implementation of the present application. The present application also provides other possible implementations, which are summarized below.

[0172] In a first possible implementation, graph data samples are input into an initial model to obtain a category distribution of a plurality of neighbor node samples, and then a plurality of neighbor nodes in a plurality of subgraph samples are sampled according to the training sampling parameters and the category distribution of a plurality of neighbor node samples to obtain a plurality of sampled node samples, and then the features of the plurality of sampled node samples are input into the initial model for training to obtain a node classification model. The training module 220 of the node classification system in this implementation only includes a sampling unit 223, a training unit 221 and an aggregation unit 224, and the step flow of this implementation includes step S310, and step S330 to step S350.

[0173] In another possible implementation, after obtaining the category distribution of multiple neighbor node samples, subgraph samples of the graph data sample are determined based on the generation time of the central node. The subgraph samples are then sampled to obtain multiple sampled node samples. The features of the multiple sampled node samples are input into the initial model for training to obtain a first model. The training module of the node classification system in this implementation includes a sampling unit 223, a training unit 221, an aggregation unit 224, and a subgraph generation unit 222. The steps of this implementation include steps S310 to S350.

[0174] In another possible implementation, after obtaining the first model, pseudo labels for graph data samples are generated based on the first model and the pseudo label threshold, and the first model is trained using the pseudo labels to obtain a node classification model. The training module of the node classification system in this implementation includes a sampling unit 223, a training unit 221, an aggregation unit 224, a subgraph generation unit 222, and a label generation unit 225. The step flow of this implementation includes steps S310 to S370.

[0175] It should be understood that the various schemes listed above are only some possible implementation methods provided by this application, but the scope of protection of this application is not limited thereto. Any technician familiar with this technical field can easily think of various equivalent repairs or replacements within the technical scope disclosed in this application, and these repairs or replacements should be included in the scope of protection of this application.

[0176] In order to make the present application better understood, the above steps S310 to S370 are illustrated below with reference to Figure 4. Figure 4 is a step flow chart of the training phase of a node classification method provided by the present application in an application scenario. In the application scenario shown in Figure 4, the graph data of the central node includes multiple neighbor nodes, and the multiple neighbor nodes include labeled nodes and unlabeled nodes. For example, Figure 4 shows 4 unlabeled nodes and 1 labeled node, and the label of the labeled node is category 2.

[0177] Execute S310 to obtain training sampling parameters and graph data samples. The training sampling parameters may include the number of sampling layers and the pseudo label threshold. Assume that the number of sampling layers is 2 and the pseudo label threshold is X.

[0178] Execute S320 to input the graph data sample into the initial model to obtain the predicted category of each unlabeled node, and then obtain a category distribution of neighbor nodes of 1:1, that is, 50% of the neighbor nodes are category 1 and 50% of the neighbor nodes are category 2.

[0179] Executing S330 can determine a subgraph sample of the graph data sample based on the generation time of the central node and the generation time of the neighbor nodes. The generation time of each neighbor node in the subgraph sample is earlier than the generation time of the central node. For example, the subgraph sample shown in Figure 4 includes 2 samples of category 1 and 2 samples of category 2, so the category distribution of the neighbor nodes in the subgraph sample is 1:1.

[0180] S340 is executed to sample the subgraph sample according to the number of sampling layers input by the user, obtaining multiple sampling node samples, wherein the category distribution of the sampling node samples is the same as the category distribution among the multiple neighboring nodes in the subgraph sample. Therefore, in the example shown in FIG4 , the number of sampling layers is 2, the first layer corresponds to the neighboring node samples of category 1, and the second layer corresponds to the neighboring node samples of category 2. Random sampling is performed alternately in the first and second layers, and the category distribution of the neighboring nodes in the subgraph sample is 1:1. Therefore, the number of sampling node samples of category 1 and the number of sampling node samples of category 2 obtained by sampling are the same. The specific steps of performing stratified sampling according to the number of sampling layers can be referred to the detailed description of S340 and sampling unit 223, which will not be repeated here.

[0181] Execute S350 to aggregate the features of multiple sampling nodes and the features of the central node to obtain the aggregated features of the central node, input the aggregated features into the initial model to obtain the output result, and backpropagate the model parameters of the initial model according to the loss value between the output result and the label of the central node to obtain the first model. If the first model does not converge, then the first model can continue to be trained using the new graph data sample of the central node, and then obtain new aggregated features through S310 to S350 again, and then use the new aggregated features to train the first model, and so on, until the first model converges. The convergence here can refer to the state where the model performance stops improving significantly and tends to be stable. The convergence judgment conditions are different in different application scenarios. For example, the convergence condition can be that the loss function reaches a stable state, and the model can be considered to have converged on the loss function; for example, the convergence condition can be that the parameter changes of the model reach a stable state, and the model parameters no longer need to be adjusted, and the model parameters can be considered to have converged; for example, the convergence condition can be that the accuracy of the model reaches a stable state, and the model can be considered to have converged on the accuracy. The above examples are for illustration only and are not specifically limited in this application.

[0182] After the first model converges, step S360 can be executed to input the graph data sample into the first model to obtain the prediction result of each neighbor node, and then retain the prediction result with a confidence level exceeding the pseudo label threshold X according to the pseudo label threshold X input by the user as the pseudo label of the neighbor node, obtain the graph data sample with the pseudo label, and use the graph data sample to train the first model, and then go through S310 to S350 again to obtain the aggregated features of the graph data sample with the pseudo label, and use the aggregated features to train the first model to obtain the second model, and then verify the second model on the verification set. If the model performance of the second model is worse than that of the first model, Then remove the pseudo labels generated by this round of training. If the model performance is improved, retain the pseudo labels used in this round of training, and then conduct the next round of training. In the next round, new graph data samples will be used to generate new pseudo labels, and then the first model will be trained. After S310 to S350, the aggregated features of the graph data samples carrying the new pseudo labels are obtained, and the aggregated features are used to train the first model to obtain the second model, and then the second model is verified on the verification set. According to the verification results, the pseudo labels used in this round of training are retained or deleted, until N consecutive rounds fail to improve the performance of the second model, the model training is completed, and a trained node classification model is obtained.

[0183] The training method provided by the present application is to obtain sampling nodes that fit the data distribution of the neighbor node samples by continuously sampling the neighbor nodes in the early stage, and then use the aggregation features of the sampling nodes to train the model, which can not only reduce the amount of calculation, but also ensure that the data distribution of the sampling nodes fits the real distribution, and can avoid the problem of poor prediction effect of the model on a few categories caused by sample imbalance. In the later stage, the model is trained one step further by pseudo-labeling, so that the nodes that have not been sampled can also be sampled through multiple rounds of training, and the generated pseudo-labels are verified in each round of training, so that the pseudo-labels used in each round of training can be pseudo-labels that can provide positive and beneficial effects to the model, so that the information in the unlabeled neighbor node samples can be maximized during the model training process to achieve the effect of data enhancement. In some scenarios where the number of real labels is small and difficult to label, a large number of unlabeled neighbor node samples can also be used to complete the model training, so that the node classification model 230 obtained by training has better accuracy and robustness.

[0184] The above describes in detail the step flow of model training in the node classification method provided by this application in combination with Figures 3 and 4. The following explains the step flow of model reasoning in the node method provided by this application in combination with Figures 5 and 6.

[0185] FIG5 is a schematic flow chart of the steps of a node classification method provided by the present application in the inference stage. As shown in FIG5 , the method may include the following steps:

[0186] S510: The client 100 sends the graph data of the node to be detected and the inference sampling parameters to the node classification system 200. This step can be implemented by the acquisition unit 211 in the embodiment of FIG2.

[0187] Optionally, the above-mentioned inference sampling parameters include the number of samples or the number of sampling layers. The definitions of the number of samples and the number of sampling layers are the same as the number of samples and the number of sampling layers in the training sampling parameters. It should be noted that the number of sampling layers and the number of sampling layers input by the user in the inference stage may be the same as or different from the number of sampling layers and the number of sampling layers in the training stage, and this application does not make any collective limitation.

[0188] Optionally, the above-mentioned inference sampling parameters also include a sampling count, which refers to the number of times the node classification system 200 samples multiple neighboring nodes. It should be understood that if the user does not enter a sampling count, a single sampling is performed, and the prediction result obtained based on this sampling is the predicted category of the node to be detected.

[0189] S520: The node classification system 200 inputs the graph data into the node classification model to obtain the category distribution of multiple neighbor nodes. This step can be implemented by the prediction unit 212 in the embodiment of FIG2 .

[0190] The specific implementation of this step is similar to step S320 in the training phase and will not be repeated here.

[0191] S530: The node classification system 200 samples multiple neighbor nodes multiple times based on the inference sampling parameters and the category distribution of multiple neighbor nodes to obtain multiple sampling node sets. This step can be implemented by the prediction unit 212 in the embodiment of FIG2 .

[0192] In a specific implementation, the node classification system 200 can perform multiple samplings on multiple neighbor nodes according to the number of samplings in the inference sampling parameters. Each sampling can obtain a sampling node set. There may be intersections between different sampling node sets, and the similarity between the category distribution of the sampling nodes in each sampling node set and the categories of multiple neighbor points is higher than the first threshold.

[0193] It should be noted that if there are neighbor nodes in the graph data whose generation time is later than that of the node to be detected, then the subgraph to be detected corresponding to the graph data can be generated first, and the generation time of the neighbor nodes in the subgraph to be detected is earlier than that of the node to be detected, and then the subgraph to be detected can be sampled multiple times based on the above-mentioned inference sampling parameters and sampling times.

[0194] The specific implementation of this step is similar to step S330 in the training phase and will not be repeated here.

[0195] S540: The node classification system 200 inputs the features of each sampled node set into the node classification model to obtain multiple prediction results of the nodes to be detected. This step can be implemented by the prediction unit 212 in the embodiment of FIG2 .

[0196] In a specific implementation, a sampling node set is input into a node classification model to obtain a prediction result of the node to be detected, that is, a sampling node set corresponds to a prediction result.

[0197] S550: The node classification system 200 determines the predicted category of the node to be detected based on the multiple prediction results of the node to be detected. This step can be implemented by the voting unit 213 in the embodiment of FIG2 .

[0198] In a specific implementation, the predicted category of the node to be detected can be determined by voting strategies such as majority voting, weighted voting, probability fusion, and voting threshold. The description of the voting strategy can refer to the relevant description of the aforementioned voting unit 213, which will not be repeated here.

[0199] S560: The node classification system 200 returns the predicted category of the node to be detected to the client 100. This step can be implemented by the output unit 214 in the embodiment of FIG2.

[0200] Optionally, the node classification system 200 can send the predicted category to the storage system 300 for storage. It should be understood that after obtaining the predicted category of the node to be detected, there may be different business processes for the predicted category in different application scenarios, and this application does not make specific limitations.

[0201] In order to make the present application better understood, the above steps S510 to S560 are illustrated below with reference to FIG6 . FIG6 is a flowchart of the steps of the inference phase of a node classification method provided by the present application in an application scenario. In the application scenario shown in FIG6 , the graph data of the node to be detected includes multiple neighbor nodes, and the multiple neighbor nodes include labeled nodes and unlabeled nodes. For example, FIG4 shows 4 unlabeled nodes and 1 labeled node, and the label of the labeled node is category 1. It should be noted that the structures of the graph data in FIG6 and FIG4 are very similar, but in actual application scenarios, the structure of the graph data in the inference phase may be the same as or different from the graph data structure in the training phase, and this application does not make specific limitations.

[0202] Execute S510 to obtain graph data and inference sampling parameters. The inference sampling parameters include the number of sampling layers and the number of sampling times. Assume that the number of sampling layers is 2 and the number of sampling times is Y.

[0203] Execute S520 to input the graph data into the node classification model to obtain the predicted categories of multiple neighbor nodes in the graph data. This results in a 1:1 category distribution of neighbor nodes, i.e., 50% of the neighbor nodes are category 1 and 50% of the neighbor nodes are category 2. This node classification model is the model trained in S310 to S370 in Figures 4 and 5.

[0204] Execute S530 to obtain Y sampling node sets according to the sampling number Y in the inference sampling parameter. Figure 6 exemplifies three of the sampling node sets. The sampling nodes in each sampling node set are different. However, in actual applications, some of the sampling nodes in the Y sampling node sets may intersect, and this application does not limit this.

[0205] Execute S540 to input each sampling node set into the node classification model to obtain multiple prediction results of the nodes to be detected.

[0206] Execute S550 to determine the predicted category of the node to be detected based on the multiple prediction results. For example, vote on the category of the node to be detected based on the multiple prediction results, and the category with the highest number of votes is the predicted category of the node to be detected.

[0207] It should be understood that the above reasoning method obtains multiple prediction results through multiple sampling, and then obtains the prediction category of the node to be detected based on voting based on the multiple prediction results. This can reduce the impact of random sampling on the prediction results, thereby improving the stability and reliability of the final results.

[0208] To facilitate a better understanding of this application, the node classification method provided by this application is further described below in conjunction with Figure 7. Figure 7 is an exemplary interface display diagram of the node classification method provided by this application. The interface shown in Figure 7 is an example and is not specifically limited by this application. As shown in Figure 7, the interface may include a first input area 710, a second input area 720, and a third input area 730.

[0209] The first input area 710 is used to input training sampling parameters, including but not limited to one or more of the number of sampling nodes, the number of sampling layers, and the pseudo-label threshold. The description of the number of sampling nodes, the number of sampling layers, and the pseudo-label threshold is referred to in the embodiments of Figures 2 to 4 above and will not be repeated here.

[0210] The second input area 720 is used to input inference sampling parameters, including but not limited to one or more of the number of sampling nodes, the number of sampling layers, and the number of sampling times. The description of the number of sampling nodes, the number of sampling layers, and the number of sampling times can be referred to the contents in the aforementioned Figures 2, 5, and 6 embodiments, and will not be repeated here.

[0211] The third input area 730 is used to input graph data samples used in the training phase. FIG7 exemplarily shows some parameter settings of the graph data samples, including but not limited to data type, data set name, import method, description, etc., which are not limited in this application. The input method of the graph data used in the reasoning phase is similar to the third input area 730, which is not shown in FIG7 . It should be understood that FIG7 is an exemplary interface. In actual application scenarios, the first input area 710, the second input area 720, and the third input area 730 may also include more content, and the interface shown in FIG7 may also include more input areas, such as the input area of ​​the graph data of the node to be detected used in the reasoning phase described above. This application does not limit FIG7 .

[0212] It is understandable that the node classification method provided by this application performs stratified sampling of multiple neighbor nodes in the graph data sample according to the predicted categories of multiple neighbor nodes based on the training sampling parameters input by the user during the training phase. The data distribution of the obtained sampled nodes is similar or consistent with the data distribution of the multiple neighbor nodes, which can avoid the problem of poor prediction effect of the model on a minority of categories due to sample imbalance. It should be understood that in some application scenarios, such as risk control scenarios, the number of fraudulent nodes is much lower than the number of normal nodes, and the impact of small category samples on the loss function is very small, which can be easily ignored during the optimization process. Sample imbalance can easily make it difficult for the model to predict fraudulent nodes. The training method provided by this application can greatly avoid the occurrence of such situations. At the same time, according to the inference sampling parameters input by the user, multiple pseudo labels of the graph data samples are obtained, and then the model is further trained using the pseudo labels. The generated pseudo labels are verified in each round of training, so that the pseudo labels used in each round of training are pseudo labels that can provide positive and beneficial effects on the model, so that the information in the unlabeled neighbor node samples can be maximized during the model training process to achieve the effect of data enhancement. In some scenarios where the number of real labels is small and difficult to label, a large number of unlabeled neighbor node samples can also be used to complete the model training.

[0213] In the inference stage, according to the inference sampling parameters input by the user, multiple neighbor nodes in the graph data are sampled multiple times to obtain multiple sampling node sets. Then, based on the multiple sampling node sets, multiple prediction results of the node to be detected are obtained. The prediction category of the node to be detected is obtained by voting based on the multiple prediction results. This can reduce the impact of random sampling on the prediction results, thereby improving the stability and reliability of the final results.

[0214] In summary, the present application provides a node classification method, which first predicts the category distribution of multiple neighbor nodes in the graph data, then obtains the training sampling parameters input by the user, samples multiple neighbor node samples in the graph data sample to obtain multiple sampling nodes, so that the category distribution of the multiple sampling nodes is similar or consistent with the category distribution of the predicted multiple neighbor node samples, so that the data distribution of the sampled sampling nodes is closer to the distribution of potential real neighbor nodes, and the sampling nodes obtained in this way are used to participate in model training to improve model performance; and, the node classification system takes into account that the future neighbor nodes cannot participate in reasoning in the actual reasoning process, so the generation time of the sampling nodes participating in the training is earlier than that of the central node, so that the sampling nodes participating in the training can be more consistent with the real distribution in the reasoning stage, further improving the model performance. Finally, the model is trained for multiple rounds according to the sampling nodes until the model converges. At the end of each round of training, the converged model will be used to predict high-confidence pseudo-labels of neighboring nodes. The pseudo-labels will be verified through the validation set, and the pseudo-labels that are beneficial to the model will be retained. The pseudo-labels that are not beneficial to the model will be removed, and then the next round of training will be carried out. In this way, the pseudo-labels used in each round of training are pseudo-labels that can provide positive and beneficial effects to the model. During the model training process, the information in the unlabeled neighbor node samples can be maximized to achieve the effect of data enhancement. At the same time, by marking high-confidence pseudo-labels, the category distribution of the new training set formed by the labeled and pseudo-labeled samples is more consistent with the potential true distribution. Using such a training set to further train the model can further improve the accuracy of the model and improve the performance of the graph neural network.

[0215] The node classification method provided by this application is described in detail above in conjunction with Figures 2 to 7. The computing device provided by this application will be described below in conjunction with Figure 8. Figure 8 is a schematic diagram of the structure of a computing device provided by this application, and the computing device 800 can be the node classification system 200 mentioned above.

[0216] Furthermore, the computing device 800 includes a processor 801, a storage unit 802, a storage medium 803 and a communication interface 804, wherein the processor 801, the storage unit 802, the storage medium 803 and the communication interface 804 communicate through a bus 805, and also communicate through other means such as wireless transmission.

[0217] The processor 801 is composed of multiple general-purpose processors, such as a CPU, an NPU, or a combination of a CPU and a hardware chip. The hardware chip is an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD is a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), a data processing unit (DPU), a system on chip (SoC), or any combination thereof. The processor 801 executes various types of digital storage instructions, such as software or firmware programs stored in the storage unit 802, which enables the computing device 800 to provide a wide variety of services.

[0218] In a specific implementation, as an embodiment, the processor 801 includes one or more CPUs, such as CPU0 and CPU1 shown in FIG8 .

[0219] In a specific implementation, as an embodiment, the computing device 800 also includes multiple processors, such as processor 801 and processor 806 shown in FIG8 . Each of these processors can be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). A processor here refers to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0220] The storage unit 802 is used to store program code and is controlled by the processor 801 to execute the processing steps of the node classification method in any of the embodiments of Figures 1 to 7. The program code includes one or more software units. The one or more software units are one or more of the training unit, subgraph generation unit, sampling unit, aggregation unit, label generation unit, acquisition unit, output unit, prediction unit, and voting unit in the embodiment of Figure 2, wherein the acquisition unit user obtains the graph data and inference sampling parameters of the node to be detected, specifically for implementing step S310 and its optional steps in the embodiments of Figures 3 and 4, and step S510 and its optional steps in the embodiments of Figures 5 and 6. The prediction unit is used to input the graph data into the node classification model to obtain the category distribution of multiple neighboring nodes, and then sample the multiple neighboring nodes according to the inference sampling parameters and the category distribution of the multiple neighboring nodes to obtain multiple sampled nodes, and then input the features of the multiple sampled nodes and the features of the node to be detected into the node classification model to obtain the predicted category of the node to be detected, specifically for implementing steps S520 to S560 and their optional steps in the embodiments of Figures 5 and 6. The training samples are used to input graph data into the initial model to obtain the category distribution of multiple neighbor node samples, and are also used to train the initial model based on the characteristics of multiple sampled node samples and the characteristics of the central node to obtain a node classification model, specifically for implementing steps S320 and S350 and their optional steps in the embodiments of Figures 3 and 4. The sampling unit is used to sample multiple neighbor node samples based on the training sampling parameters and the category distribution of neighbor node samples to obtain multiple sampled node samples, specifically for implementing step S340 and its optional steps in the embodiments of Figures 3 and 4. The label generation unit is used to generate pseudo labels based on the training sampling parameters, specifically for implementing step S360 and its optional steps in the embodiments of Figures 3 and 4. It should be understood that the specific description of the above-mentioned multiple software units can refer to the content in the embodiment of Figure 2 and will not be repeated here.

[0221] The storage unit 802 includes a read-only memory and a random access memory, and provides instructions and data to the processor 801. The storage unit 802 also includes a non-volatile random access memory. The storage unit 802 is a volatile memory or a non-volatile memory, or includes both volatile and non-volatile memories. Among them, the non-volatile memory is a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. The volatile memory is a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are used, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronized dynamic random access memory (SLDRAM), and direct RAM bus RAM (DR RAM). A hard disk, a universal serial bus (USB), a flash memory, a secure digital memory card (SD card), a memory stick, etc., and a hard disk can be a hard disk drive (HDD), a solid state drive (SSD), a mechanical hard disk (HDD), etc., which is not specifically limited in this application.

[0222] The storage medium 803 is a carrier for storing data, such as a hard disk, a universal serial bus (USB), a flash memory, a secure digital memory card (SD card), a memory stick, etc. The hard disk can be a hard disk drive (HDD), a solid state disk (SSD), a mechanical hard disk (HDD), etc., and this application does not make specific limitations.

[0223] The communication interface 804 is a wired interface (such as an Ethernet interface), an internal interface (such as a high-speed serial computer expansion bus (Peripheral Component Interconnect express, PCIe) bus interface), a wired interface (such as an Ethernet interface) or a wireless interface (such as a cellular network interface or a wireless local area network interface) used to communicate with other servers or units.

[0224] Bus 805 is a Peripheral Component Interconnect Express (PCIe) bus, an Extended Industry Standard Architecture (EISA) bus, a unified bus (UBus or UB), a Compute Express Link (CXL), or a Cache Coherent Interconnect for Accelerators (CCIX). Bus 805 is divided into an address bus, a data bus, and a control bus.

[0225] In addition to the data bus, the bus 805 also includes a power bus, a control bus, a status signal bus, etc. However, for the sake of clarity, various buses are labeled as the bus 805 in the figure.

[0226] It should be noted that FIG8 is only one possible implementation of the embodiment of the present application. In actual applications, the computing device 800 may also include more or fewer components, which is not limited here. For matters not shown or described in the embodiment of the present application, please refer to the relevant description in the embodiments of FIG1 to FIG6 above, and will not be repeated here.

[0227] The embodiment of the present application further provides a computing device cluster, which includes at least one computing device 800. The memory 803 in one or more computing devices 800 in the computing device cluster may store the same or different instructions for executing the node classification method.

[0228] The present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the node classification method.

[0229] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a high-density digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute the node classification method.

[0230] The above embodiments can be implemented in whole or in part through software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. A computer program product includes multiple computer instructions. When the computer program instructions are loaded or executed on a computer, the processes or functions according to the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another.

[0231] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent repairs or replacements within the technical scope disclosed in the present invention, and such repairs or replacements should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A node classification method based on graph neural network, characterized in that: The method comprises: Acquire graph data and reasoning sampling parameters of a node to be detected, wherein the graph data includes the node to be detected and a plurality of neighboring nodes connected to the node to be detected; Inputting the graph data into a node classification model to obtain category distribution of the plurality of neighbor nodes; According to the inference sampling parameter and the category distribution of the plurality of neighbor nodes, sampling the plurality of neighbor nodes to obtain a plurality of sampling nodes; The features of the multiple sampling nodes and the features of the node to be detected are input into the node classification model to obtain the predicted category of the node to be detected.

2. The method according to claim 1, characterized in that The similarity between the category distribution of the plurality of sampling nodes and the category distribution of the plurality of neighboring nodes is higher than a first threshold.

3. The method according to claim 1 or 2, characterized in that: The nodes to be detected include labeled nodes and unlabeled nodes. The category distribution of the multiple neighbor nodes is obtained based on the labels of the labeled nodes and the prediction results of the unlabeled nodes. The prediction results of the unlabeled nodes are obtained after the graph data is input into the node classification model.

4. The method according to any one of claims 1 to 3, characterized in that: The inference sampling parameters include the number of the sampling nodes; Alternatively, the inference sampling parameters include the number of sampling layers, which is used to perform stratified sampling on the multiple neighbor nodes according to the category distribution of the multiple neighbor nodes to obtain multiple sampling nodes, wherein each sampling layer includes multiple sampling nodes of the same category, and each category of sampling nodes corresponds to one or more sampling layers.

5. The method according to claim 4, characterized in that The inference sampling parameters include sampling times, which are used to perform multiple sampling on the multiple neighbor nodes. The multiple acquisition nodes include multiple acquisition node sets, and one acquisition node set corresponds to one sampling. The predicted category of the node to be detected is obtained based on multiple prediction results, and one prediction result is obtained by inputting the sampling node set into the node classification model.

6. The method according to any one of claims 1 to 5, characterized in that: Before obtaining the graph data and reasoning sampling parameters of the node to be detected, the method further includes: Obtain graph data samples and training parameters of the central node, wherein the graph data samples include the central node and a plurality of neighboring node samples connected to the central node, the training sampling parameters include the number of sampling nodes or the number of sampling layers, and the graph data of the node to be detected and the graph data sample of the central node are different subgraphs in the same graph; Inputting the graph data sample into an initial model to obtain the category distribution of the plurality of neighbor node samples; Sampling the plurality of neighbor node samples according to the training sampling parameters and the category distribution of the neighbor node samples to obtain a plurality of sampling node samples, wherein the similarity between the category distribution of the plurality of sampling nodes and the category distribution of the plurality of neighbor nodes is higher than a second threshold; The features of the multiple sampling node samples and the features of the central node are input into the initial model for training to obtain the node classification model.

7. The method according to claim 6, characterized in that The generation time of the samples of the multiple sampling nodes is earlier than the generation time of the central node.

8. The method according to claim 6 or 7, characterized in that: Inputting the features of the plurality of sampled node samples into the initial model for training to obtain the node classification model comprises: Inputting the features of the samples of the plurality of sampling nodes into the initial model for training to obtain a first model; Generate a pseudo label for the graph data sample based on the first model, and use the pseudo label to train the first model to obtain The node classification model.

9. The method according to claim 8, characterized in that The training sampling parameters include a pseudo label threshold, and the confidence of the pseudo label is higher than the pseudo label threshold.

10. The method according to any one of claims 1 to 9, characterized in that: The graph data includes any one of social media network graph data, transaction network graph data, commodity network graph data, knowledge graph, and biological molecular structure graph data.

11. A node classification system based on graph neural network, characterized in that: The system comprises: An acquisition unit, used to acquire graph data and reasoning sampling parameters of a node to be detected, wherein the graph data includes the node to be detected and a plurality of neighboring nodes connected to the node to be detected; A prediction unit, configured to input the graph data into a node classification model to obtain a category distribution of the plurality of neighbor nodes; The prediction unit is used to sample the multiple neighbor nodes according to the inference sampling parameters and the category distribution of the multiple neighbor nodes to obtain multiple sampling nodes; The prediction unit is used to input the features of the multiple sampling nodes and the features of the node to be detected into the node classification model to obtain the predicted category of the node to be detected.

12. The system according to claim 10, characterized in that The similarity between the category distribution of the plurality of sampling nodes and the category distribution of the plurality of neighboring nodes is higher than a first threshold.

13. The system according to claim 11 or 12, characterized in that The nodes to be detected include labeled nodes and unlabeled nodes. The category distribution of the multiple neighbor nodes is obtained based on the labels of the labeled nodes and the prediction results of the unlabeled nodes. The prediction results of the unlabeled nodes are obtained after the graph data is input into the node classification model.

14. The system according to any one of claims 11 to 13, characterized in that: The inference sampling parameters include the number of the sampling nodes; Alternatively, the inference sampling parameters include the number of sampling layers, which is used to perform stratified sampling on the multiple neighbor nodes according to the category distribution of the multiple neighbor nodes to obtain multiple sampling nodes, wherein each sampling layer includes multiple sampling nodes of the same category, and each category of sampling nodes corresponds to one or more sampling layers.

15. The system according to claim 14, characterized in that The inference sampling parameters include sampling times, which are used to perform multiple sampling on the multiple neighbor nodes. The multiple acquisition nodes include multiple acquisition node sets, and one acquisition node set corresponds to one sampling. The predicted category of the node to be detected is obtained based on multiple prediction results, and one prediction result is obtained by inputting the sampling node set into the node classification model.

16. The system according to any one of claims 11 to 15, characterized in that: The system also includes a training unit and a sampling unit. The training unit is used to obtain a graph data sample and training parameters of a central node before the acquisition unit obtains the graph data and reasoning sampling parameters of the node to be detected. The graph data sample includes the central node and a plurality of neighboring node samples connected to the central node. The training sampling parameters include the number of sampling nodes or the number of sampling layers. The graph data of the node to be detected and the graph data sample of the central node are different subgraphs in the same graph. The training unit is used to input the graph data sample into an initial model to obtain the category distribution of the plurality of neighbor node samples; The sampling unit is used to sample the multiple neighbor node samples according to the training sampling parameters and the category distribution of the neighbor node samples to obtain multiple sampling node samples, and the similarity between the category distribution of the multiple sampling nodes and the category distribution of the multiple neighbor nodes is higher than a second threshold; The training unit is used to input the features of the multiple sampling node samples and the features of the central node into the initial model for training to obtain the node classification model.

17. The system according to claim 16, characterized in that The generation time of the samples of the multiple sampling nodes is earlier than the generation time of the central node.

18. The system according to claim 16 or 17, characterized in that The system comprises a label generating unit, The training unit is used to input the features of the samples of the multiple sampling nodes into the initial model for training to obtain a first model; The label generation unit is used to generate pseudo labels for the graph data samples based on the first model, and use the pseudo labels to train the first model to obtain the node classification model.

19. The system according to claim 18, characterized in that The training sampling parameters include a pseudo label threshold, and the confidence of the pseudo label is higher than the pseudo label threshold.

20. The system according to any one of claims 11 to 19, characterized in that: The graph data includes any one of social media network graph data, transaction network graph data, commodity network graph data, knowledge graph, and biological molecular structure graph data.

21. A computing device, characterized in that The computing device includes a processor and a memory, wherein the memory is used to store instructions, and the processor is used to execute the instructions, so that the computing device implements the system according to any one of claims 1 to 10.

22. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and the instructions are executed by a computing device or a computing device cluster to implement the system according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Node classification method and system based on graph neural network, and related equipment

    CN119538017A

  • Complex network node classification method based on graph attention network

    CN112085124A

  • Method and device for training graph neural network based on privacy protection

    CN112464292A

  • Knowledge graph node classification method and system

    CN112559737A

  • Training method and device of graph neural network

    CN114707644A

Cited By

  • Deep learning-based crowd portrait interest map enhanced modeling method

    CN120541402A

  • Distributed railway anomaly detection model cooperative training method and system

    CN121388957A

  • RPS grouping prediction method and device based on depth characterization and probability modeling

    CN121435398A