Sub-graph and node-level sampling method and system
Through subgraph and node-level sampling methods, the subgraph and virtual neighborhood are constructed using community discovery algorithms and random walks, combined with parallel training and multi-party voting strategies, the problem of inefficient training of traditional graph neural networks is solved, and efficient training is achieved in massive graph data scenarios.
Patent Information
- Application Number
- CN202411837713.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-05-06
AI Technical Summary
Traditional graph neural network training methods are inefficient in massive graph data scenarios, and their computing costs are increasing exponentially, making them difficult to scale.
The subgraph and node-level sampling method are used to construct the subgraph of the training batch through the community discovery algorithm, and the virtual neighborhood is constructed through random walks to evaluate and sample the domain importance of the target node. Combining parallelized training and multi-party voting strategies for integrated prediction.
While ensuring the accuracy of the model, it significantly improves the training efficiency of graph neural networks and can process massive graph data more effectively.
Smart Images

Figure CN119939240A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine learning and deep learning technology, and in particular to a subgraph and node level sampling method and system. Background Art
[0002] The real world contains a lot of complex information, which usually presents a graph structure and is a typical non-Euclidean data. In recent years, graph neural network models based on deep learning methods have been proposed. They process graph data in an interpretable way and can be effectively used in various machine learning tasks, such as node classification and link prediction. They have become a research hotspot in industry and academia. However, training graph neural network models faces limitations and challenges in computational efficiency and storage. Researchers have explored the issue of how to achieve efficient training of graph neural networks under large-scale graph data in multiple dimensions. In addition, in the traditional full-batch training method, the parameters of the model are only updated once in each iteration, which makes the training gradient descent and model convergence of graph neural networks too slow, resulting in reduced training efficiency. In addition, graph neural network models usually need to aggregate the embeddings of adjacent nodes in a recursive way. As the number of layers increases, the computational cost increases exponentially, making it difficult to expand the training of traditional graph neural networks to massive graph data. In order to overcome the limitations of traditional training methods, various graph sampling mechanisms have been proposed and have achieved considerable results, making efficient training and scalability of graph neural networks possible, which has attracted widespread attention from researchers. Sampling is a data collection technique commonly used in research and statistics, which is the process of selecting a portion of individuals or observations from a population. In many cases, researchers cannot survey or observe the entire population because the population may be very large, time-consuming, or inaccessible. Therefore, through sampling methods, researchers can select a relatively small sample from the population and infer the characteristics and properties of the population by studying and analyzing the sample. Existing research on graph data sampling can be divided into three main categories, namely node-level, layer-level, and subgraph-level sampling methods. Information aggregation for graph neural network training is a complex process, in which the embedded representation of a node is recursively aggregated based on the feature representations of all sampled neighbor nodes.
[0003] However, with the rapid growth of graph data in real applications, sampling operations are becoming a time-consuming process, which greatly affects the efficiency of the aggregation stage and even the entire training. In existing studies, node-level sampling methods perform sampling and aggregation processes on nodes and their neighboring nodes based on specific probabilities instead of calculating all nodes. Although this can save costs to a certain extent, it cannot avoid exponential expansion because it still maintains a recursive aggregation method; layer-level sampling avoids the exponential expansion of adjacent nodes by jointly sampling multiple nodes at each layer, but this approach ignores the dependencies between nodes in the layers; subgraph-level sampling divides or splits the original large graph while ensuring node density, and then trains the model on the subgraph. This method can save computational costs to a large extent, but subgraph segmentation can cause problems such as unbalanced label distribution and loss of topological information. Summary of the invention
[0004] In view of the above existing problems, the present invention is proposed.
[0005] Therefore, the present invention provides a subgraph and node-level sampling method and system to solve the problem that the traditional training method is only updated once per iteration, which makes the gradient descent and model convergence speed of graph neural network training too slow, resulting in reduced training efficiency, and the graph neural network model usually needs to aggregate the embeddings of adjacent nodes in a recursive manner. As the number of layers increases, the computational cost increases exponentially, and the training of traditional graph neural networks is difficult to extend to massive graph data.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0007] In a first aspect, the present invention provides a subgraph and node level sampling method, comprising:
[0008] Obtaining a node set and an edge set, constructing an input graph of a graph neural network according to the node set and the edge set, and constructing a subgraph of a training batch based on the input graph using a first community discovery algorithm;
[0009] Based on the subgraph, a virtual neighborhood is constructed by random walk to evaluate and sample the domain importance of the target node;
[0010] Integrating the trained graph neural network to obtain a first graph neural network, using the first graph neural network as a basic learner, training homogeneous basic learners by parallelization, and performing integrated prediction by using a multi-party voting strategy;
[0011] The graph neural network is iteratively trained until a learning termination condition is reached.
[0012] As a preferred solution of the subgraph and node-level sampling method of the present invention, the subgraphs of the training batch are constructed by using the first community discovery algorithm, including:
[0013] The first community discovery algorithm is used to divide the input graph into different communities to obtain a subgraph sampling set;
[0014] Calculate the number of community subgraph samplings according to the sampling rate and obtain the subgraph sampling scale;
[0015] Extract different communities and merge them to obtain the subgraph for this round of training, and perform gradient descent and model optimization on the subgraph;
[0016] Repeat the iterative subgraph training operation to obtain the loss function of the gradient descent process.
[0017] As a preferred solution of the subgraph and node level sampling method of the present invention, the loss function includes:
[0018] The difference between the label of the target node and the node embedding representation of the node is summed and divided by the total number of nodes in this training to get the average loss.
[0019] As a preferred solution of the subgraph and node level sampling method of the present invention, constructing a virtual neighborhood by random walk includes:
[0020] Take the target node as the starting node, perform N random walks, and obtain N paths;
[0021] All domain nodes on N paths are virtual first-order neighbor nodes of the current target node;
[0022] The number of visits to the virtual domain node is recorded and used as an importance measurement indicator.
[0023] As a preferred solution of the subgraph and node level sampling method of the present invention, the evaluation and sampling of the domain importance of the target node includes:
[0024] When the fixed sampling number parameter of the current layer is set to M, the first M virtual domain nodes with the highest importance metric index are used as the virtual first-order neighbor domains of the current target node.
[0025] As a preferred solution of the subgraph and node level sampling method of the present invention, the integrated prediction using the multi-party voting strategy includes:
[0026] Preset model parameters according to the number of ensemble learners and build a basic learner;
[0027] Randomly sample the training set, input the samples to be tested into each basic learner, and obtain the classification results;
[0028] Multi-party voting is used to make integrated predictions on the test set samples.
[0029] As a preferred solution of the subgraph and node level sampling method of the present invention, the integrated prediction of the test set samples by multi-party voting includes:
[0030] Make independent predictions for the samples in the test set, vote on the prediction results of the samples, and select the category with the most votes as the final prediction result;
[0031] Or output the probability of belonging to each category, take a weighted average of all probabilities, and select the category with the highest probability as the final prediction result.
[0032] In a second aspect, the present invention provides a subgraph and node level sampling system, comprising:
[0033] A subgraph construction module is used to obtain a node set and an edge set, construct an input graph of a graph neural network according to the node set and the edge set, and construct a subgraph of a training batch based on the input graph using a first community discovery algorithm;
[0034] An evaluation module, used to construct a virtual neighborhood based on the subgraph by random walk, and evaluate and sample the domain importance of the target node;
[0035] A prediction module, used to integrate the trained graph neural network to obtain a first graph neural network, and use the first graph neural network as a basic learner, train homogeneous basic learners through parallelization, and perform integrated prediction using a multi-party voting strategy;
[0036] The iteration module is used to iteratively train the graph neural network until a learning termination condition is reached.
[0037] In a third aspect, the present invention provides a computing device, comprising:
[0038] Memory and processor;
[0039] The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the subgraph and node level sampling method are implemented.
[0040] In a fourth aspect, the present invention provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the subgraph and node-level sampling method.
[0041] Compared with the prior art, the present invention has the following beneficial effects: the present invention enables it to solve the problem of low training efficiency of graph neural networks in scenarios with massive graph data. Through multi-dimensional graph sampling optimization, it improves training efficiency while ensuring model accuracy. At the sub-graph level sampling level, a community discovery algorithm is used to divide sub-graphs to ensure embedding utilization within the sub-graph; at the node level sampling level, an importance-based neighborhood sampling method is performed based on random walks to improve the richness of information sets; in addition, the idea of integrated learning is combined to improve model stability and generalization, and it has good practical application value in balancing training efficiency and model accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0043] Figure 1 A schematic diagram of the overall process logic of the subgraph and node-level sampling method according to an embodiment of the present invention;
[0044] Figure 2 A flowchart of a subgraph and node-level sampling method according to an embodiment of the present invention;
[0045] Figure 3 A subgraph sampling module diagram based on a community discovery algorithm of a subgraph and node-level sampling method according to an embodiment of the present invention;
[0046] Figure 4 A diagram of a random walk-based importance node sampling module of a subgraph and node-level sampling method according to an embodiment of the present invention;
[0047] Figure 5 A parallel integrated learning module diagram based on a homogeneous combination strategy for a subgraph and node-level sampling method according to an embodiment of the present invention;
[0048] Figure 6 This is a performance comparison diagram of the subgraph and node-level sampling methods at different sampling rates according to an embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0050] Example 1
[0051] Reference Figure 1-Figure 5 , as an embodiment of the present invention, provides a subgraph and node level sampling method, comprising:
[0052] S100: Obtain a node set and an edge set, construct an input graph of the graph neural network according to the node set and the edge set, and construct a subgraph of a training batch based on the input graph using a first community discovery algorithm;
[0053] S200: Based on the subgraph, a virtual neighborhood is constructed through random walks to evaluate and sample the domain importance of the target node;
[0054] S300: Integrate the trained graph neural network to obtain a first graph neural network, use the first graph neural network as a basic learner, train homogeneous basic learners through parallelization, and use a multi-party voting strategy to perform integrated prediction;
[0055] S400: Iteratively train the graph neural network until a learning termination condition is reached.
[0056] It should be noted that if Figure 2 As shown in the figure, at the subgraph level sampling level, the graph data is converted into a subgraph set with community characteristics based on the community discovery algorithm, and the new subgraphs are resampled and merged to participate in the training, thereby improving the training efficiency while ensuring the density of graph connections; at the node level sampling level, the neighborhood importance of the target node is evaluated based on random walks and access probabilities, and high-order neighborhood information can be obtained at the same time to improve the richness of node information aggregation; in addition, the idea of parallel ensemble learning is introduced, and a multi-party voting mechanism is adopted to compensate for the information loss caused by subgraph and node sampling, thereby improving the generalization of the model.
[0057] In the embodiment of the present application, the above step S100 includes the following sub-steps A1-A4;
[0058] In A1: the first community discovery algorithm is used to divide the input graph into different communities to obtain a subgraph sampling set;
[0059] In A2: the number of community subgraph samplings is calculated according to the sampling rate to obtain the subgraph sampling scale;
[0060] In A3: extract different communities and merge them to obtain the subgraph for this round of training, and perform gradient descent and model optimization on the subgraph;
[0061] In A4: Repeat the iterative subgraph training operation to obtain the loss function of the gradient descent process.
[0062] In an optional embodiment, the first community discovery algorithm may include a spectral clustering algorithm, construct a matrix representing object similarity, construct a degree matrix, construct a Laplace matrix, calculate the eigenvectors corresponding to the first m eigenvalues of the Laplace matrix, form the eigenvectors into a matrix, and use a clustering algorithm to cluster the data in the matrix to obtain a final result; the first community discovery algorithm may also include a Kernighan-Lin algorithm, randomly divide the nodes in the graph into two subgraphs, for each pair of nodes belonging to different subgraphs, calculate the gain after exchanging them, select the node pair with the largest gain for exchange, and repeat the steps until no gain can be obtained through exchange;
[0063] In an optional embodiment, the first community discovery algorithm may also include a simulated annealing algorithm, randomly selecting an initial solution as a starting point, randomly selecting a new solution in the field of the current solution, and accepting the new solution if the new solution is better than the current solution; if the new solution is worse than the current solution, the new solution is accepted with a certain probability, and the probability gradually decreases over time, simulating the decrease in temperature during physical annealing, and repeating the steps until the termination condition is met;
[0064] In the embodiments of the present application, Figure 3 As shown, the first community discovery algorithm includes:
[0065] The training iteration process of the graph neural network begins. For the tth iteration, the subgraph of the training batch is constructed based on the Louvain community discovery algorithm subgraph sampling module SubgraphSample(·), which is expressed as:
[0066]
[0067] in, is the input graph of the graph neural network;
[0068] Specifically, the input graph of the graph neural network consists of a node set v and an edge set ε. Each node has an initial feature vector representation, which is generally the original attribute of the node, expressed as in Represents a set of nodes in a training batch;
[0069] Subgraph sampling is implemented based on the Louvain community discovery algorithm, and the sampling rate is pre-set to resample and merge the subgraph sets; Divided into M communities {S1,...,S M}, obtain a subgraph set with community characteristics as a subgraph sampling set; calculate the number of community subgraph sampling K = M k according to the sampling rate, and determine the subgraph sampling scale; randomly select K communities S1,…,S K , merge to get the subgraph for this round of training In the subgraph Perform gradient descent and model optimization on it.
[0070] Specifically, in the tth round of iteration of the graph neural network, the subgraph of the training batch of this round is constructed through the subgraph sampling module based on community discovery. While retaining the local characteristics of the nodes and the density of the graph structure, subgraph-level sampling is performed to construct small batch training data with community characteristics, which greatly improves the model training efficiency and scalability.
[0071] It should be noted that traditional small batch training directly extracts some nodes in a random manner, and the resulting dependency and connection density between the nodes in B cannot be guaranteed; the present invention introduces a sampling rate variable k to control the sampling scale, and randomly extracts M community subgraphs according to the sampling rate k to obtain a new subgraph for gradient descent and model update in this round of training, which helps to maintain the community structure characteristics in the graph. By resampling and merging the community subgraphs at a preset sampling rate, the number of nodes involved in each round of training can be controlled, thereby reducing the amount of calculation and improving training efficiency. Richer information can be captured during the training process, thereby improving the accuracy of the model.
[0072] In the embodiment of the present application, after completing steps A1-A4 in the above step S100, the following step A5 is also included;
[0073] In A5: The difference between the label of the target node and the node embedding representation of the node is summed and divided by the total number of nodes in this training to get the average loss.
[0074] Specifically, the loss function of the gradient descent process is expressed as:
[0075]
[0076] Among them, y u is the label of the target node u, is the node embedding representation of node u;
[0077] Before each round of training iteration, several communities are randomly selected from the community set according to the sampling rate k, and the nodes and edges in these communities are merged to obtain a new subgraph as the training sample for this round of iteration, and participate in the gradient descent of this round of model. The above process is repeated until the training termination condition is reached.
[0078] It should be noted that by calculating the loss function, the performance of the model on the current training batch can be accurately measured. By minimizing the loss function, the gradient descent algorithm can adjust the model parameters so that the model prediction is closer to the true label, thereby improving the accuracy of the model. Randomly extracting and merging communities within the community set can reduce the amount of calculation and improve training efficiency compared to directly training on the entire graph.
[0079] In the embodiment of the present application, the above step S200 includes the following sub-steps B1-B4;
[0080] In B1: take the target node as the starting node, perform N random walks, and obtain N paths;
[0081] In B2: all domain nodes on N paths are virtual first-order neighbor nodes of the current target node;
[0082] In B3: the number of visits to the virtual domain node is recorded and used as an importance measurement indicator.
[0083] In B4: when the fixed sampling number parameter of the current layer is set to M, the first M virtual domain nodes with the highest importance metric index are used as the virtual first-order neighbor domains of the current target node;
[0084] Specifically, Figure 4 As shown in the figure, during the tth round of training, for the neighborhood sampling and information aggregation process of the target node u, the importance node sampling process based on random walk is adopted to construct a virtual neighborhood Prioritize sampling and information aggregation of nodes that are more important to the target node. At the same time, when the number of model layers is set to 2 to 4, high-order neighborhood information can be obtained with a small computational overhead, thereby improving the richness of the current node aggregation information and further improving the model accuracy by optimizing the node sampling process.
[0085] Among them, the virtual neighborhood It is expressed as:
[0086]
[0087] in, is the set of all neighbor nodes;
[0088] It should be noted that the importance node-level sampling mechanism based on random walks gives priority to sampling and information aggregation of nodes that are more important to the target node. At the same time, it can obtain high-order neighborhood information with a smaller computational overhead when the number of model layers is low, thereby improving the richness of the current node aggregation information and further improving the model accuracy by optimizing the node sampling process.
[0089] In the embodiment of the present application, the above step S300 includes the following sub-steps C1-C3;
[0090] In C1: preset model parameters according to the number of ensemble learners and construct basic learners;
[0091] In C2: randomly sample the training set, input the test samples into each basic learner, and obtain the classification results;
[0092] In C3: Multi-party voting is used to make integrated predictions on the test set samples;
[0093] Specifically, Figure 5 As shown in the figure, the inductive graph neural network model is used as the basic learner, the voting method based on the combination strategy is combined with the parallel integration method based on training data, the homogeneous basic learner is trained in a parallel way, and the multi-party voting strategy is used in the prediction stage. Based on the parallel integration learning idea of the homogeneous combination strategy, the multi-party voting prediction strategy is adopted in the prediction stage to alleviate the accuracy loss problem caused by the graph sampling operation;
[0094] It should be noted that by combining the prediction results of multiple basic learners, model fusion is achieved, the shortcomings of a single learner are compensated, the variance of the model is reduced, and the generalization ability of the model is improved. Through multi-party voting, the errors of a single learner are reduced, the loss of model accuracy caused by the above-mentioned sampling operation is alleviated, and more stable and reliable prediction results are obtained. The differences between basic learners are introduced through ensemble learning to reduce the risk of overfitting of the model. Since the basic learners are trained on different subsets of training graphs, each basic learner can capture different data features and noise, thereby reducing the model's learning and prediction speed through parallel computing for specific training samples, which can significantly improve computing efficiency in large-scale graph data sets and complex graph neural network models.
[0095] In the embodiment of the present application, after completing steps C1-C3 in the above step S300, the following steps C4-C5 are also included;
[0096] In C4: make independent predictions for the samples in the test set, vote on the prediction results of the samples, and select the category with the most votes as the final prediction result;
[0097] In C5: either output the probability of belonging to each category, take a weighted average of all probabilities, and select the category with the highest probability as the final prediction result;
[0098] Specifically, multi-party voting includes hard voting and soft voting;
[0099] For example, hard voting includes that if 5 models predict the same sample, 3 models predict it as category A and 2 models predict it as category B, then the final prediction result is category A;
[0100] Soft voting includes, if the probability of a sample being classified as class A is predicted by three models as 0.7, 0.6, and 0.8 respectively, the average of these three probabilities is calculated, and the final prediction probability of class A is 0.7;
[0101] It should be noted that the training process of the graph neural network performs multi-dimensional sampling process optimization, including sub-graph level sampling based on the community development algorithm and importance node level sampling optimization based on random walks, and combines the idea of parallelized ensemble learning to achieve a balance between the training efficiency and model accuracy of the graph neural network model in massive data scenarios.
[0102] The above is a schematic scheme of a subgraph and node-level sampling method of this embodiment. It should be noted that the technical scheme of the subgraph and node-level sampling system and the technical scheme of the subgraph and node-level sampling method described above belong to the same concept. For details not described in detail in the technical scheme of the subgraph and node-level sampling system in this embodiment, please refer to the description of the technical scheme of the subgraph and node-level sampling method described above.
[0103] The subgraph and node level sampling system in this embodiment includes:
[0104] A subgraph construction module is used to obtain a node set and an edge set, construct an input graph of a graph neural network according to the node set and the edge set, and construct a subgraph of a training batch based on the input graph using a first community discovery algorithm;
[0105] An evaluation module, used to construct a virtual neighborhood based on the subgraph by random walk, and evaluate and sample the domain importance of the target node;
[0106] A prediction module, used to integrate the trained graph neural network to obtain a first graph neural network, and use the first graph neural network as a basic learner, train homogeneous basic learners through parallelization, and perform integrated prediction using a multi-party voting strategy;
[0107] The iteration module is used to iteratively train the graph neural network until a learning termination condition is reached.
[0108] This embodiment further provides a computing device, which is applicable to subgraph and node level sampling, including:
[0109] Memory and processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement the subgraph and node level sampling method proposed in the above embodiment.
[0110] This embodiment further provides a storage medium on which a computer program is stored. When the program is executed by a processor, the subgraph and node level sampling method proposed in the above embodiment is implemented.
[0111] The storage medium proposed in this embodiment and the method for implementing subgraph and node-level sampling proposed in the above embodiment belong to the same inventive concept. For technical details not fully described in this embodiment, please refer to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0112] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course can also be implemented by hardware. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ReadOnly, Memory, ROM), random access memory (Random Access Memory, RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform the methods of various embodiments of the present invention.
[0113] Example 2
[0114] Reference Figure 6 , which is different from the first embodiment, a verification test of a subgraph and node-level sampling method is provided to verify and illustrate the technical effects adopted in this method.
[0115] The parameters involved in the subgraph and node level sampling mechanism include: the number of node samplings at the node level, the subgraph sampling rate at the subgraph level, and the number of network layers;
[0116] The experiment was conducted on the public dataset AmazonCoBuyComputer (AmazonCBC for short), where nodes represent products, edges represent two products that are often purchased together, node features are bag-of-words encoded product reviews, and class labels are product categories. The parameter comparison experiments on the public dataset are used to illustrate the application significance and methods of each parameter in actual application scenarios.
[0117] The neighbor node sampling number parameter refers to the number of neighbor nodes of the target node participating in the information aggregation process before calculating the node embedding representation of the current layer for the current target node. It reflects the richness of node information aggregation. The setting of this parameter is based on the distribution of actual graph data. For example, for the data scale of the AmaCBC dataset (the number of nodes is 7650 and the number of edges is 287326), it is more appropriate to set the node sampling number to 5 to 10.
[0118] The number of model network layers can increase the network's expressiveness, enabling it to learn more complex graph structures and features. Deeper networks can capture more abstract and high-order graph patterns, thereby improving the performance of the model. However, increasing the number of layers in the graph neural network will increase the complexity of the model and increase the training time. In actual implementation, the number of layers is usually set to 2 to 3.
[0119] The subgraph sampling rate parameter controls the amount of data that participates in the gradient descent in each iteration of the model. A higher sampling rate has a positive effect on improving accuracy, but it also introduces additional computational overhead, such as Figure 6 As shown in the figure, when the sampling rate is set to 0.3, better performance can be achieved. In the application scenario, the adjustment of this parameter can be increased from bottom to top to balance accuracy and efficiency.
[0120] In summary, there are many graph data scenarios in real life, such as social network node analysis, recommendation systems, financial fraud prediction, etc. The problems to be solved in these scenarios can be abstracted as graph node classification problems. For graph node classification problems, graph neural networks can make full use of graph structure information and can show better performance than general machine learning and deep learning algorithms. However, it is precisely because of the complexity of the graph structure that the efficiency of the basic graph neural network algorithm is relatively low. The present invention achieves a balance between the prediction accuracy and training efficiency of the graph neural network.
[0121] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A subgraph and node level sampling method, characterized in that: include: Obtaining a node set and an edge set, constructing an input graph of a graph neural network according to the node set and the edge set, and constructing a subgraph of a training batch based on the input graph using a first community discovery algorithm; Based on the subgraph, a virtual neighborhood is constructed by random walk to evaluate and sample the domain importance of the target node; Integrating the trained graph neural network to obtain a first graph neural network, using the first graph neural network as a basic learner, training homogeneous basic learners by parallelization, and performing integrated prediction by using a multi-party voting strategy; The graph neural network is iteratively trained until a learning termination condition is reached.
2. The subgraph and node level sampling method according to claim 1, characterized in that: The subgraphs for constructing training batches using the first community discovery algorithm include: The first community discovery algorithm is used to divide the input graph into different communities to obtain a subgraph sampling set; Calculate the number of community subgraph samplings according to the sampling rate and obtain the subgraph sampling scale; Extract different communities and merge them to obtain the subgraph for this round of training, and perform gradient descent and model optimization on the subgraph; Repeat the iterative subgraph training operation to obtain the loss function of the gradient descent process.
3. The subgraph and node level sampling method according to claim 1 or 2, characterized in that: The loss functions include: The difference between the label of the target node and the node embedding representation of the node is summed and divided by the total number of nodes in this training to get the average loss.
4. The subgraph and node level sampling method according to claim 3, characterized in that: Constructing a virtual neighborhood through random walks includes: Take the target node as the starting node, perform N random walks, and obtain N paths; All domain nodes on N paths are virtual first-order neighbor nodes of the current target node; The number of visits to the virtual domain node is recorded and used as an importance measurement indicator.
5. The subgraph and node level sampling method according to claim 4, characterized in that: Evaluating and sampling the domain importance of target nodes includes: When the fixed sampling number parameter of the current layer is set to M, the first M virtual domain nodes with the highest importance metric index are used as the virtual first-order neighbor domains of the current target node.
6. The subgraph and node level sampling method according to claim 5, characterized in that: Ensemble prediction using multi-party voting strategies includes: Preset model parameters according to the number of ensemble learners and build a basic learner; Randomly sample the training set, input the samples to be tested into each basic learner, and obtain the classification results; Multi-party voting is used to make integrated predictions on the test set samples.
7. The subgraph and node level sampling method according to claim 6, characterized in that: The integrated prediction of the test set samples using multi-party voting includes: Make independent predictions for the samples in the test set, vote on the prediction results of the samples, and select the category with the most votes as the final prediction result; Or output the probability of belonging to each category, take a weighted average of all probabilities, and select the category with the highest probability as the final prediction result.
8. A system using the subgraph and node level sampling method according to any one of claims 1 to 7, characterized in that: include: A subgraph construction module is used to obtain a node set and an edge set, construct an input graph of a graph neural network according to the node set and the edge set, and construct a subgraph of a training batch based on the input graph using a first community discovery algorithm; An evaluation module, used to construct a virtual neighborhood based on the subgraph by random walk, and evaluate and sample the domain importance of the target node; A prediction module, used to integrate the trained graph neural network to obtain a first graph neural network, and use the first graph neural network as a basic learner, train homogeneous basic learners through parallelization, and perform integrated prediction using a multi-party voting strategy; The iteration module is used to iteratively train the graph neural network until a learning termination condition is reached.
9. An electronic device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the subgraph and node-level sampling method described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the subgraph and node-level sampling method described in any one of claims 1 to 7.