Graph neural network generalization method based on test stage adjustment
By calculating the distribution offset between the training set and the test set of graph neural networks, and adjusting the model parameters using reparameterization techniques and comparative learning, the problem of insufficient generalization ability of graph neural networks outside the distribution is solved, achieving a more reliable Predict results.
Patent Information
- Application Number
- CN202411558284.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-02-11
AI Technical Summary
When the distribution offset between the training set and the test set is large, the existing graph neural network lacks the ability to generalize externally, resulting in poor performance of the model on the test set.
Calculate the distribution offset between the training set and the test set by non-parametric density estimation, obtain the mask matrix using reparametric techniques and node-level comparison learning, adjust the statistics of the batch regularization layer, and use entropy and confidence-based Select the enhancement strategy and energy-based unsupervised joint model training method to optimize the parameters of the graph neural network model.
This improves the performance of graph neural network on the off-distribution test set, enhances the generalization ability of the model, and ensures the reliability of the prediction results.
Smart Images

Figure CN119416820A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of neural network technology, and in particular to a graph neural network generalization method based on test phase adjustment. Background Art
[0002] Graph data is ubiquitous in our lives and is widely used to model dependencies and complex relationships between entities. Common graph data in the real world include molecular graphs, social networks, and paper citation networks. Graph representation learning is a method that converts graph data into a low-dimensional dense vector representation while ensuring that the resulting vector space can well preserve the properties of the graph data. The main goal of this method is to represent graph data as a vector containing rich structural and attribute information, thereby supporting subsequent task learning and achieving better results. Graph representation learning has been widely used in real life, such as drug discovery, recommendation systems, travel time prediction, and anomaly detection. As a powerful tool in graph representation learning, Graph Neural Networks (GNN) have achieved remarkable results in graph-related tasks such as node classification, link prediction, and graph classification. However, most of the current methods are based on the assumption of independent and identical distribution, that is, the training graph data and the test graph data are independently sampled from the same distribution. In actual scenarios, due to the uncontrollability of graph data, this assumption is difficult to meet. There will inevitably be a certain degree of distribution shift between the training graph data and the test graph data. This distribution shift will cause a large gap between the performance of the model on the training set and the performance on the out-of-distribution (OOD) test set. In other words, the model lacks the ability to generalize out of distribution, which poses a huge challenge to the practical application of the model. Therefore, it is very important to study the out-of-distribution generalization method of graph neural networks.
[0003] At present, the research on the adjustment methods of the graph neural network test phase can be roughly divided into two categories: batch regularization correction methods and model optimization methods. Batch regularization correction methods such as AdaBN (Adaptive BatchNormalization) and DUA (Dynamic Unsupervised Adaptation) use experience to set the combined weights of source domain statistics and target domain statistics, which lack flexibility and stability. Model optimization methods such as MEMO (Marginal Entropy Minimization with One test point) and GAPGC (Graph Adversarial Pseudo Group Contrast) cannot obtain the true labels of the test set. When the model trained on the training set performs poorly on the test set, the optimization objectives in the above methods such as entropy minimization and contrastive learning are difficult to achieve good results.
[0004] Application No. US18 / 360,712 discloses a processor implementation method for adjusting an artificial neural network (ANN) during a test phase, comprising: a first ANN model, a second ANN model and a test data set. The test data set includes unlabeled data samples. The first ANN model is pre-trained using a training data set and a test data set. The first ANN model generates a first estimated label for the test data set. The second ANN model generates a second estimated label for the test data set. Samples of the test data set are selected based on the confidence difference between the first estimated label and the second estimated label. The second ANN model is retrained based on the selected samples. When the distribution shift between the training set data and the test set data is large, the first estimated label obtained by the method is unreliable, so that the selected sample quality is low, the second ANN model cannot learn sufficient effective information during training, and the model prediction accuracy is low.
[0005] Application No. US18 / 479,723 discloses a computer-implemented method, comprising adding an auxiliary network from a set of auxiliary networks to a corresponding partition in a set of partitions associated with a main network. The method also includes training each network in the set of auxiliary networks using training data to adapt to a test distribution. The method further includes adjusting each network in the set of auxiliary networks using test data to adapt to the test distribution. The method further includes classifying received inputs at a model based on the adjustment of each network in the set of auxiliary networks. The model may include a set of partitions and a set of auxiliary networks. The method requires continuous adjustment and optimization of multiple main networks and auxiliary networks, requires a large amount of computing resources and time, and when the main network partition is unreasonable or the auxiliary network is improperly connected to the main network, it may cause information transmission to be blocked, affecting the performance and efficiency of the model.
[0006] Application No. US17 / 868,267 discloses a computer-implemented system and method, which relates to a test phase adjustment method from a source domain to a target domain in machine learning. Sensor data is obtained from a target domain. The machine learning system generates prediction data based on the sensor data. Pseudo-reference data is generated based on the gradient of a predetermined function evaluated with the prediction data. Loss data is generated based on the pseudo-reference data and the prediction data. One or more parameters of the machine learning system are updated based on the loss data. After updating one or more parameters, the machine learning system is configured to perform tasks in the target domain. The effectiveness of this method depends on the design of a predetermined function, requires strong prior knowledge and relevant theoretical foundations, lacks flexibility, and faces catastrophic forgetting problems after multiple rounds of updates to multiple parameters of the machine learning system, and the prediction performance on the training set is significantly reduced. Summary of the invention
[0007] To achieve the above object, the technical solution of the present invention is as follows:
[0008] Technical solution: The present invention proposes a graph neural network generalization method based on test phase adjustment, which specifically includes the following steps:
[0009] S1: The distribution of training samples and test samples is expressed by non-parametric density estimation, and the distribution offset between the two is calculated using the distance between the distributions, such as the divergence, as the initial adjustment weight;
[0010] S2: Use reparameterization techniques and node-level contrastive learning on the initial adjustment weights to obtain a mask matrix, take the Cartesian product of the two as the final adjustment weights, and use the exponential moving average method to adjust the mean and variance parameters maintained by the batch normalization layer;
[0011] S3: Use entropy- and confidence-based selection augmentation strategies to obtain reliable pseudo-labels, and use an energy-based unsupervised joint model training method to adjust the scaling and bias parameters of the batch normalization layer;
[0012] S4: Use the adjusted graph neural network model to make more reliable predictions on test samples.
[0013] The selection of graph neural network models includes but is not limited to GCN (Graph Convolutional Networks), GraphSAGE (Graph SAmple and aggreGatE) and GAT (Graph Attention Networks). Note that before using the method proposed in the present invention, the graph neural network model has been trained on the training set and reached convergence.
[0014] S1 includes the following steps:
[0015] S11: Use nonparametric density estimation to represent the distribution of training and test samples;
[0016] For the training set data and test samples, the output distribution of each batch normalization layer on the trained model is represented. The density estimation methods include but are not limited to histogram density estimation, kernel probability density estimation and maximum likelihood method.
[0017] For example, using the nonparametric density estimation method, the training sample G m ∈D tr Output distribution of each batch normalization layer on the trained model Indicated, i represents the i-th batch normalization layer, d represents the d-th dimension of the output, and similarly, in the test sample G n ∈D te You can get
[0018] S12: According to the distribution represented in S11, a distribution distance measurement method such as divergence is used to calculate the distribution offset between the test sample and the training set, and determine the initial adjustment weight of the statistical information.
[0019] Based on the obtained distribution data of the test samples and training sets, the distribution offset between the two is calculated. Methods for measuring the distance between distributions include but are not limited to cosine similarity, mutual information, KL divergence (Kullback-Leibler Divergence) and JS divergence (Jensen-Shannon divergence).
[0020] The specific steps of S2 include:
[0021] S21: Obtain the mask matrix for adjusting weights by learning;
[0022] The binary mask matrix indicates whether the statistical information maintained by the batch normalization layer in a certain dimension needs to be adjusted. The mask matrix is modeled using Bernoulli variables and combined with the reparameterization technique, and added to the forward propagation process of the model. Regularization terms are added in the process of optimizing the mask matrix using contrastive learning so that the results obtained in the learning process do not deviate from the initial prediction results of the model. Finally, the sigmoid function is used to normalize the learned Bernoulli matrix to the range of [0,1] and binarize it to obtain the final mask matrix.
[0023] S22: Cartesian product of the obtained adjustment weight and mask matrix to obtain the final weight value of the adjusted statistical information. During the adjustment process, the original method of maintaining statistical information of the batch normalization layer, i.e., exponential moving average, is used in combination with the obtained final adjustment weight, and the statistical information maintained by the batch normalization layer is adjusted in multiple steps based on the test sample.
[0024] For example, the final adjustment weight is obtained by combining the exponential moving average method, that is, the Cartesian product A⊙M* of the initial adjustment weight and the mask matrix, and the mean and variance parameters maintained by the batch normalization layer are adjusted in K steps.
[0025] The specific steps of S3 include:
[0026] S3 1: The predicted probability of the trained initial model for the test sample is used as a pseudo-label, and the pseudo-label is selectively enhanced based on entropy and confidence; the entropy value of the prediction result is calculated, and the prediction result with entropy less than a given threshold is selected as a reliable result. At the same time, a score is defined according to the confidence of the prediction result, and the prediction result with high confidence is enhanced.
[0027] For example, the predicted probability of the initial model for the test sample is used as a pseudo label, and the pseudo label is selectively enhanced based on entropy and confidence; an entropy-based score S is defined for each node. (i) and defines a confidence-based score for the model's predicted probability of a node's class Get more reliable pseudo-labels as a baseline.
[0028] S32: In each optimization round, a graph data needs to be generated so that its energy gradually approaches the energy of the real graph data;
[0029] Since the distribution of real graph data p θ Sampling in (x) is not easy, so the stochastic gradient Langevin dynamics sampling (SGLD) method is used for approximation. After multiple iterations, the feature matrix of the generated graph data is obtained as the generated data.
[0030] S33: Establish an energy-based joint training model to adjust the scaling and offset parameters of the batch normalization layer in the graph neural network using test samples;
[0031] In order to save the expected amount of computation in the energy model, the continuous contrast divergence method is used for approximate calculation, and the loss is calculated in combination with the graph data generated in step S32. For the optimization target of the classification model, the standard cross-entropy loss can be used for optimization, and the benchmark is the enhanced pseudo-label obtained in step S31.
[0032] S34: Iterate multiple times until the generation loss + classification loss in the training process converges, and the adjustment of the batch normalization layer scaling and offset parameters is completed. The mean and variance parameters maintained by the batch normalization layer during the training process are no longer updated.
[0033] In S4, after steps S1, S2 and S3, the trained model has been updated based on the out-of-distribution test sample, and the updated model parameters are more suitable for the test sample. The model finally predicts the test sample and obtains a more reliable prediction result.
[0034] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention proposes a graph neural network generalization method based on test phase adjustment, uses adjustment weights based on distribution offset size and the learned mask matrix to adjust the statistical information maintained by the batch normalization layer, and then uses an energy-based joint model training method, combined with the advantages of the generative model, while selecting and enhancing the prediction results of the initial model, so that the prediction results of the adjusted model are more reliable, further improving the performance of the model on the out-of-distribution test set. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 is a flow chart of the present invention;
[0036] Figure 2 A framework diagram of the method for adjusting mean and variance parameters in the present invention;
[0037] Figure 3 It is a framework diagram of the method for adjusting scaling and offset parameters in the present invention. DETAILED DESCRIPTION
[0038] The present invention will be further explained below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention.
[0039] Example: Figure 1As shown, firstly, a formal definition of the problem to be solved in this embodiment is given: the graph data is defined as G = {A, X}, where the node set is V, A∈R N×N represents the adjacency matrix, N represents the number of nodes, A u,v =1 means there is an edge between nodes u and v, otherwise A u,v =0,X∈R N×d represents the feature matrix, d represents the dimension of the node feature, taking the node classification task as an example, for each node u in the graph, there is a node label y u ∈Y, where Y={y1,y2,...,y C} is a label set containing C categories. Given a graph test sample G n ∈D te , where D te Represents the test set, node set V n Each node in is unlabeled. At the same time, given a training set D tr The trained classification model f θ : G→Y, θ represents the trained parameters, and the batch normalization layer in the model maintains the statistical information used for regularization during training Assume that the training set D tr It cannot be obtained, and there is a covariance shift between the training set and the test set, that is, P tr (D tr )≠P te (D te ), resulting in model f θ In the test set D te Poor performance.
[0040] The goal of this embodiment is to have only unlabeled test samples G n And the trained model f θ Under the premise of further adjusting the parameters of the trained model based on the test sample, the adjusted model f θ* In the test sample G n It has better classification performance on the ensemble, even if the model obtains out-of-distribution generalization ability.
[0041] S1: The distribution of training samples and test samples is expressed by non-parametric density estimation, and the distribution offset between the two is calculated using the distance between the distributions, such as the divergence, as the initial adjustment weight;
[0042] S2: Use reparameterization techniques and node-level contrastive learning on the initial adjustment weights to obtain a mask matrix, take the Cartesian product of the two as the final adjustment weights, and use the exponential moving average method to adjust the mean and variance parameters maintained by the batch normalization layer;
[0043] S3: Use entropy- and confidence-based selection augmentation strategies to obtain reliable pseudo-labels, and use an energy-based unsupervised joint model training method to adjust the scaling and bias parameters of the batch normalization layer;
[0044] S4: Use the adjusted graph neural network model to make more reliable predictions on test samples.
[0045] In S1 and S2, the statistical information maintained by the batch normalization layer of the present invention is That is, the mean and variance are adjusted. The present invention proposes a new batch normalization layer statistical information adjustment method, which determines the value of the adjustment weight according to the distribution offset between the test sample and the training set, and determines which dimensions of statistical information need to be adjusted and which dimensions of statistical information do not need to be adjusted by learning. The process is as follows Figure 2 shown.
[0046] First, the present invention believes that the adjustment weight a should be obtained according to the distribution offset between the training set and the test sample. When the distribution offset between them is small, the value of a should be smaller, and more statistical information of the training set should be used; when the distribution offset between them is large, the value of a should be larger, and more statistical information of the test set should be used.
[0047] S11: Specifically, the training sample G is estimated using the nonparametric density estimation method. m ∈D tr Output distribution of each batch normalization layer on the trained model Indicated, i represents the i-th batch normalization layer, d represents the d-th dimension of the output, and similarly, in the test sample G n ∈D te You can get
[0048] S12: Use Jensen-Shannon (JS) divergence to measure the distance between two distributions, and determine the value of the adjustment weight accordingly. The process is as follows:
[0049]
[0050]
[0051] Where N tr Represents the number of samples in the training set, N te Indicates the number of samples in the test set.
[0052] Thus, the initial weight A∈R of statistical information adjustment is obtained L×D , the process is as follows:
[0053] A=[a (0) , a (1) , ..., a (L) ], a (i) =[a (i,0) , a (i,1) , ..., a (i,D) ]
[0054] Where D represents the output dimension of the BN layer, and L represents the number of batch normalization layers.
[0055] S21: Not all batch normalization layers maintain statistics All need to be adjusted, so the present invention hopes to obtain a mask matrix M∈{0,1}, where M[i,d]=1 represents statistical information Adjustments need to be made and vice versa.
[0056] To achieve this function, assume that M[i, d]~Bernoulli(b i , d), b i , d is an independent Bernoulli variable. Since the sampling process is not differentiable, the Gumbel-Max reparameterization technique is used. The calculation process of the mask matrix M is as follows:
[0057] M=sigmoid((logδ-log(1-δ)+B) / τ), δ~U(0,1)
[0058] Where δ represents uniform noise, τ represents the temperature parameter, and when τ→0, M is binarized.
[0059] At the same time, the process of adjusting the statistical information is added to the forward propagation process of the batch normalization layer, so that the Bernoulli parameter matrix B can be optimized according to the gradient. During the training process, the statistical information used by the modified batch normalization layer regularization process is as follows:
[0060] μ=(1-A′)·μ s +A′·μ b
[0061]
[0062] in represents the statistical information of the input data (test samples) of the bth batch, A′=AM represents the weight matrix after masking. In addition, during the entire training process, the statistical information maintained by the batch normalization layer is not updated.
[0063] The InfoNCE-based contrastive loss is used, which is as follows:
[0064]
[0065] where z i represents the node representation of the i-th node, Represents the corresponding node representation obtained after DropEdge enhancement of the graph, representing the positive sample, represents the corresponding node representation generated by the shuffled node feature method, represents the negative sample, and s(·) measures the similarity between the two node representations, using the cosine similarity, that is:
[0066]
[0067] At the same time, the results obtained during the model learning process cannot be too far from the initial prediction results of the model to avoid losing important information. The final loss function used is as follows:
[0068] L m =L c +λKL(p||q)
[0069] Among them, p represents the predicted probability result of the unadjusted model for the sample, which can be regarded as a pseudo label, q represents the predicted probability result of the model for the sample during the optimization process, and λ is the weight parameter.
[0070] Finally, the optimized Bernoulli parameter matrix B* can be obtained. To obtain the final mask matrix M*, set
[0071] S22: Figure 2 As shown in (step-3), the final adjustment weight is obtained by combining the exponential moving average method: A*=A⊙M*, and the mean and variance parameters maintained by the batch normalization layer are updated in K steps. The adjustment process is as follows:
[0072]
[0073]
[0074] in Finally, using the adjusted statistics The test samples are regularized so that the model can obtain good out-of-distribution generalization performance.
[0075] In S3, the present invention optimizes the learnable parameters (β, γ) of the batch normalization layer while keeping other parameters of the model unchanged, including the statistical information maintained by the batch normalization layer, so as to improve the performance of the adjusted model on the out-of-distribution test set and achieve better out-of-distribution generalization performance. The process is as follows: Figure 3 shown.
[0076] S31: When the model predicts a certain node p (i)The smaller the entropy, the higher the degree of certainty of the model for the prediction result, and its accuracy is often higher. Therefore, the present invention defines an entropy-based score S for each node. (i) , the process is as follows:
[0077]
[0078] S (i) =I[Entropy(p (i) )<τ e ],i=1,...,N
[0079] where p (i) represents the prediction result of the i-th node, C represents the prediction category, N represents the number of nodes, τ e Indicates the entropy threshold.
[0080] At the same time, when the model predicts the probability value of a certain category of the node When it is larger, it means that the model believes that the node is very likely to belong to the category, that is, the model has a high confidence in the category. Similarly, when the model's confidence in a certain category is smaller, it means that the model believes that the node is very likely not to belong to the category. Based on this, the present invention defines a score for the model's predicted probability of a certain category of the node, as shown below:
[0081]
[0082] where τ c1 is a larger confidence threshold, T c2 is a smaller confidence threshold.
[0083] S32: From the distribution of real data p e It is not easy to sample in red, so the stochastic gradient Langevin dynamics sampling (SGLD) method is used for approximation. The sampling process is as follows:
[0084]
[0085] Where p0(x) usually represents a uniform distribution, α represents the step size, and ∈ represents noise.
[0086] Taking into account the particularity of the sampling graph data, the present invention searches for a sample that is closest to the energy of the real sample x as the final sampling sample during the SGLD sampling process. The process is as follows:
[0087]
[0088] Where T represents the number of sampling steps, and since the dataset is a graph dataset, the goal of the generation task is to generate the node feature matrix X.
[0089] S33: The present invention adopts an energy-based joint model training method (JEM) to optimize the batch normalization layer parameters (β, γ), obtain the advantages of the generative model while retaining good classification performance, so that the model can better learn the key information in the out-of-distribution test set. The goal of JEM can be written as maximizing the possibility shown in the following formula. For ease of description, we use x and y to refer to the graph data G and Y.
[0090] logp θ (x, y) = logp θ (x)+logp θ (y|x)
[0091] The energy-based model (EBM) can be expressed as follows:
[0092]
[0093] Where E θ (x) represents the energy function and Z(θ) represents the distribution function.
[0094] The definition of the energy function used in the present invention is as follows:
[0095] E θ (x) = -LogSumExp y (f θ (x)[y])=-log∑ y exp(f θ (x)[y])
[0096] where f θ (x)[y] represents the model output f θ (x) The subscript is the value of y.
[0097] During the optimization process, for the energy-based model p θ (x) is optimized and the EBM is expressed as follows:
[0098]
[0099] In order to save computational effort, the expectation on the right side of the above equation is approximated using the continuous contrast divergence method, and the approximated generation loss L gen It can be expressed as follows:
[0100]
[0101] Where y′ represents the pseudo label, and the generation loss is the first item in the JEM optimization objective.
[0102] The second term logp in the JEM optimization objective θ(y|x) can be optimized using the standard cross entropy loss, and the enhanced pseudo-labels are selected as the baseline using S31. The final classification loss L clf The form is as follows:
[0103]
[0104]
[0105] in represents the weight when calculating the loss, and q represents the prediction result during the model adjustment process.
[0106] S34: Figure 3 As shown in (step-3) in the process of optimizing the learnable parameters (β, γ) of the batch normalization layer, the total loss is L gen +L clf Optimization methods include but are not limited to stochastic gradient descent (SGD), Adam (Adaptive Moment Estimation) and adaptive learning rate optimization algorithm Adagrad. After multiple rounds of optimization, the loss converges and the adjustment of the learnable parameters (β, γ) of the batch normalization layer is completed.
[0107] S4: Statistical information maintained by the previous batch normalization layer And the learnable parameters (β, γ) are updated and adjusted. The model that has been trained on the training set is adjusted on the test samples in the test phase to obtain better out-of-distribution generalization performance. Finally, the test samples are input into the updated graph neural network model for prediction to obtain more reliable prediction results.
[0108] It should be noted that the above content only illustrates the technical idea of the present invention and cannot be used to limit the protection scope of the present invention. For ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications all fall within the protection scope of the claims of the present invention.
Claims
1. A generalization method for graph neural networks based on test phase adjustment, characterized in that: The method comprises the following steps, S1, the distribution of training samples and test samples is expressed by non-parametric density estimation, and the distribution offset between the two is calculated using the distance between the distributions as the initial adjustment weight; S2, uses the reparameterization technique and node-level contrastive learning on the initial adjustment weights to obtain a mask matrix, takes the Cartesian product of the two as the final adjustment weights, and uses the exponential moving average method to adjust the mean and variance parameters maintained by the batch normalization layer; S3, uses entropy and confidence based selection enhancement strategies to obtain reliable pseudo labels, and uses energy-based unsupervised joint model training methods to adjust the scaling and offset parameters of the batch normalization layer; S4, uses the adjusted graph neural network model to make more reliable result predictions for test samples.
2. The graph neural network generalization method based on test phase adjustment according to claim 1, characterized in that: The step S1 comprises the following steps: S11, use nonparametric density estimation method to represent the distribution of training set and test samples; For the training set data and test samples, the output distribution of each batch normalization layer on the trained model is represented; S12, using a distribution distance measurement method to calculate the distribution shift size between the test sample and the training set, and determine the initial adjustment weight of the statistical information.
3. The graph neural network generalization method based on test phase adjustment according to claim 1 is characterized in that: The step S2 comprises the following steps: S21, obtain the mask matrix of the adjusted weights by learning; The mask matrix is modeled using Bernoulli variables and combined with reparameterization techniques, and added to the forward propagation process of the model. Regularization terms are added when optimizing the mask matrix using contrastive learning, so that the results obtained during the learning process do not deviate from the initial prediction results of the model. S22, performing a Cartesian product of the obtained adjustment weight and the mask matrix to obtain a final weight value of the adjustment statistical information.
4. The graph neural network generalization method based on test phase adjustment according to claim 1, characterized in that: The step S3 comprises the following steps: S31, taking the predicted probability of the initial model for the test sample as a pseudo label, and performing selective enhancement on the pseudo label based on entropy and confidence; Calculate the entropy value of the prediction results, select the prediction results with entropy less than a given threshold as reliable results, and define a score based on the confidence of the prediction results to enhance the prediction results with high confidence; S32, in each optimization round, a graph data needs to be generated and its energy gradually approaches the energy of the real graph data. Since it is not easy to sample from the distribution of the real graph data, the stochastic gradient Langevin dynamics sampling method is used for approximation; S33, uses an energy-based joint model training method to adjust the scaling and offset parameters of the batch normalization layer in the graph neural network on the test samples; In order to save the expected amount of calculation in the energy model, the continuous contrast divergence method is used for approximate calculation, and the loss is calculated in combination with the graph data generated in step S32; S34, iterate the training multiple times until the loss in the training process converges, and the adjustment of the batch normalization layer scaling and offset parameters is completed. In addition, the mean and variance parameters maintained by the batch normalization layer in the training process are no longer updated.
5. The graph neural network generalization method based on test phase adjustment according to claim 1, characterized in that: After steps S1, S2 and S3 in step S4, the trained model has been adjusted based on the test sample outside the distribution, and the adjusted model parameters are more suitable for the test sample. The model finally predicts the test sample to obtain a more reliable prediction result.
6. The graph neural network generalization method based on test phase adjustment according to claim 2, characterized in that: The density estimation methods for estimating the distribution of the training set and the test set in step S11 include histogram density estimation, kernel probability density estimation and maximum likelihood method.
7. The graph neural network generalization method based on test phase adjustment according to claim 2 is characterized in that: In step S12, the distribution offset between the obtained test samples and training sets is calculated, and the methods for measuring the distance between the training set distribution and the test set distribution include cosine similarity, mutual information, KL divergence and JS divergence.
8. The graph neural network generalization method based on test phase adjustment according to claim 3 is characterized in that: The unsupervised contrast loss used in obtaining the mask matrix of the initial adjustment weight in step S21 includes NCE loss, InfoNCE loss and cross entropy loss.
9. The graph neural network generalization method based on test phase adjustment according to claim 4, characterized in that: The goal of the generation task in step S32 is to generate a node feature matrix for graph data.
10. The graph neural network generalization method based on test phase adjustment according to claim 4, characterized in that: The optimization methods for the learnable parameters of the batch normalization layer in step S34 include stochastic gradient descent method, Adam optimization algorithm and Adagrad adaptive learning rate optimization algorithm.
Citation Information
Patent Citations
System and method for test-time adaptation via conjugate pseudolabels
US20240037416A1
Test-time adaptation via self-distilled regularization
US20240160926A1
Robust test-time adaptation without error accumulation
US20240303497A1