Graph data quality detection method based on reinforcement learning

By optimizing nodes and joint edge quality detection vectors based on reinforcement learning, the problem of incomplete quality detection of graph data is solved, and the training efficiency and accuracy of graph neural network models are improved.

CN120448974APending Publication Date: 2025-08-08NAT UNIV OF DEFENSE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510553828.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-29
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

Existing data quality detection methods are difficult to effectively detect the quality of graph data, especially in the problem of incomplete detection of the relationship between nodes and edges in graph data, resulting in extended model training time and errors in prediction results.

Method used

Using reinforcement learning-based method, by constructing node quality detection vectors and connected edge quality detection vectors, combining graph neural network models, the quality detection scores of nodes and connected edges are optimized, and these vectors are updated using reinforcement learning to improve the accuracy and efficiency of detection.

Benefits of technology

Effective detection of the quality of nodes and edges in the graph data is realized, reducing the time and calculation cost of model training, and improving the training performance and prediction accuracy of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448974A_ABST
    Figure CN120448974A_ABST
Patent Text Reader

Abstract

The invention discloses a graph data quality detection method based on reinforcement learning, and aims to realize effective detection of graph data quality. According to the technical scheme, a node quality detection vector Wv and a connecting edge quality detection vector W epsilon are constructed and optimized, sampling is carried out on a graph # imgabs0 # based on the optimized Wv and W epsilon, a training subgraph # imgabs1 # is formed, a model is trained based on # imgabs2 # and a label subset # imgabs3 #, and the optimized Wv and W epsilon are updated through reinforcement learning until convergence is carried out. And taking the updated and converged values of Wv and W epsilon as quality detection scores of nodes and connecting edges in the graph data, and carrying out quality detection on # imgabs4 #. According to the method, the quality detection of the nodes and the connecting edges in the graph data is realized through reinforcement learning and integration of the influence of the information of the nodes and the connecting edges in the graph data on the model, the problem that an existing method is not comprehensive in graph data quality detection is solved, the graph data quality detection time and calculation cost are reduced, and the detection efficiency is improved. The graph data detected by the method can reduce time consumption of model training.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of big data technology, and specifically relates to a data quality detection method for graph data, and in particular to a graph data quality detection method based on reinforcement learning. Background Art

[0002] With the continuous development of big data technology, graph data, as a complex data representation, is widely used in various fields, including social networks, recommendation systems, and financial risk control. Compared with traditional structured data, graph data can more fully express the relationships and interactions between objects, providing richer information support for data analysis.

[0003] Graph Neural Networks (GNNs), as deep learning models specialized for processing graph data, have demonstrated outstanding performance in tasks such as social network analysis and financial risk prediction. For GNNs to efficiently complete these tasks, they must be trained. During GNN training, the quality of the graph data plays a crucial role in determining GNN performance. For example, high-quality social networks can significantly improve GNN performance in this task, while low-quality networks can lead to errors in user information dissemination, prolonged model training time, and ultimately, erroneous predictions. However, due to the complex structure and diverse sources of graph data, it is often accompanied by quality issues such as missing attributes and incorrect labels. Therefore, effectively testing graph data quality has become a critical prerequisite for improving and optimizing GNNs.

[0004] Traditional data quality detection methods mostly rely on manually set data quality detection indicators such as consistency and accuracy, which are usually only applicable to specific types of data in specific fields (such as structured data in the fields of electricity, finance, etc.), and are difficult to generalize to the field of graph data. Existing data quality detection methods based on machine learning or deep learning are mostly based on Shapley Value, which uses multiple data sampling and model training to measure the marginal effect of each data sample on the model effect, and uses this marginal effect as the quality detection result of the data sample. However, the above method only focuses on the quality of a single data sample in the data set, and ignores the relationship between data samples. In graph data, the relationship between data samples (corresponding to the nodes of the graph) (the edges between nodes) also carries important information and is an indispensable part of the overall graph data structure. For example, a citation network can be represented by a graph. express, A node in the graph represents an academic paper, and the edges between nodes represent the citation relationships between papers.

[0005] Therefore, existing data quality testing methods struggle to effectively assess graph data quality, and there is currently no publicly available literature on methods for assessing graph data quality. Accurately and efficiently assessing graph data quality by comprehensively considering the relationships between nodes and edges in graph data has become a critical issue in the current data quality testing research field. Summary of the Invention

[0006] The technical problem to be solved by this invention is that existing data quality detection methods have difficulty effectively detecting graph data quality. This paper proposes a graph data quality detection method based on reinforcement learning. By using reinforcement learning and integrating the influence of information about nodes and edges in the graph data on the GNN model, the quality of the nodes and their edge relationships in the graph data can be detected. This solves the problems of poor adaptability and incomplete detection in existing methods for graph data quality detection, reduces the time required for model training using graph data, and improves model performance.

[0007] The present invention comprises the following steps:

[0008] The first step is data preparation and model preparation.

[0009] 1.1 Define a graph The node set For the picture The set of all nodes in , I am The total number of nodes in the node v i yes The i-th node in , 1≤i≤I. The edge set ε represents the graph The relationship between all nodes (i.e., edges), ε={e1,…,e j ,…,e J}, J is the total number of edges in ε, and the edge e j is the jth edge in ε, 1≤j≤J. Using the eigenvector x i Indicates v i The specific content (for example, if the Represents a citation network, node v i represents an academic paper, then x i v i header information), and v i Associate a label y i Indicates v i The annotation information, label y i That is v i Classification information, let the label set Y = {y1, ..., y i ,…,y I}.

[0010] 1.2 Build a GNN model f θ , f θ The input is The output is Classification prediction results of midpoints f θ The goal is to make the classification prediction results Try to be the same as the label set Y, then f θ Expressed as For example, for the node classification task of the citation network, a two-layer graph convolutional neural network GCN (Graph Convolution Networks) can be constructed, and a linear layer in GCN is connected with the softmax activation function to construct a node classification model f θ , and use the cross entropy loss function as f θ In fact, the present invention has a great impact on the θ The model structure is not restricted and can be adjusted according to the graph data and annotation information.

