Search

CN-121997977-A - Graph neural network test time adaptation method for outward distribution deviation

CN121997977ACN 121997977 ACN121997977 ACN 121997977ACN-121997977-A

Abstract

The embodiment of the application provides a graph neural network test adaptation method for outward-distributed offset. The method is applied to the field of graph neural networks, the graph data set with relation type label information is obtained, the obtained graph data set is divided into a training set, a verification set and a test set, a target graph neural network model is trained by the training set based on main task loss and self-supervision auxiliary task loss, a trained graph neural network model and a plurality of initial type prototypes are obtained, parameters of the trained graph neural network model are optimized by the test set based on prototype graph comparison learning loss and multi-level domain alignment constraint, and input data are analyzed and processed by the optimized graph neural network model, so that a prediction result is obtained. The method improves the accuracy of the prediction result when the data has distribution deviation.

Inventors

  • Xian Xingping
  • ZHOU YUANQING
  • WU TAO
  • LI XUEHAO

Assignees

  • 重庆邮电大学

Dates

Publication Date
20260508
Application Date
20260120

Claims (9)

  1. 1. An adaptation method for a graph neural network test facing to distributed outward migration, which is characterized by comprising the following steps: Acquiring a graph data set with relation type label information, and dividing the graph data set into a training set, a verification set and a test set; Training the target graph neural network model based on the main task loss and the self-supervision auxiliary task loss by utilizing the training set to obtain a trained graph neural network model and a plurality of initial class prototypes, wherein the self-supervision auxiliary task loss is a prototype graph contrast learning loss; optimizing parameters of the graph neural network model based on prototype graph comparison learning loss and multi-level domain alignment constraint by using a test set, wherein the prototype graph comparison learning loss comprises prototype comparison learning loss and prototype clustering loss, and the multi-level domain alignment constraint comprises global distribution difference constraint of a source domain and a target domain and prototype distribution alignment constraint of the source domain and the target domain; And analyzing and processing the input data through the optimized graph neural network model to obtain a prediction result.
  2. 2. The method of claim 1, wherein training the target graph neural network model based on the primary task loss and the self-supervising auxiliary task loss using the training set to obtain a trained graph neural network model and a plurality of initial class prototypes, comprising: And updating parameters of the target graph neural network model by combining the main task loss and the prototype graph contrast learning loss on the source domain graph by adopting a gradient descent method until the performance of the target graph neural network model on a verification set is not improved, and reserving updated network parameters, embedded characterization of the source domain and prototype distribution, wherein the network parameters comprise shared encoder parameters, main task header parameters and self-supervision auxiliary task header parameters.
  3. 3. The method of claim 1, wherein the prototype graph contrast learning comprises: determining the similarity between each node in a target domain and a class prototype in a source domain, and distributing a pseudo label to the nodes according to the similarity; Determining the homogeneity score of a connecting edge of any two nodes, and carrying out homogeneity enhancement on the connecting edge according to the homogeneity score to obtain an enhanced view; initializing a group of trainable class prototype vectors, performing graph contrast learning according to the initialized class prototype vectors and the enhanced view, and introducing prototype clustering loss.
  4. 4. A method according to claim 3, wherein said determining the similarity of each node in the target domain to the class prototype in the source domain, assigning a pseudo tag to said node based on said similarity, comprises: Determining cosine similarity of an embedded vector of each node in the target domain and a prototype vector in the source domain, and determining soft allocation probability of the target domain node relative to each prototype in the source domain according to the cosine similarity; and taking the source domain category with the largest soft probability of the target domain node as the pseudo tag of the target domain node.
  5. 5. The method of claim 4, wherein determining the homogeneity score of the connecting edge of any two nodes, and performing homogeneity enhancement on the connecting edge according to the homogeneity score, to obtain an enhanced view, comprises: Determining the homogeneity score of a connecting edge according to a neighbor set of one node corresponding to the connecting edge and pseudo labels of two nodes corresponding to the connecting edge; judging whether the homogeneity score is higher than a preset threshold; If yes, reserving the connecting edge; and if not, disturbing the connecting edge.
  6. 6. A method according to claim 3, wherein the prototype-versus-learning loss satisfies the following formula: , Wherein, the For the prototype to compare the learning loss, The vector is embedded for the original node and, To enhance the embedding of the vectors by the nodes in the view, Is a temperature coefficient of the silicon carbide material, Is a node Is used for the allocation of the prototypes, Represent the first The prototype vector.
  7. 7. The method of claim 3, wherein the prototype clustering loss satisfies the following formula: , Wherein, the In order to cluster the losses of the clusters, As a total number of nodes, Representing the square of the norm of the vector, Is a node The assigned prototype vector is used to determine the model vector, Is the parameter of the ultrasonic wave to be used as the ultrasonic wave, In order to make the edge distance be the same, Is the first The prototype vector of the class is used to determine, Is the first Prototype vectors of classes.
  8. 8. The method of claim 1, wherein the global distribution difference constraint of the source domain and the target domain satisfies the following formula: , Wherein, the The loss is aligned for the global distribution of source and target domains, As the mean value of the target domain, Is the mean value of the source domain and, For the covariance of the target domain, For the covariance of the source domain, Is the square of the L2 norm, Is the square of the Frobenius norm.
  9. 9. The method of claim 1, wherein the prototype distribution alignment constraint of the source domain and the target domain satisfies the following formula: , Wherein, the For source domain and target domain prototype distribution alignment loss, For the prototype distribution of the target domain, For the prototype distribution of the source domain, Is KL divergence.

Description

Graph neural network test time adaptation method for outward distribution deviation Technical Field The application relates to the field of graph neural networks, in particular to a graph neural network test adaptation method for outward-deflection of distribution. Background Existing studies can be generalized into three types of solutions to the problem of off-distribution offset encountered by graph data. The first is a data-level-based method, which simulates potential offset by performing data enhancement construction on diversified samples in a training phase, and improves the adaptability of the model to distribution changes. Typical methods include feature perturbation, structural perturbation, multi-view generation, etc., which aim to expose the model to different types of pseudo-environments during training to learn more invariant characterizations, the second is model-based methods that promote generalization by directly incorporating specific prior knowledge or causal assumptions into GNNs designs, aiming to enhance the characterizations capabilities of GNNs at the architecture level, and the third is training strategy-based methods that guide the model to learn cross-environment stable features or decision rules by designing new learning objectives or optimization strategies. The domain adaptation method is common, and the source domain and the target domain are distributed in the hidden space to be consistent by means of statistical alignment means such as an antagonistic domain discriminator or Maximum mean difference (maximums MEAN DISCREPANCY, MMD). In recent years, aiming at the problem of off-distribution offset, a new learning strategy, namely a Test-Time Adaptation (TTA) method is proposed in the research field, and the model is subjected to on-line self-adaptive update by using a Test sample during the Test stage, so that the characterization can be dynamically adjusted in the deployment process to cope with the distribution offset. Although the above approach alleviates to some extent the performance degradation problem with distribution shifts, some challenges remain. First, data enhancement based methods rely on artificially designed perturbation strategies that cover a limited space of offsets, often making it difficult to simulate complex structural offsets that may occur in complex environments. Second, model-based approaches, while capable of radically enhancing characterizations, are often overly complex. Then, most of methods based on training strategies have stable implicit environment or consistent conditional distribution, and when test data dynamically evolves with time or scenes, the stability of category semantic boundaries is difficult to maintain. Meanwhile, the above three types of methods generally treat the distribution offset as a single whole without distinguishing the different effects of the covariate offset and the conceptual offset, resulting in difficulty in purposefully alleviating the effects of both offsets. Disclosure of Invention In order to solve the above problems, the present application provides a method for adapting to a neural network test of a graph oriented to a distributed outer offset, the method comprising: Acquiring a graph data set with relation type label information, and dividing the graph data set into a training set, a verification set and a test set; Training the target graph neural network model based on the main task loss and the self-supervision auxiliary task loss by utilizing the training set to obtain a trained graph neural network model and a plurality of initial class prototypes, wherein the self-supervision auxiliary task loss is a prototype graph contrast learning loss; optimizing parameters of the graph neural network model based on prototype graph comparison learning loss and multi-level domain alignment constraint by using a test set, wherein the prototype graph comparison learning loss comprises prototype comparison learning loss and prototype clustering loss, and the multi-level domain alignment constraint comprises global distribution difference constraint of a source domain and a target domain and prototype distribution alignment constraint of the source domain and the target domain; And analyzing and processing the input data through the optimized graph neural network model to obtain a prediction result. Optionally, the training the target graph neural network model based on the main task loss and the self-supervision auxiliary task loss by using the training set to obtain a trained graph neural network model and a plurality of initial category prototypes, including: And updating parameters of the target graph neural network model by combining the main task loss and the prototype graph contrast learning loss on the source domain graph by adopting a gradient descent method until the performance of the target graph neural network model on a verification set is not improved, and reserving updated network parameters, embed