[0011] The second step is to initialize the quality detection vector and the reinforcement learning update round.

[0012] 2.1 Definition of node quality detection vector Represents node v i The quality score of is a random real number,

[0013] 2.2 Definition of edge quality detection vector Represents the edge e j The quality score of is a random real number,

[0014] 2.3 Define the variable t as the update round of reinforcement learning and initialize it to t = 1.

[0015] The third step is to optimize the node quality detection vector

[0016] 3.1 Computing Node Set The degrees of all nodes in the network are sorted to obtain the sorted node degree information set. The method is:

[0017] 3.1.1 Let variable i = 1;

[0018] 3.1.2 Computing Node v i Degree(v i ).v i Degree(vi ) is equal to v i The number of edges, such as v i With 5 edges, Degree(v i )=5;Degree(v i ) is put into the node degree information set D;

[0019] 3.1.3 Let i = i + 1; if i ≤ I, go to 3.1.2; if i > I, it means that the degrees of all nodes are obtained, and the node degree information set D is obtained, D = {Degree(v1), ..., Degree(v i ),…,Degree(v I )}, go to 3.1.4;

[0020] 3.1.4 Sort the elements in D from largest to smallest to obtain the sorted node degree information set Let Degree(v i )exist Sort(Degree(v i ))=Degree(v i )exist The serial number in. For example, Degree(v i )exist In the third place, Sort(Degree(v i ))=3.

[0021] 3.2 Using node degree information collection Optimize node quality detection vector That is, according to Sort(Degree(v1)) To enlarge or reduce or not adjust, ..., according to Sort(Degree(v i ))right To enlarge or reduce or not adjust, ..., according to Sort(Degree(v I ))right To enlarge, reduce, or not adjust, do the following:

[0022] 3.2.1 Let variable i = 1;

[0023] 3.2.2 Pair Optimize and adjust according to formula (1):

[0024]

[0025] Where γ is the adjustment parameter, 0.05≤γ≤0.5, and is usually set to 0.1.

[0026] The meaning of formula (1) is: According to Sort(Degree(ν i ))right Optimize if Then Zoom to if Then Reduce to No adjustment in other cases

[0027] 3.2.3 Let i = i + 1; if i ≤ I, go to 3.2.2; if i > I, explain Optimization completed, go to 3.3.

[0028] 3.3 Using normalization method The value in is limited to between 0 and 1, and the optimized node quality detection vector is obtained.

[0029] Step 4: Optimize the edge quality detection vector W ε , the method is:

[0030] 4.1 Calculate the degree of all edges in the edge set ε and sort the degrees of the edges to obtain the sorted edge degree information set The method is:

[0031] 4.1.1 Let variable j = 1;

[0032] 4.1.2 Calculating the edge e j Degree(e j ). e j The degree of e j The degrees of the two connected nodes are added together, such as e j The degrees of the two connected nodes are 3 and 4 respectively, then Degree(e j )=7;Degree(e j ) is put into the edge degree information set E.

[0033] 4.1.3 Let j = j + 1; if j ≤ J, go to 4.1.2; if j > J, it means that the degrees of all edges are obtained, and the edge degree information set E is obtained, E = {Degree(e1), ..., Degree(e j ),…,Degree(e J )}, go to 4.1.4;

[0034] 4.1.4 Sort the elements in E from largest to smallest to obtain the sorted edge degree information set Let Degree(e j )exist The sort value in Sort.Degree(e j ) / =Degree(e j )exist The serial number in Degree(e j )exist is in the third place, then Sort.Degree(e j ) / =3;

[0035] 4.2 Using edge degree information to optimize the edge quality detection vector W ε , that is, according to Sort(Degree(e1)) To enlarge or reduce or not adjust, ..., according to Sort.Degree(e j ) / right To enlarge or reduce or not adjust, ..., according to Sort.Degree(e J ) / to W eJ To enlarge, reduce, or not adjust; the method is:

[0036] 4.2.1 Let variable j = 1;

[0037] 4.2.2 Pair Optimize according to formula (2):

[0038]

[0039] 4.2.3 Let j = j + 1; if j ≤ J, go to 4.2.2; if j > J, then W ε Optimization completed, transfer to 4.3;

[0040] 4.3 Using the normalization method to transform W ε The value in is limited to between 0 and 1, and the optimized edge quality detection vector W is obtained. ε .

[0041] Step 5: Detect node quality based on the optimized vector and edge quality detection vector W ε right Sampling is performed to form a training subgraph

[0042] 5.1 The optimized node quality detection vector Quality detection score As midpoints ν1,…,ν i ,…,ν I The probability of being selected is calculated, and the nodes are sampled using the weighted random sampling (WRS) method, which is:

[0043] 5.1.1 Let the variable i = 1;

[0044] 5.1.2 Generate a random real number rand(i), 0 ≤ rand(i) ≤ 1; calculate ν according to formula (3) i Sampling fraction of nodes

[0045]

[0046] 5.1.3 Let i = i + 1; if i ≤ I, go to 5.1.2; if i > I, it means the calculation of the sampling fraction of nodes is completed, and the set of sampling fractions of nodes is obtained Go to 5.1.4.

[0047] 5.1.4 For S v Sort the sampling fractions of the nodes in S from large to small, and select the top N nodes as the sampled nodes to form a node subset N is the total number of nodes in is the nth node in That is, generally, select the nodes with the top 2 / 3 sampling fraction values as the sampled nodes to form a node subset

[0048] 5.2 Use the quality detection score of the optimized edge connection quality detection vector W ε as the probability of the edges e1,..., e <( j ,..., e <( J being selected in, and use the weighted random sampling WRS method to sample W ε for the edges. The method is:

[0049] 5.2.1 Let the variable j = 1;

[0050] 5.2.2 Generate a random real number rand(j), 0 ≤ rand(j) ≤ 1; calculate the sampling fraction of the edge e j according to formula (4)

[0051]

[0052] 5.2.3 Let j = j + 1; if j ≤ J, go to 5.2.2; if j > J, it means the calculation of the sampling fraction of the edges is completed, and the set of sampling fractions of the edges is obtained Go to 5.2.4.

[0053] 5.2.4 For S eSort the edge sampling fractions in descending order, select the top M edges as the sampled edges, and form an edge subset. M is the total number of edges in and the edge is the m-th edge in where 1 ≤ m ≤ M and 1 ≤ M < J. Generally, take

[0054] 5.3 Combine the node subset with the edge subset to form a graph, and delete the nodes in the graph that have no edges; delete the edges in the graph that connect less than 2 nodes to form a training subgraph. And according to the node subset [[ID=2I]] obtain the corresponding label subset from the label set Y

[0055] Step 6: Based on the training subgraph and the label subset train the GNN model f θ and update the optimized node quality detection vector and the optimized edge quality detection vector W ε . The method is:

[0056] 6.1 Input the training subgraph into the GNN model f θ . At this time, the input of f θ is and the output is the classification prediction results of the nodes in f θ [[ID=5D]]The classification objective is to make the classification prediction results as close as possible to the label subset . At this time, f θ is expressed as

[0057] 6.2 Train f θ and calculate the single-step reward of reinforcement learning. The method is:

[0058] 6.2.1 Use the GNN model f θ to perform information propagation on to obtain the node vector representations corresponding to each node in

[0059] 6.2.2 Use the linear layer of f θ to map the node vector representations to the probability distribution space.

[0060] 6.2.3 Use the softmax activation function to convert the node vector representation into a probability distribution and calculate the classification prediction result

[0061] 6.2.4 Based on classification prediction results With label subset Use the cross entropy loss function (i.e., formula (5)) to calculate f θ Model loss at the current reinforcement learning update round t

[0062]

[0063] and will Put it into the model loss array L, in For nodes Tags, for The prediction results, It means Get the log value;

[0064] 6.2.5 Calculation of f θ The historical average loss value δ, if t=1, f θ The historical average loss value If t>1, calculate δ according to formula (6):

[0065]

[0066] For example, if reinforcement learning has performed t = 3 updates and t-1 = 2, then

[0067] 6.2.6 Using f θ The model loss value Computing single-step rewards for reinforcement learning with δ As shown in formula (7):

[0068]

[0069] The single-step reward here Set to negative reward That is, f θ The smaller the model loss is, the better the training subgraph is. f θ The better the training effect, the higher the single-step reward. The larger the value, the smoother the gradient update strategy of reinforcement learning.

[0070] 6.3 Through single-step rewards Calculated using the policy gradient formula in reinforcement learning With W ε The gradient value As shown in formula (8):

[0071]

[0072] in, Indicated in the figure Select the training subgraph The probability of W V With W ε Decide; for The logarithmic derivative of ; for expectations, i.e. Formula (8) makes the selection strategy of quality detection vectors more inclined to those training subgraphs that can produce smaller model loss.

[0073] 6.4 Using the policy gradient update method (see Sutton, Richard S., et al. "Policy gradient methods for reinforcement learning with function approximation." Advances inneural information processing systems 12 (1999). Policy gradient methods for function approximation reinforcement learning) to use the gradient value After optimization With the optimized W ε Perform gradient update to obtain the updated quality detection vector and because After optimization With W ε Jointly determine, so when using the gradient value After optimization With W ε When updating, the optimized With W ε Based on the gradient value Update at the same time.

[0074] 6.5 Calculation and The mean absolute difference of the I elements in Calculate W ε and The average absolute difference ΔW of the J elements in ε , the method is:

[0075] 6.5.1 Let i = 1;

[0076] 6.5.2 Calculation and The i-th element in and The absolute difference ΔW i ,

[0077] 6.5.3 Let i = i + 1. If i ≤ I, go to 6.5.2. If i > I, go to 6.5.4.

[0078] 6.5.4 Calculation and The mean absolute difference

[0079] 6.5.5 Let j = 1;

[0080] 6.5.6 Calculation of W ε and The jth element in and The absolute difference ΔW j ,

[0081] 6.5.7 Let j = j + 1. If j ≤ J, go to 6.5.6. If j > J, go to 6.5.8.

[0082] 6.5.8 Calculation of W ε and The mean absolute difference ΔW ε ,

[0083] Step 7: Judgement With W ε Whether it converges, the method is:

[0084] 7.1 Let reinforcement learning update round t = t + 1. If And ΔW ε ≤0.0001, description With W ε Convergence, no further update is needed, at this time the update convergence is obtained With W ε , go to step 8; otherwise, let Go to step 3.

[0085] Step 8: Update the converged With W εThe value of is used as the quality detection score of nodes and edges in the graph data. Perform quality testing by:

[0086] Update after convergence Indicates that the node is GNN model f θ The probability of selection, update W after convergence ε Indicates that the edge is connected by the GNN model f θ The probability of selection. θ The greater the probability of selection, the more likely the node (edge) will be used for f θ Lower model loss can be obtained during training. Lower model loss means that θ The more favorable the model training is, the higher the quality of the node (edge). Therefore, the update obtained in step 7 is converged. With W ε The value of is directly used as the quality detection score of nodes and edges in the graph data; the higher the score, the better the quality of the node (edge), and the more conducive to model training. The methods for quality inspection are:

[0087] 8.1 Update after convergence Sort the elements in from largest to smallest, The nodes corresponding to the top 25% of the elements in the ranking are defined as high-quality nodes that are important for model training; The nodes corresponding to the 25% of elements after sorting are defined as low-quality nodes that have a negative effect on model training. Low-quality nodes are deleted during model training to ensure the training effect; The nodes corresponding to the middle 50% of the elements in the ranking are regarded as ordinary nodes, which have a certain positive effect on model training and are retained.

[0088] 8.2 Update W after convergence ε Sort the elements in W from large to small. ε The edges corresponding to the top 25% of the elements in the ranking are defined as high-quality edges that are important for model training. ε The edges corresponding to the 25% of elements after sorting are defined as low-quality edges that have a negative effect on model training. Low-quality edges are deleted during model training to ensure the training effect. ε The edges corresponding to the middle 50% of the elements in the ranking are regarded as trivial edges, which have a certain positive effect on model training and are retained.

[0089] Step 9. End.

[0090] The present invention can achieve the following technical effects:

[0091] 1. By setting node quality detection vectors and edge quality detection vectors and optimizing them using reinforcement learning, the present invention can simultaneously detect the quality of nodes and edges in graph data, effectively solving the problems of poor adaptability and incomplete detection of graph data quality in existing methods.

[0092] 2. The present invention simultaneously carries out the training process of the graph neural network model and the graph data quality detection process to achieve collaborative optimization of model training and quality detection; introduces node degree information as a constraint to guide the quality detection vector to converge more quickly; collaborative optimization and the introduction of node degree information can significantly reduce the time overhead of graph data quality detection and reduce computational costs.

[0093] 3. The graph data detected by the present invention can reduce the time consumption of model training when the graph data is used for training, and improve the performance of the trained model. BRIEF DESCRIPTION OF THE DRAWINGS

[0094] Figure 1 This is a flow chart of the graph data quality detection method based on reinforcement learning of the present invention.

[0095] Figure 2 The first step of the embodiment is to construct a graph based on a citation network.

[0096] Figure 3 The fourth step of the embodiment is based on Figure 2 shown Generated training subgraph DETAILED DESCRIPTION

[0097] The following describes an embodiment of the present invention using a citation network as graph data. Figure 1 As shown, the following steps are included:

[0098] The first step is data preparation and model preparation.

[0099] 1.1 Define a Figure 2 The citation network shown The node set is the set of all papers in the network, I is The total number of papers in Figure 2where I = 4. The edge set ε = {.v1,v2 / , .v2,v3 / , .v3,v4 / , .v4,v1 / , .v2,v4 / } represents the set of all paper citation relationships in the network. J is the total number of citation relationships in ε, where J = 5. The title information of the four nodes constitutes the corresponding feature vectors x1, x2, x3, and x4, respectively. The node labels are {Biology, Mathematics, Sociology, Computer Science}. For convenience, numbers can be used instead of node labels, that is, {Biology, Mathematics, Sociology, Computer Science} is represented by {1, 2, 3, 4}.

[0100] 1.2 Building the GNN model f θ : Based on a two-layer graph convolutional neural network, a linear layer is connected with a softmax activation function to build a graph node classification model f θ .f θ The input is the initial feature vectors x1, x2, x3, x4 of nodes v1, v2, v3, v4 in the citation network, and the connection relationships with the citation network (v1, v2), (v2, v3), (v3, v4), (v4, v1), (v2, v4); f θ The output is the classification result of the node. For example, for node v1, f θ The output may be 2, indicating that f θ Determine v1 as the second type of mathematics.

[0101] The second step is to initialize the quality detection vector and the update round of reinforcement learning.

[0102] 2.1 Initialization quality detection vector: Randomly initialize the node quality detection vector to

[0103] 2.2 Randomly initialize the edge quality detection vector to W ε ={0.5,0.4,0.3,0.2,0.1};

[0104] 2.3 Define variable t as the update round of reinforcement learning and initialize variable t = 1.

[0105] The third step is to optimize the node quality detection vector

[0106] 3.1 Computing Node Set The degrees of all nodes in the network are sorted to obtain the sorted node degree information set. The method is:

[0107] 3.1.1 Let variable i = 1;

[0108] 3.1.2 Computing Node v i Degree(vi ).v i Degree(v i ) is equal to v i The number of edges, such as v i With 5 edges, Degree(v i )=5;Degree(v i ) is put into the node degree information set D;

[0109] 3.1.3 Let i = i + 1; if i ≤ I, go to 3.1.2; if i > I, it means that the degrees of all nodes are obtained, and the node degree information set D is obtained, D = {Degree(v1), ..., Degree(v i ),…,Degree(v I )}, go to 3.1.4;

[0110] 3.1.4 Sort the elements in D from largest to smallest to obtain the sorted node degree information set Let Degree(v i )exist Sort(Degree(v i ))=Degree(v i )exist The serial number in. For example, Degree(v i )exist In the third place, Sort(Degree(v i ))=3.

[0111] 3.2 Using node degree information collection Optimize node quality detection vector That is, according to Sort(Degree(v1)) To enlarge or reduce or not adjust, ..., according to Sort(Degree(v i ))right To enlarge or reduce or not adjust, ..., according to Sort(Degree(v I ))right To enlarge, reduce, or not adjust, do the following:

[0112] 3.2.1 Let variable i = 1;

[0113] 3.2.2 Pair Optimize and adjust according to formula (1):

[0114]

[0115] Where γ is the adjustment parameter, 0.05≤γ≤0.5, and is usually set to 0.1.

[0116] The meaning of formula (1) is: According to Sort(Degree(v i ))right Optimize if Then Zoom to if Then Reduce to No adjustment in other cases

[0117] 3.2.3 Let i = i + 1; if i ≤ I, go to 3.2.2; if i > I, explain Optimization completed, go to 3.3.

[0118] 3.3 Using normalization method The value in is limited to between 0 and 1, and the optimized node quality detection vector is obtained.

[0119] For Figure 2 The citation network shown Node degree information use Find the top 1 / 3 nodes as v2, and adjust the quality score of v2 according to formula (1) The nodes in the bottom 1 / 3 of the ranking are v4, which is adjusted to Get the optimized node quality detection vector

[0120] The fourth step is to optimize the edge quality detection vector.

[0121] 4.1 Calculate the degree of all edges in the edge set ε and sort the degrees of the edges to obtain the sorted edge degree information set The method is:

[0122] 4.1.1 Let variable j = 1;

[0123] 4.1.2 Calculating the edge e j Degree(e j ). e j The degree of e j The degrees of the two connected nodes are added together, such as e j The degrees of the two connected nodes are 3 and 4 respectively, then Degree(e j )=7;Degree(e j ) is put into the edge degree information set E.

[0124] 4.1.3 Let j = j + 1; if j ≤ J, go to 4.1.2; if j > J, it means that the degrees of all edges are obtained, and the edge degree information set E is obtained, E = {Degree(e1), ..., Degree(e j ),…,Degree(e J )}, go to 4.1.4;

[0125] 4.1.4 Sort the elements in E from largest to smallest to obtain the sorted edge degree information set Let Degree(e j )exist The sort value in Sort.Degree(e j ) / =Degree(e j )exist The serial number in Degree(e j )exist is in the third place, then Sort.Degree(e j ) / =3;

[0126] 4.2 Using edge degree information to optimize the edge quality detection vector W ε , that is, according to Sort(Degree(e1)) To enlarge or reduce or not adjust, ..., according to Sort.Degree(e j ) / right To enlarge or reduce or not adjust, ..., according to Sort.Degree(e J ) / right To enlarge, reduce, or not adjust; the method is:

[0127] 4.2.1 Let variable j = 1;

[0128] 4.2.2 Pair Optimize according to formula (2):

[0129]

[0130] 4.2.3 Let j = j + 1; if j ≤ J, go to 4.2.2; if j > J, then W ε Optimization completed, transfer to 4.3;

[0131] 4.3 Using the normalization method to transform W ε The value in is limited to between 0 and 1, and the optimized edge quality detection vector W is obtained. ε .

[0132] For Figure 2 The citation network shown The degree information of the connected edges Degree(ε) = {5, 5, 4, 4, 5}, and similarly, adjust the connected edge quality detection vector W ε = {0.55, 0.4, 0.3, 0.18, 0.1}.

[0133] Step 5, based on the optimized and W ε sample the citation network to form a training subgraph

[0134] 5.1 Take the quality detection scores of the optimized node quality detection vector as the probabilities that the nodes v1,..., v ,..., v i ,..., v I are selected, and use the weighted random sampling method to sample the nodes. The method is as follows:

[0135] 5.1.1 Let the variable i = 1;

[0136] 5.1.2 Generate a random real number rand(i), 0 ≤ rand(i) ≤ 1; calculate the sampling fraction of the v i node according to formula (3)<00007​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​Calculate the weighted random sampling scores of nodes v2, v3, and v4 in the same way as the above calculation process, and let the set S of the calculated weighted random sampling scores v ={4, 6, 9.1, 2}. After sorting from small to large, take the first 2 / 3 of the nodes, then the sampled nodes v1, v2, v3 form a node subset

[0141] 5.2 Use the optimized edge connection quality detection vector W ε The quality detection score of As The probability that the edges e1,..., e j ,..., e J Are selected, and use the weighted random sampling WRS method to sample the edges of W ε The method is as follows:

[0142] 5.2.1 Let the variable j = 1;

[0143] 5.2.2 Generate a random real number rand(j), 0 ≤ rand(j) ≤ 1; calculate the sampling score of the edge e j According to formula (4)

[0144]

[0145] 5.2.3 Let j = j + 1; if j ≤ J, go to 5.2.2; if j > J, it means that the calculation of the edge sampling score is over, and the set of edge sampling scores is obtained Go to 5.2.4.

[0146] 5.2.4 Sort the edge sampling scores in S e From large to small, and take the first M edges as the sampled edges to form an edge subset M is The total number of edges in Is The m-th edge in 1 ≤ m ≤ M, 1 ≤ M < J. Generally take That is, take the first 2 / 3 of the edges with the highest edge sampling scores as the sampled edges to form an edge subset

[0147] In the embodiment, with W ε ={0.55, 0.4, 0.3, 0.18, 0.1} as the weights, calculate the set S of the weighted random sampling scores of the edges e And take the first 2 / 3 of the edges for sampling. Assume that after sampling, an edge subset

[0148] 5.3 The node subset and edge subsets Combine into a graph, delete the nodes without edges in the graph; delete the edges with less than 2 connected nodes in the graph to form a training subgraph And based on the node subset Get the corresponding label subset from the label set Y

[0149] In the embodiment, the node subset and edge subsets Combination formation Figure 3 The training subgraph shown And remove isolated nodes and edges with less than 2 connected nodes. In this example, there are no isolated nodes, but the two edges (v3, v4) and (v4, v1) are removed because the v4 node is not sampled and the number of connected nodes is 1. Finally, the node subset and edge subsets Combine to form training subgraph And according to Get the corresponding label subset from the label set Y

[0150] Step 6: Based on the training subgraph With label subset For the GNN model f θ Conduct training.

[0151] 6.1 Training Subgraph Input GNN model f θ , at this time f θ The input is The output is Classification prediction results of midpoints f θ The classification goal is to make the classification prediction result Try to subset with tags Same, at this time f θ Expressed as

[0152] 6.2 for f θ Perform training and calculate the single-step reward of reinforcement learning. The method is:

[0153] 6.2.1 Using GNN model f θ right Spread information and get The node vector corresponding to each node in is represented;

[0154] 6.2.2 Using f θ The linear layer maps the node vector representation to the probability distribution space;

[0155] 6.2.3 Use the softmax activation function to convert the node vector representation into a probability distribution and calculate the classification prediction result

[0156] 6.2.4 Based on classification prediction results With label subset Use the cross entropy loss function (i.e., formula (5)) to calculate f θ Model loss at the current reinforcement learning update round t

[0157]

[0158] and will Put it into the model loss array L, in For nodes Tags, for The prediction results, It means Get the log value;

[0159] 6.2.5 Calculation of f θ The historical average loss value δ, if t=1, f θ The historical average loss value If t>1, calculate δ according to formula (6):

[0160]

[0161] For example, if reinforcement learning has performed t = 3 updates and t-1 = 2, then

[0162] 6.2.6 Using f θ The model loss value Computing single-step rewards for reinforcement learning with δ As shown in formula (7):

[0163]

[0164] The single-step reward here Set to negative reward That is, f θ The smaller the model loss is, the better the training subgraph is. f θ The better the training effect, the higher the single-step reward. The larger the value, the smoother the gradient update strategy of reinforcement learning.

[0165] In the embodiment, the model prediction results and node labels are used to calculate the model loss in combination with formula (5): When t=1, the model loss When t=2, the model loss At t=3, the model loss

[0166] 6.3 Through single-step rewards Calculated using the policy gradient formula in reinforcement learning With W ε The gradient value As shown in formula (8):

[0167]

[0168] in, Indicated in the figure Select the training subgraph The probability of W V With W ε Decide; for The logarithmic derivative of for expectations, i.e. Formula (8) makes the selection strategy of quality detection vectors more inclined to those training subgraphs that can produce smaller model loss.

[0169] In this embodiment, when t=1, the historical average loss δ=0, and the single-step reward is calculated as At t=2, the historical average loss The single-step reward is calculated as At t=3, the historical average loss The single-step reward is calculated as

[0170] Through single-step rewards Calculate using the policy gradient formula (8) in reinforcement learning With W ε The gradient value (This value is calculated by program reinforcement learning).

[0171] 6.4 Using the policy gradient update method to utilize the gradient value After optimization With the optimized W ε Perform gradient update to obtain the updated quality detection vector and because After optimization With W ε Jointly determine, so when using the gradient value After optimization With W ε When updating, the optimized With W ε Based on the gradient value Update at the same time.

[0172] 6.5 Calculation and The mean absolute difference of the I elements in Calculate W ε and The average absolute difference ΔW of the J elements in ε , the method is:

[0173] 6.5.1 Let i = 1;

[0174] 6.5.2 Calculation and The i-th element in and The absolute difference ΔW i ,

[0175] 6.5.3 Let i = i + 1. If i ≤ I, go to 6.5.2. If i > I, go to 6.5.4.

[0176] 6.5.4 Calculation and The mean absolute difference

[0177] 6.5.5 Let j = 1;

[0178] 6.5.6 Calculation of W ε and The jth element in and The absolute difference ΔW j ,

[0179] 6.5.7 Let j = j + 1. If j ≤ J, go to 6.5.6. If j > J, go to 6.5.8.

[0180] 6.5.8 Calculation of W ε and The mean absolute difference ΔW ε ,

[0181] In the embodiment, the gradient value is used After optimization With the optimized W ε Perform policy gradient update. Updated node quality detection vector Edge quality detection vector

[0182] Step 7: Judgement and Whether convergence.

[0183] 7.1 Let reinforcement learning update round t = t + 1. If And ΔW ε ≤0.0001, description With W ε Convergence, no further update is needed, at this time the update convergence is obtained With W ε , go to step 8; otherwise, let Go to step 3.

[0184] In the embodiment, and Subtract each element and take the absolute value, that is, {|0.5-0.61|,|0.44-0.54|,|0.3-0.29|,|0.18-0.18|}={0.11,0.1,0.01,0}, and take the average of the four numbers to get Greater than 0.0001, not converged, ΔW ε The calculation is similar.

[0185] like and ΔW ε At the same time, it is less than 0.0001, indicating and If convergence occurs, go to step 8; otherwise, go to step 3. Usually, convergence begins after t>2000.

[0186] Step 8. Update the converged With W ε The value of is used as the quality detection score of nodes and edges in the graph data. Conduct quality inspection.

[0187] 8.1 Update after convergence Sort the elements in from largest to smallest, The nodes corresponding to the top 25% of the elements in the ranking are defined as high-quality nodes that are important for model training; The nodes corresponding to the 25% of elements after sorting are defined as low-quality nodes that have a negative effect on model training. Some low-quality nodes are deleted during model training to ensure the training effect. The nodes corresponding to the middle 50% of the elements in the ranking are regarded as ordinary nodes, which have a certain positive effect on model training and are retained.

[0188] 8.2 Update W after convergence ε Sort the elements in W from large to small. ε The edges corresponding to the top 25% of the elements in the ranking are defined as high-quality edges that are important for model training. ε The edges corresponding to the 25% of elements after sorting are defined as low-quality edges that have a negative effect on model training. During model training, some low-quality edges are deleted to ensure the training effect. ε The edges corresponding to the middle 50% of the elements in the ranking are regarded as trivial edges, which have a certain positive effect on model training and are retained.

[0189] For example, after the update converges This means that the quality detection score of v1 is 0.3, and the quality detection score of v4 is 0.9, which also means that the quality of v4 is better than v1. The quality detection of the edges is the same. After sorting the elements in from largest to smallest, becomes {0.9, 0.7, 0.5, 0.3}, The top 25% of the elements in the ranking are 0.9, and the corresponding node is v4, which is a high-quality node that is important for model training; 25% of the elements after sorting are 0.3, corresponding to v1. v1 is a low-quality node that has a negative effect on model training. v1 is deleted during model training. The same is true for edge quality detection.

[0190] Step 9. End.

[0191] Through this embodiment, it can be seen that the present invention can find high-quality nodes and high-quality edges in the citation network. By strengthening learning and integrating the influence of the information of nodes and edges in the graph data on the model, the quality detection of nodes and edges in the graph data is realized, which solves the problem of incomplete quality detection of graph data at present. In addition, the present invention conducts the training process of the graph neural network model and the graph data quality detection process simultaneously to achieve collaborative optimization of model training and quality detection. The present invention introduces node degree information as a constraint to guide the quality detection vector to converge more quickly, and the collaborative optimization and introduction of node degree information can significantly reduce the time overhead and computational cost of graph data quality detection. At the same time, the low-quality nodes and edges found by the present invention can be deleted to achieve the purpose of improving the model training effect and reducing the time consumption of model training.

Claims

1. A graph data quality detection method based on reinforcement learning, characterized by The following steps are involved: The first step is data preparation and model preparation. The method is: 1.1 Define a graph The node set For the picture The set of all nodes in , I am The total number of nodes in the node v i yes The i-th node in , 1≤i≤I; the edge set ε represents the graph The relationship between all nodes in , ε={e1,…,e j ,…,e J }, J is the total number of edges in ε, and the edge e j is the jth edge in ε, 1≤j≤J; the eigenvector x is used i Indicates v i The specific content, at the same time i Associate a label y i Indicates v i The annotation information is v i Classification information, let the label set Y = {y1, ..., y i ,…,y I }; 1.2 Build a GNN model f θ , f θ The input is The output is Classification prediction results of midpoints f θ The goal is to make the classification prediction results Try to be the same as the label set Y, then f θ Expressed as The second step is to initialize the quality detection vector and the reinforcement learning update round; 2.1 Definition of node quality detection vector Represents node v i The quality score of is a random real number, 2.2 Definition of edge quality detection vector Represents the edge e j The quality score of is a random real number, 2.3 Define the variable t as the update round of reinforcement learning, and initialize t = 1; The third step is to optimize the node quality detection vector 3.1 Computing Node Set The degrees of all nodes in the network are sorted to obtain the sorted node degree information set. Node v i Degree(v i )exist Sort(Degree(v i ))=Degree(v i )exist The serial number in 3.2 Using node degree information collection Optimize node quality detection vector W v , that is, according to Sort(Degree(v1)) To enlarge or reduce or not adjust, ..., according to Sort(Degree(v i ))right To enlarge or reduce or not adjust, ..., according to Sort(Degree(v I ))right to enlarge, reduce or not adjust; 3.3 Using normalization method The value in is limited to between 0 and 1, and the optimized node quality detection vector is obtained. Step 4: Optimize the edge quality detection vector W ε , the method is: 4.1 Calculate the degree of all edges in the edge set ε and sort the degrees of the edges to obtain the sorted edge degree information set Edge j Degree(e j )exist The sort value in Sort.Degree(e j ) / =Degree(e j )exist The serial number in 4.2 Using edge degree information to optimize the edge quality detection vector W ε , that is, according to Sort(Degree(e1)) To enlarge or reduce or not adjust, ..., according to Sort.Degree(e j ) / right To enlarge or reduce or not adjust, ..., according to Sort.Degree(e J ) / right to enlarge, reduce or not adjust; 4.3 Using the normalization method to transform W ε The value in is limited to between 0 and 1, and the optimized edge quality detection vector W is obtained. ε ; Step 5: Detect node quality based on the optimized vector and edge quality detection vector W ε right Sampling is performed to form a training subgraph 5.1 The optimized node quality detection vector Quality detection score As midpoints ν1,…,ν i ,…,ν I The probability of being selected, the nodes are sampled using the weighted random sampling method to form a node subset N is The total number of nodes in yes The nth node in the, 1≤n≤N; 1≤N <I; 5.2 The optimized edge quality detection vector W ε Quality detection score As The middle connecting edges e1,…,e j ,…,e J The probability of being selected is obtained by using a weighted random sampling method to ε Sample the edges to form edge subsets M is The total number of edges in yes The mth edge in the middle, 1≤m≤M; 1≤M <J; 5.3 Subsetting nodes and edge subsets Combine into a graph, delete the nodes without edges in the graph; delete the edges with less than 2 connected nodes in the graph to form a training subgraph And based on the node subset Get the corresponding label subset from the label set Y Step 6: Based on the training subgraph With label subset For the GNN model f θ Train and use reinforcement learning to update the optimized node quality detection vector and the optimized edge quality detection vector W ε The method is: 6.1 Training Subgraph Input GNN model f θ , f θ The output is Classification prediction results of midpoints f θ The classification goal is to make the classification prediction result Try to subset with tags Same, f θ Expressed as 6.2 for f θ Perform training and calculate the single-step reward of reinforcement learning; the method is: 6.2.1 Using f θ right Spread information and get The node vector corresponding to each node in is represented; 6.2.2 Using f θ The linear layer maps the node vector representation to the probability distribution space; 6.2.3 Use the softmax activation function to convert the node vector representation into a probability distribution and calculate the classification prediction result 6.2.4 Based on classification prediction results With label subset Use the cross entropy loss function, formula (5), to calculate f θ Model loss at the current reinforcement learning update round t and will Put it into the model loss array L, in For nodes Tags, for The prediction results, Express Get the log value; 6.2.5 Calculation of f θ The historical average loss value δ, if t=1, f θ The historical average loss value If t>1, calculate δ according to formula (6): 6.2.6 Utilization Computing single-step rewards for reinforcement learning with δ As shown in formula (7): Set to negative reward; 6.3 Through single-step rewards Calculated using the policy gradient formula in reinforcement learning With W ε The gradient value As shown in formula (8): in, Indicated in the figure Select the training subgraph The probability of W V With W ε Decide; for The logarithmic derivative of ; for expectations; 6.4 Using the policy gradient update method to utilize the gradient value After optimization With the optimized W ε Perform gradient update to obtain the updated quality detection vector and Using the gradient value After optimization With W ε When updating, the optimized With W ε Based on the gradient value Updates are made at the same time; 6.5 Calculation and The mean absolute difference of the I elements in Calculate W ε and The average absolute difference ΔW of the J elements in ε ; Step 7: Judgement With W ε Whether it converges, the method is: 7.1 Let reinforcement learning update round t = t + 1; if And ΔW ε ≤0.0001, description With W ε Convergence, get the updated convergence With W ε , go to step 8; otherwise, let Go to step 3; Step 8: Update the converged With W ε The value of is used as the quality detection score of nodes and edges in the graph data. Perform quality testing by: 8.1 Update after convergence Sort the elements in from largest to smallest, The nodes corresponding to the top 25% of the elements in the ranking are defined as high-quality nodes that are important for model training; The nodes corresponding to the 25% of elements after sorting are defined as low-quality nodes that have a negative effect on model training. Low-quality nodes are deleted during model training to ensure the training effect; The nodes corresponding to the middle 50% of the elements in the ranking are regarded as ordinary nodes, which have a certain positive effect on model training and are retained; 8.2 Update W after convergence ε Sort the elements in W from large to small. ε The edges corresponding to the top 25% of the elements in the ranking are defined as high-quality edges that are important for model training. ε The edges corresponding to the 25% of elements after sorting are defined as low-quality edges that have a negative effect on model training; some low-quality edges are deleted during model training to ensure the training effect; W ε The edges corresponding to the middle 50% of the elements in the ranking are regarded as trivial edges, which have a certain positive effect on model training and are retained. Step 9. End.

2. A graph data quality detection method based on reinforcement learning as claimed in claim 1, characterized in that the computing node set in step 3.1 The degrees of all nodes in the network are sorted to obtain the sorted node degree information set. The method is: 3.1.1 Let variable i = 1; 3.1.2 Computing Node v i Degree(v i ), Degree(v i ) is equal to v i The number of edges; Degree(v i ) is put into the node degree information set D; 3.1.3 Let i = i + 1; if i ≤ I, go to 3.1.2; if i > I, it means that the degrees of all nodes are obtained, and the node degree information set D is obtained, D = {Degree(v1), ..., Degree(v i ),…,Degree(v I )}, go to 3.1.4; 3.1.4 Sort the elements in D from largest to smallest to obtain the sorted node degree information set Let Degree(v i )exist Sort(Degree(v i ))=Degree(v i )exist The serial number in .

3. A graph data quality detection method based on reinforcement learning as described in claim 1, characterized in that step 3.2 uses node degree information to optimize the node quality detection vector The method is: 3.2.1 Let variable i = 1; 3.2.2 Pair Optimize and adjust according to formula (1): Where γ is the adjustment parameter, 0.05≤γ≤0.5; 3.2.3 Let i = i + 1; if i ≤ I, go to 3.2.2; if i > I, explain Optimization completed, ended.

4. A graph data quality detection method based on reinforcement learning as claimed in claim 1, characterized in that in step 4.1, the degrees of all edges in the edge set ε are calculated and the degrees of the edges are sorted to obtain a sorted edge degree information set The method is: 4.1.1 Let variable j = 1; 4.1.2 Calculating the edge e j Degree(e j );e j Degree(e j ) by e j The degrees of the two connected nodes are added together to obtain Degree(e j ) is put into the edge degree information set E; 4.1.3 Let j = j + 1; if j ≤ J, go to 4.1.2; if j > J, it means that the degrees of all edges are obtained, and the edge degree information set E is obtained, E = {Degree(e1), ..., Degree(e j ),…,Degree(e J )}, go to 4.1.4; 4.1.4 Sort the elements in E from largest to smallest to obtain the sorted edge degree information set Let Degree(e j )exist The sort value in Sort.Degree(e j ) / =Degree(e j )exist The serial number in .

5. The graph data quality detection method based on reinforcement learning according to claim 1 is characterized in that Step 4.2 uses the edge degree information to optimize the edge quality detection vector W ε The method is: 4.2.1 Let variable j = 1; 4.2.2 Pair Optimize according to formula (2): Where γ is the adjustment parameter, 0.05≤γ≤0.5; 4.2.3 Let j = j + 1; if j ≤ J, go to 4.2.2; if j > J, then W ε Optimization completed, ended.

6. A graph data quality detection method based on reinforcement learning as described in claim 3 or 5, characterized in that The γ is set to 0.

1.

7. A graph data quality detection method based on reinforcement learning as claimed in claim 1, characterized in that The optimized node quality detection vector is as described in step 5.1 Quality detection score As Middle nodes v1,…,v i ,…,v I The probability of being selected, the method of sampling nodes using weighted random sampling method is: 5.1.1 Let variable i = 1; 5.1.2 Generate a random real number rand(i), 0≤rand(i)≤1; calculate v according to formula (3) i Sampling fraction of nodes 5.1.3 Let i = i + 1; if i ≤ I, go to 5.1.2; if i > I, the node sampling score calculation is completed, and the node sampling score set is obtained. Go to 5.1.4; 5.1.4 To S v Sort the node sampling scores in from large to small, take the first N nodes as the sampled nodes, and form a node subset N is The total number of nodes in yes The nth node in , 1≤n≤N; That is, the nodes with the top 2 / 3 sampling scores are taken as the sampled nodes to form the node subset 8. The graph data quality detection method based on reinforcement learning according to claim 1, characterized in that As described in step 5.2, the optimized edge quality detection vector W ε Quality detection score As The middle connecting edges e1,…,e j ,…,e J The probability of being selected is obtained by using a weighted random sampling method to ε The method for sampling edges is: 5.2.1 Let variable j = 1; 5.2.2 Generate a random real number rand(j), 0≤rand(j)≤1; calculate the edge e according to formula (4) j The sampling fraction 5.2.3 Let j = j + 1; if j ≤ J, go to 5.2.2; if j > J, the edge sampling score calculation is completed, and the edge sampling score set is obtained. Go to 5.2.4; 5.2.4 To S e Sort the edge sampling scores in from large to small, take the first M edges as the sampled edges, and form an edge subset M is The total number of edges in yes The mth edge in , 1≤m≤M; That is, the edges with the top 2 / 3 edge sampling scores are taken as the sampled edges to form the edge subset 9. A graph data quality detection method based on reinforcement learning as claimed in claim 1, characterized in that Calculations described in step 6.5 and The mean absolute difference of the I elements in Calculate W ε and The average absolute difference ΔW of the J elements in ε The method is: 6.5.1 Let i = 1; 6.5.2 Calculation and The i-th element in and The absolute difference ΔW i , 6.5.3 Let i = i + 1. If i ≤ I, go to 6.5.

2. If i > I, go to 6.5.

4. 6.5.4 Calculation and The mean absolute difference 6.5.5 Let j = 1; 6.5.6 Calculation of W ε and The jth element in and The absolute difference ΔW j , 6.5.7 Let j = j + 1. If j ≤ J, go to 6.5.

6. If j > J, go to 6.5.

8. 6.5.8 Calculation of W ε and The mean absolute difference ΔW ε ,