An unsupervised domain adaptation method based on molecular graph structure alignment
By using a dual-branch graph neural network architecture, combined with graph attention networks and Motif branches, the problem of ignoring high-order structural information in cross-domain molecular graph classification is solved, and high-precision classification is achieved under the condition of no label in the target domain.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU RES INST OF XIAN UNIV OF ELECTRONIC SCI & TECH
- Filing Date
- 2026-03-02
- Publication Date
- 2026-06-09
AI Technical Summary
Existing graph domain adaptation methods ignore the high-order structural information of molecular graphs in cross-domain classification, which leads to a decline in cross-domain prediction performance. Furthermore, pseudo-labeling techniques are easily affected by domain offset, resulting in severe error accumulation.
A dual-branch graph neural network architecture is adopted, which combines graph attention network and motif branch to extract implicit and explicit features of molecular graph. Through adversarial training and pseudo-label screening mechanism, the alignment of cross-domain structure and category distribution is achieved.
It improves classification accuracy on unlabeled data in the target domain, robustly utilizes pseudo-labels through dual-branch collaborative training, reduces error accumulation, and improves cross-domain classification accuracy.
Smart Images

Figure CN122177286A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of new drug development and biomolecular activity analysis technology, and particularly relates to an unsupervised domain adaptive method based on molecular graph structure alignment. Background Technology
[0002] In the fields of new drug development and biomolecular activity analysis, it is often necessary to classify and predict molecular structures (usually represented as molecular graphs) to determine whether molecules possess specific biological activities or functions. However, molecular graph data acquired under different experimental conditions, data sources, or measurement platforms often exhibit significant domain shifts. That is, the source domain (labeled training data) and the target domain (unlabeled new data) may differ in molecular structural patterns and feature distributions. If a model trained in the source domain is directly applied to the target domain, model performance will severely degrade due to cross-domain distribution differences. Therefore, Graph Domain Adaptation (GDA) technology has emerged, aiming to enable models to adapt to target domain data with only source domain labels, improving classification accuracy on unlabeled data in the target domain. Especially in unsupervised GDA scenarios, assuming the target domain is completely unlabeled, cross-domain knowledge transfer can only be achieved using source domain annotations, posing a greater challenge to the model. The model not only needs to learn discriminative abilities from the source domain but must also effectively align the distribution differences between the source and target domains to avoid negative transfer in the target domain.
[0003] Most existing graph domain adaptation methods are based on the message passing mechanism of graph neural networks to extract features and combine adversarial training (such as domain discriminators) or distribution metric alignment (such as MMD distance minimization) to reduce the difference between the source and target domains. These methods improve cross-domain generalization performance to some extent, but still have important limitations: they mainly focus on the alignment of node features and ignore the role of higher-order structural information of the graph (such as specific functional group substructure patterns) in cross-domain feature alignment. For molecular graphs, different datasets often have differences in the distribution of typical substructure (motif) patterns. If the model does not utilize these explicit structural semantics, it may lead to the loss of cross-domain key information, affecting prediction performance. Many methods adopt global distribution alignment, approximating the feature distribution of the source and target domains without distinguishing between categories. This category-independent alignment may confuse the features of samples from different categories, leading to blurred classification decision boundaries in the target domain and decreased classification accuracy. Since the target domain lacks true labels, existing methods often use pseudo-labeling techniques to self-train the target samples. However, pseudo-labels of a single model are easily affected by domain offset, resulting in a high error rate. Incorrect pseudo-labels will be reinforced in subsequent training, causing error accumulation. Summary of the Invention
[0004] To address the problems existing in the prior art, this invention provides an unsupervised domain adaptive method based on molecular graph structure alignment. By introducing an explicit graph structure feature extraction and alignment mechanism, the model's classification performance on unlabeled molecular graph data in the target domain is improved.
[0005] The technical solution of this invention is implemented as follows: An unsupervised domain adaptive method based on molecular graph structure alignment includes the following steps: S1. The implicit local topological features of the molecular graph are extracted by using graph attention network branches to generate the graph representation of the corresponding GAT branches. S2. Extract the explicit functional substructures of the molecular graph using Motif branches and generate the corresponding graph representation of the Motif branches. S3. Set up a domain alignment module for adversarial training, reduce the distribution difference between the source domain and the target domain in the graph structure representation through the domain discriminator, and obtain the graph structure alignment loss. S4. Use the classifiers of the two branches to predict the target domain data. Utilize the consistency of the prediction results of the two branches to select high-confidence pseudo-label samples from the target domain to participate in training, perform class distribution alignment, and obtain the pseudo-label loss. S5. Using contrastive learning, the graph representations extracted from the same molecular graph in the GAT branch and the Motif branch are brought closer together, while the graph representations extracted from different molecular graphs in the GAT branch and the Motif branch are brought further apart. The graph representations extracted from the two branches are constrained to remain consistent, and cross-branch contrastive loss is obtained. S6. Calculate the classification loss of the two branches by constructing a classifier and jointly optimize the model parameters using the joint loss function.
[0006] Furthermore, define the dataset of the source domain. ,in, Represents the first term of the source domain A molecular diagram, Label its category; Dataset in the target domain It contains only the graph structure and no corresponding labels; Each molecule is denoted as... ,in, It is a set of nodes, representing atoms in a molecule. It is a set of edges, representing atomic bonds. The node feature matrix has an initial description vector dimension of 1. ; Assume that the graph data distributions of the source and target domains differ, i.e. ,in This represents the joint probability distribution of the source domain graph G and its label Y. Similarly, This represents the joint probability distribution of the target domain graph G and its label Y; It receives labeled source domain molecular graph data and unlabeled target domain molecular graph data, and represents them uniformly as a graph structure.
[0007] Furthermore, in S1, a graph attention network is used to extract semantic features of atoms and atomic bonds, capture microscopic adjacency structure information, and generate an implicit graph representation of the graph. A graph attention network is used to update the representation of each node through neighborhood attention aggregation; In the graph attention network In the layer, nodes Representation vector Represented by the layer above it and neighbor node set The representation is obtained through weighted aggregation, and the formula is: ; in, For the first The learnable weight matrix of the layer, Represents a non-linear activation function. Represents a node To the neighbors Attention weights, through and The upper-level representation is calculated and satisfies: ; It means that in Feature representation of neighboring nodes in a layered network; go through After attention message passing through the stacked layers, implicit local topological features are obtained. The node representations are aggregated into a graph representation using the readout function: ; In this case, READOUT selects the average pooling method; A graphical representation of the GAT branches of the molecular graph G. This represents the feature vector of node u in layer L. It represents the number of nodes in the graph.
[0008] Furthermore, in S2, functional substructure motifs are extracted from each molecular graph, and each functional substructure motif is processed as a motif subgraph. Motif subgraphs in the input molecular graph are detected based on a predefined functional group template library, where each template represents a typical functional group or substructure pattern. Define template set Each of them It is a subgraph pattern; When a Motif subgraph exists isomorphic to template set When, then determine the molecular diagram Contains the first Seed Motif sub-image; By traversing the template library, the molecular diagram Performing subgraph matching will yield a set of Motif subgraphs of the given graph. Each of them This represents a detected Motif sub-image; Then, local feature representations are extracted for each Motif substructure: the node features belonging to that Motif are averaged and pooled to obtain the graph representation vector of the Motif subgraph. ; In the implementation, an embedding vector is designed for each type of Motif subgraph. And it is concatenated with the node aggregation features of the Motif subgraph to reflect the category semantics of the Motif subgraph; Obtain the graph representation vectors of all Motif subgraphs in the graph. Then, the readout function is used to aggregate them to generate a graph representation of the Motif branches.
[0009] Furthermore, for each of the graph representation vectors of the Motif subgraph Transform it through a linear transformation matrix Projected into a new feature space, and then compared with the embedding vector of the corresponding Motif subgraph. By splicing, an enhanced representation is obtained; The importance score of the Motif subgraph is calculated using a single-layer attention network: ; in, For learnable attention vectors, The activation function is used; the importance scores of all motif subgraphs are normalized using the softmax function to obtain the attention weights. ; By weighting the graph representations of all Motif subgraphs for each molecular graph: ; Finally, we obtain the graph representation of the motif subgraphs of each molecular graph.
[0010] Furthermore, in step S3, a domain discriminator is deployed for each of the graph representations generated by the GAT branch and the Motif branch of the graph attention network. Determine whether the input graph representation comes from the source domain or the target domain: ; in, and Let represent the graph representations extracted from the source and target domain graphs, respectively. During training, the domain discriminator... The objective is to minimize the discrimination loss; A gradient reversal layer is introduced between the graph representation and the discriminator. The gradient is a unit function during forward propagation and its direction is reversed during backpropagation, thereby maximizing the loss of the feature extraction network. This min-max adversarial game can be formalized as follows: ; In practical implementation, a domain discriminator $D_{\text{gat}}$ and $D_{\text{motif}}$ are designed for the graph attention network GAT and Motif branches, respectively, for adversarial training, making the representations of the two sub-networks indistinguishable between the source and target domains; the final graph structure alignment loss is: .
[0011] Furthermore, in S4, for each target domain molecular graph The classifiers of the GAT branch and the Motif branch are used respectively to output the predicted class distribution. The GAT branch and the Motif branch, each based on their graph representation, are as follows: ; ; If the prediction results of the two branches are the same and the confidence level of both exceeds the set threshold If so, then the category of the molecular graph of the target domain is considered reliable, that is: ; ; The target domain molecular graph is then assigned a pseudo-label. And add it to the pseudo-label sample set; Then, during model training, the target domain data in the set is treated as labeled data and updated together with the source domain data to obtain the pseudo-label loss: ; in, This represents pseudo-label loss, used to guide model self-training on unlabeled data in the target domain. This represents the number of high-confidence pseudo-labeled samples selected. Represented as the first Target Map Assigned pseudo-labels, This indicates the use of the GAT branching model in the graph. Above pseudo-labels The logarithm of the predicted probability, and the GAT parameter is , This indicates the use of the Motif branching model in the graph. Above pseudo-labels The logarithm of the predicted probability, and the Motif parameter is .
[0012] Furthermore, in S5, the graph representation obtained by branching the same molecular graph using GAT is... The graph representation obtained by Motif branching They are considered positive sample pairs, both representing the semantics of the same molecular graph; The graph representation obtained by branching a molecular graph with GAT and the graph representation obtained by branching different molecular graphs with Motif are considered as negative sample pairs. make If we represent the cosine similarity between two vectors, we can construct a contrastive learning loss that increases the similarity of positive sample pairs and decreases the similarity of negative sample pairs. For each molecular map in a training batch, the contrastive loss can be defined as: ; in For temperature coefficient, Indicates the first The contrastive loss of a molecular diagram in structural contrastive learning is used to bring two representations of the same diagram closer together, while simultaneously widening the gap between representations of different diagrams. Indicates the first Molecular diagram The graph representation obtained after GAT branching is similar. Indicates the first Molecular diagram The graph representation obtained after Motif branching is represented by sim(·,·), which denotes the cosine similarity function. The cross-branch contrastive loss is obtained by summing the contrastive losses of all positive and negative samples from the training samples. : .
[0013] Furthermore, in S6, independent classifiers are constructed for the GAT branch and the Motif branch in the model, and supervised learning is performed on the graph representations extracted by each of them. For each source domain sample and their corresponding real tags Calculate its classification loss in both the GAT and Motif branches, i.e.: ; ; The final source domain supervised classification loss is defined as the sum of the losses from the GAT and Motif branches: .
[0014] Furthermore, the joint loss function is composed of weighted sums of the individual losses, let... For source domain supervision classification loss, For graph structure alignment loss, For pseudo-label loss, To compare losses across branches, the joint loss is: ; Minimize the joint loss during training. This enables joint optimization of model parameters.
[0015] Compared with the prior art, the present invention achieves the following beneficial effects: This invention provides an unsupervised domain adaptive method based on molecular graph structure alignment. It designs a bi-branch graph neural network architecture combined with multiple training mechanisms to simultaneously address the alignment problems of cross-domain structural differences and class distribution alignment. It introduces prior structural knowledge from the molecular domain, effectively aligns cross-domain structural differences, and robustly utilizes pseudo-labels for target domain training. This invention can learn graph representations that are both discriminative and insensitive to domain differences, achieving accurate classification and prediction of target domain molecular graph data without requiring manual annotation of the target domain. Compared with existing technologies, it has the following advantages: 1. Integrating implicit and explicit features for more comprehensive feature representation: This invention simultaneously extracts implicit local topological information (GAT branch) and explicit higher-order substructure information (Motif branch) through a dual-branch structure. The GAT branch utilizes an attention mechanism to aggregate neighbor features, highlighting the influence of local molecular structure on activity; the Motif branch extracts substructure patterns such as functional groups based on functional group templates, explicitly capturing the contribution of global molecular structure or specific group configurations to properties. These two representations complement each other, making the model's graphical representation more comprehensive and richer, and better characterizing key discriminative features of the molecular graph in cross-domain scenarios.
[0016] 2. Collaborative pseudo-label training improves adaptive accuracy: The dual-branch collaborative consistency pseudo-label selection strategy of this invention effectively ensures the reliability of pseudo-labels. A sample is only adopted when both branches predict the same category with high confidence, reducing the risk of introducing incorrect pseudo-labels into the model from the source. The two branches jointly participate in pseudo-label training, which is equivalent to the model cross-validating these pseudo-labels from different perspectives, avoiding the error accumulation that may occur during single-model self-training. Experiments show that this mechanism can select more accurate target domain samples for training, thereby better aligning the class distribution and improving classification accuracy in the target domain.
[0017] 3. User-friendly implementation and strong scalability: The method of this invention has clear modules, and each part is based on existing mature technologies (such as attention networks, pattern matching, adversarial training, and contrastive learning) with improvements and combinations, making it easy to implement and debug in practice. At the same time, the modules are loosely coupled, exhibiting good scalability. For example, the Motif template library can be replaced or expanded to adapt to different types of molecular map data, and different readout functions or attention mechanisms can be introduced to optimize branching performance. This makes this method widely applicable to various cross-domain molecular map analysis tasks, possessing high practical value. Attached Figure Description
[0018] Figure 1 This is a flowchart of an unsupervised domain adaptive method based on molecular graph structure alignment provided in an embodiment of the present invention. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions in the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0020] Example like Figure 1 An unsupervised domain adaptation method based on molecular graph structure alignment is proposed. The method framework of this invention adopts a dual-branch graph neural network model, including a main branch based on graph attention network (GAT) and an auxiliary branch based on motif substructure extraction, as well as a domain alignment and co-training module.
[0021] The entire model takes a molecular graph as input, extracts semantic representations of graphs at different levels through two branches, and then fuses these two representations through subsequent alignment and constraint mechanisms to improve cross-domain classification performance.
[0022] First, we define the unsupervised graph domain adaptation problem: Set the dataset of the source domain ,in, Represents the first term of the source domain A molecular diagram, Label its category; Dataset in the target domain It contains only the graph structure and no corresponding labels; Each molecule is denoted as... ,in, It is a set of nodes, representing atoms in a molecule. It is a set of edges, representing atomic bonds. The node feature matrix has an initial description vector dimension of 1. ; Assume that the graph data distributions of the source and target domains differ, i.e. ,in This represents the joint probability distribution of the source domain graph G and its label Y. Similarly, This represents the joint probability distribution of the target domain graph G and its label Y; The goal of unsupervised graph adaptation is to train a model that can adapt to the target graph under the supervision of labeled data in the source domain. To make accurate category predictions, the key issue lies in cross-domain alignment: the goal is to learn a discriminative model that makes the graph representation distributions of the source and target domains as close as possible, while preserving discriminative information useful for the task, thereby achieving high-accuracy classification results in the target domain.
[0023] It receives labeled source domain molecular graph data and unlabeled target domain molecular graph data, and represents them uniformly as a graph structure.
[0024] Specifically, the following steps are included: S1. The implicit local topological features of the molecular graph are extracted by using graph attention network branches to generate the graph representation of the corresponding GAT branches. In S1, a graph attention network is used to extract semantic features of atoms and atomic bonds, capture microscopic adjacency structure information, and generate an implicit graph representation of the graph. The GAT branch is used to extract implicit local topological features from the molecular graph. It employs a graph attention network to update the representation of each node through neighborhood attention aggregation. In the graph attention network In the layer, nodes Representation vector Represented by the layer above it and neighbor node set The representation is obtained through weighted aggregation, and the formula is: ; in, For the first The learnable weight matrix of the layer, Represents a non-linear activation function. Represents a node To the neighbors Attention weights, through and The upper-level representation is calculated and satisfies: ; It means that in Feature representation of neighboring nodes in a layered network; go through After attention message passing through the stacked layers, implicit local topological features are obtained. The node representations are aggregated into a graph representation using the readout function: ; In this case, READOUT selects the average pooling method; A graphical representation of the GAT branches of the molecular graph G. This represents the feature vector of node u in layer L. It represents the number of nodes in the graph.
[0025] Through the above process, the GAT branch learns the implicit topological representation of each graph under the supervision of the source domain labels, in order to capture the contribution of local atomic and bond relationships in the molecular graph to the classification task.
[0026] S2. Extract the explicit functional substructures of the molecular graph using Motif branches and generate the corresponding graph representation of the Motif branches. Motif branches are used to explicitly extract important substructure patterns such as functional groups in molecules and generate corresponding graphical representations.
[0027] In S2, functional substructure Motifs are extracted from each molecular graph, and each functional substructure Motif is treated as a Motif subgraph. Motif subgraphs in the input molecular graph are detected based on a predefined functional group template library, where each template represents a typical functional group or substructure pattern. Define template set Each of them It is a subgraph pattern; When a Motif subgraph exists isomorphic to template set When, then determine the molecular diagram Contains the first Seed Motif sub-image; By traversing the template library, the molecular diagram Performing subgraph matching will yield a set of Motif subgraphs of the given graph. Each of them This represents a detected Motif sub-image; Then, local feature representations are extracted for each Motif substructure: the node features belonging to that Motif are averaged and pooled to obtain the graph representation vector of the Motif subgraph. ; In the implementation, an embedding vector is designed for each type of Motif subgraph. And it is concatenated with the node aggregation features of the Motif subgraph to reflect the category semantics of the Motif subgraph; Obtain the graph representation vectors of all Motif subgraphs in the graph. Then, the readout function is used to aggregate them to generate a graph representation of the motif branches. The aggregation function POOL adopts an attention-based weighted pooling approach to adaptively fuse the contributions of different motifs to the substructure.
[0028] Specifically, for each of the graph representation vectors of the Motif subgraph Transform it through a linear transformation matrix Projected into a new feature space, and then compared with the embedding vector of the corresponding Motif subgraph. By splicing, an enhanced representation is obtained; The importance score of the Motif subgraph is calculated using a single-layer attention network: ; in, For learnable attention vectors, The activation function is used; the importance scores of all motif subgraphs are normalized using the softmax function to obtain the attention weights. ; By weighting the graph representations of all Motif subgraphs for each molecular graph: ; Finally, we obtain the graph representation of the motif subgraphs of each molecular graph.
[0029] This design enables the model to simultaneously consider the structural features and semantic category information of motifs, and adaptively assign higher weights to important motifs. Through this process, the motif branch extracts explicit high-order structural semantics for each molecular graph, i.e., which functional group patterns appear and in what combinations, thereby mitigating the impact of cross-domain structural differences on the model (e.g., if the source and target domains contain certain groups with different frequencies, this invention captures these group features explicitly and takes them into account during alignment).
[0030] S3. Set up a domain alignment module for adversarial training, reduce the distribution difference between the source domain and the target domain in the graph structure representation through the domain discriminator, and obtain the graph structure alignment loss. Since the molecular graphs of the source and target domains may differ in structural patterns and distributions, this invention introduces a domain alignment module for adversarial training to reduce the distributional differences between the two domain graph representations and ensure that the features extracted by the model have domain invariance.
[0031] In step S3, a domain discriminator is deployed for each of the graph representations generated by the GAT branch and the Motif branch of the graph attention network. (This can be viewed as a binary classifier) to determine whether the input graph representation comes from the source domain or the target domain: ; in, and Let represent the graph representations extracted from the source and target domain graphs, respectively. During training, the domain discriminator... The objective is to minimize the discrimination loss; To enable the representation extraction network to learn domain-invariant features that "confound the discriminator," a gradient reversal layer is introduced between the graph representation and the discriminator. This layer functions as a unit function during forward propagation and reverses the gradient direction during backpropagation, thereby maximizing the loss of the feature extraction network. This min-max adversarial game can be formalized as follows: ; In practical implementation, a domain discriminator $D_{\text{gat}}$ and $D_{\text{motif}}$ are designed for the graph attention network GAT and Motif branches, respectively, for adversarial training, making the representations of the two sub-networks indistinguishable between the source and target domains; the final graph structure alignment loss is: .
[0032] This min-max game ensures that the representations extracted by the final GAT and Motif branches cannot be easily distinguished by the discriminator from the source domain, thus achieving alignment between the source and target domains in the feature space. In particular, the Motif branch provides explicit structural pattern information, and through adversarial alignment, the source and target domains can be made to converge on the distribution of these functional substructures (e.g., common motifs in both domains will have similar representations), effectively reducing the interference of cross-domain structural differences on downstream classification.
[0033] S4. Use the classifiers of the two branches to predict the target domain data. Utilize the consistency of the prediction results of the two branches to select high-confidence pseudo-label samples from the target domain to participate in training, perform class distribution alignment, and obtain the pseudo-label loss. To further align the category distributions of the source and target domains, this invention designs a dual-branch collaborative pseudo-label selection strategy. Since the target domain lacks true labels, a model trained in the source domain generates predictions in the target domain, and high-confidence samples are selected as pseudo-labels for self-training. However, unlike existing methods, this invention utilizes the consistency of the dual-branch predictions to improve the reliability of the pseudo-labels.
[0034] In S4, for each target domain molecular graph The classifiers of the GAT branch and the Motif branch are used respectively to output the predicted class distribution. The GAT branch and the Motif branch, each based on their graph representation, are as follows: ; ; If the prediction results of the two branches are the same and the confidence level of both exceeds the set threshold If so, then the category of the molecular graph of the target domain is considered reliable, that is: ; ; The target domain molecular graph is then assigned a pseudo-label. And add them to the pseudo-label sample set; only these target samples that "pass both branches unanimously" are assigned pseudo-labels. And add it to the pseudo-label sample set.
[0035] Then, during model training, the target domain data in the set is treated as labeled data and updated together with the source domain data to obtain the pseudo-label loss: ; in, This represents pseudo-label loss, used to guide model self-training on unlabeled data in the target domain. This represents the number of high-confidence pseudo-labeled samples selected. Represented as the first Target Map Assigned pseudo-labels, This indicates the use of the GAT branching model in the graph. Above pseudo-labels The logarithm of the predicted probability, and the GAT parameter is , This indicates the use of the Motif branching model in the graph. Above pseudo-labels The logarithm of the predicted probability, and the Motif parameter is .
[0036] Because pseudo-labels are only adopted when both branches are highly confident and in agreement, this mechanism filters out most unreliable pseudo-labels, reducing the interference of mislabeling on training. Simultaneously, the two branches are jointly trained based on mutually agreed-upon pseudo-labels, effectively allowing two models from different perspectives to mutually correct and collaboratively improve, gradually enhancing classification decisions in the target domain. After several iterations of training, the model's predictions in the target domain become more robust, allowing for the selection of more high-confidence samples, forming a virtuous cycle, and thus achieving gradual alignment of the class decision boundary from the source domain to the target domain.
[0037] S5. Using contrastive learning, the graph representations extracted from the same molecular graph in the GAT branch and the Motif branch are brought closer together, while the graph representations extracted from different molecular graphs in the GAT branch and the Motif branch are brought further apart. The graph representations extracted from the two branches are constrained to remain consistent, and cross-branch contrastive loss is obtained. To ensure that the graph representations extracted by the two branches remain consistent in the semantic space, this invention introduces a cross-branch contrastive learning mechanism during training to impose consistency constraints on the GAT representation and Motif representation of the same graph.
[0038] In S5, the graph representation obtained by branching the same molecular graph using GAT is... The graph representation obtained by Motif branching They are considered positive sample pairs, both representing the semantics of the same molecular graph; The graph representation obtained by branching a molecular graph with GAT and the graph representation obtained by branching different molecular graphs with Motif are considered as negative sample pairs. make If we represent the cosine similarity between two vectors, we can construct a contrastive learning loss that increases the similarity of positive sample pairs and decreases the similarity of negative sample pairs. For each molecular map in a training batch, the contrastive loss can be defined as: ; in For temperature coefficient, Indicates the first The contrastive loss of a molecular diagram in structural contrastive learning is used to bring two representations of the same diagram closer together, while simultaneously widening the gap between representations of different diagrams. Indicates the first Molecular diagram The graph representation obtained after GAT branching is similar. Indicates the first Molecular diagram The graph representation obtained after Motif branching is represented by sim(·,·), which denotes the cosine similarity function. The cross-branch contrastive loss is obtained by summing the contrastive losses of all positive and negative samples from the training samples. : .
[0039] By minimizing this loss, the model can narrow the distance between each graph in the representation spaces of the two branches, making the encodings of the same graph by the GAT branch and the Motif branch more consistent; at the same time, it widens the cross-branch representations of different graphs, maintaining discriminativeness. In short, the structural contrastive learning module enables both branches to learn a unified and semantically consistent graph structure representation, effectively preventing excessive differences in the representations of the two branches. This not only improves the stability of the model but also provides a more solid representational foundation for subsequent domain alignment and classification.
[0040] S6. Calculate the classification loss of the two branches by constructing a classifier and jointly optimize the model parameters using the joint loss function.
[0041] To ensure the model possesses strong basic classification capabilities, this invention first performs supervised training on labeled data in the source domain. Since the source domain molecular graph has real labels, it can provide reliable semantic supervision signals for the model, thus laying a solid foundation for representation and classification throughout the cross-domain transfer task.
[0042] In S6, independent classifiers are constructed for the GAT branch and the Motif branch in the model, and supervised learning is performed on the graph representations extracted by each branch. This allows the two branches to fully learn the structure and category mapping relationship in the source domain from their respective perspectives, providing high-quality representation support for pseudo-label generation, domain alignment, and contrastive learning.
[0043] Specifically, for each source domain sample and their corresponding real tags Calculate its classification loss in both the GAT and Motif branches, i.e.: ; ; The final source domain supervised classification loss is defined as the sum of the losses from the GAT and Motif branches: .
[0044] The joint loss function is composed of weighted sums of individual losses. Let... For source domain supervision classification loss, For graph structure alignment loss, For pseudo-label loss, To compare losses across branches, the joint loss is: ; Minimize the joint loss during training. This enables joint optimization of model parameters.
[0045] The training process is as follows: First, the model is initialized. Then, in each iteration, the loss described above is calculated, and the parameters are updated via backpropagation. As training progresses, the pseudo-label set is updated periodically, selecting new high-confidence samples to be added to the training, continuously improving the performance in the target domain. Training continues until the loss converges or the preset number of iterations is reached.
[0046] The method of this invention combines a bi-branch structure and multiple training constraints to extract molecular graph features from both implicit and explicit levels, and optimizes three aspects: domain alignment, class alignment, and branch alignment. On the one hand, it utilizes adversarial training to reduce the overall distributional differences between the source and target domains; on the other hand, it aligns the class decision boundaries through pseudo-label collaborative training, while introducing contrastive constraints to unify the representation space of the bi-branch structure. The resulting model is insensitive to structural differences between the source and target domains, yet can accurately distinguish different classes, achieving superior molecular graph classification performance compared to existing technologies even when the target domain is unlabeled.
[0047] This invention proposes a cross-domain molecular graph classification algorithm with a dual-branch structure, which integrates explicit structural features and implicit semantic information. Through adversarial alignment, pseudo-label filtering, and structural consistency enhancement, it improves the cross-domain classification performance under unsupervised conditions.
[0048] The method described in this invention focuses on cross-domain adaptation by combining functional substructures and graph attention networks. In other embodiments, functionally equivalent replacements or modifications can be made to each module. The Motif branch uses predefined functional group templates to extract substructures, but other substructure mining methods can also be used, such as algorithms based on frequent subgraph pattern discovery or graph kernel-based methods (e.g., subgraph kernels, path kernels) to obtain explicit structural features. Any substructure features that reflect higher-order graph semantics and can be aggregated and utilized are equivalent variations of this invention. Regarding feature alignment, in addition to using adversarially trained domain discriminators, other distribution alignment techniques can be employed, such as maximum mean difference (MMD) loss to measure and minimize the distribution distance between source and target domain representations, or generative adversarial networks (GANs) to directly generate target domain-style graph data in the graph space to reduce the difference.
[0049] The core point of this invention is: 1. Two-branch graph neural network structure: This paper proposes a two-branch model that combines a graph attention network with a branch based on motif subgraph extraction to simultaneously extract the implicit and explicit structural semantics of the graph. By fusing local neighborhood information and global substructure pattern information in a single model, the cross-domain feature representation capability is significantly improved.
[0050] 2. A method for motif extraction and aggregation based on functional group templates: A functional group template library for molecular graphs was designed, and efficient extraction and characterization of matching substructures in the input graph were achieved, transforming key structural patterns in the molecule into explicit feature representations that can be used for machine learning; further, an aggregation function was used to combine multiple motif subgraph features into graph-level vectors for downstream tasks.
[0051] 3. Adversarial Training Mechanism for Graph Structure Alignment: A domain discriminator is introduced, and adversarial training is used to align the graph representations extracted by the model between the source and target domains. In particular, adversarial alignment applied to the motif branches enables a unified representation of the shared functional substructure patterns between the two domains, avoiding performance degradation caused by structural differences.
[0052] 4. A Collaborative Consistency Strategy for False Label Selection: This paper proposes a strategy to select false labels for target domain samples using the consistency of prediction confidence across two branches. Only predictions with high confidence consensus in both the GAT and Motif branches are selected as training supervision signals, thus ensuring the accuracy of the false labels. This strategy achieves cross-model mutual validation, significantly reducing the interference of false label noise on training.
[0053] Based on the disclosure and teachings of the foregoing specification, those skilled in the art can make changes and modifications to the above embodiments. Therefore, the present invention is not limited to the specific embodiments disclosed and described above, and some modifications and changes to the present invention should also fall within the protection scope of the claims of the present invention. Furthermore, although some specific terms are used in this specification, these terms are only for convenience of explanation and do not constitute any limitation on the present invention.
Claims
1. An unsupervised domain adaptive method based on molecular graph structure alignment, characterized in that, Includes the following steps: S1. The implicit local topological features of the molecular graph are extracted by using graph attention network branches to generate the graph representation of the corresponding GAT branches. S2. Extract the explicit functional substructures of the molecular graph using Motif branches and generate the corresponding graph representation of the Motif branches. S3. Set up a domain alignment module for adversarial training, reduce the distribution difference between the source domain and the target domain in the graph structure representation through the domain discriminator, and obtain the graph structure alignment loss. S4. Use the classifiers of the two branches to predict the target domain data. Utilize the consistency of the prediction results of the two branches to select high-confidence pseudo-label samples from the target domain to participate in training, perform class distribution alignment, and obtain the pseudo-label loss. S5. Using contrastive learning, the graph representations extracted from the same molecular graph in the GAT branch and the Motif branch are brought closer together, while the graph representations extracted from different molecular graphs in the GAT branch and the Motif branch are brought further apart. The graph representations extracted from the two branches are constrained to remain consistent, and cross-branch contrastive loss is obtained. S6. Calculate the classification loss of the two branches by constructing a classifier and jointly optimize the model parameters using the joint loss function.
2. The unsupervised domain adaptive method based on molecular graph structure alignment according to claim 1, characterized in that, Set the dataset of the source domain ,in, Represents the first term of the source domain A molecular diagram, Label its category; Dataset in the target domain It contains only the graph structure and no corresponding labels; Each molecule is denoted as... ,in, It is a set of nodes, representing atoms in a molecule. It is a set of edges, representing atomic bonds. The node feature matrix has an initial description vector dimension of 1. ; Assume that the graph data distributions of the source and target domains differ, i.e. ,in This represents the joint probability distribution of the source domain graph G and its label Y. Similarly, This represents the joint probability distribution of the target domain graph G and its label Y; It receives labeled source domain molecular graph data and unlabeled target domain molecular graph data, and represents them uniformly as a graph structure.
3. The unsupervised domain adaptive method based on molecular graph structure alignment according to claim 2, characterized in that, In S1, a graph attention network is used to extract semantic features of atoms and atomic bonds, capture microscopic adjacency structure information, and generate an implicit graph representation of the graph. A graph attention network is used to update the representation of each node through neighborhood attention aggregation; In the graph attention network In the layer, nodes Representation vector Represented by the layer above it and neighbor node set The representation is obtained through weighted aggregation, and the formula is: ; in, For the first The learnable weight matrix of the layer, Represents a non-linear activation function. Represents a node To the neighbors Attention weights, through and The upper-level representation is calculated and satisfies: ; It means that in Feature representation of neighboring nodes in a layered network; go through After attention message passing through the stacked layers, implicit local topological features are obtained. The node representations are aggregated into a graph representation using the readout function: ; In this case, READOUT selects the average pooling method; A graphical representation of the GAT branches of the molecular graph G. This represents the feature vector of node u in layer L. It represents the number of nodes in the graph.
4. The unsupervised domain adaptive method based on molecular graph structure alignment according to claim 2, characterized in that, In S2, functional substructure Motifs are extracted from each molecular graph, and each functional substructure Motif is treated as a Motif subgraph. Motif subgraphs in the input molecular graph are detected based on a predefined functional group template library, where each template represents a typical functional group or substructure pattern. Define template set Each of them It is a subgraph pattern; When a Motif subgraph exists isomorphic to template set When, then determine the molecular diagram Contains the first Seed Motif sub-image; By traversing the template library, the molecular diagram Performing subgraph matching will yield a set of Motif subgraphs of the given graph. Each of them This represents a detected Motif sub-image; Then, local feature representations are extracted for each Motif substructure: the node features belonging to that Motif are averaged and pooled to obtain the graph representation vector of the Motif subgraph. ; In the implementation, an embedding vector is designed for each type of Motif subgraph. And it is concatenated with the node aggregation features of the Motif subgraph to reflect the category semantics of the Motif subgraph; Obtain the graph representation vectors of all Motif subgraphs in the graph. Then, the readout function is used to aggregate them to generate a graph representation of the Motif branches.
5. The unsupervised domain adaptive method based on molecular graph structure alignment according to claim 4, characterized in that, For each of the graph representation vectors of the Motif subgraph Transform it through a linear transformation matrix Projected into a new feature space, and then compared with the embedding vector of the corresponding Motif subgraph. By splicing, an enhanced representation is obtained; The importance score of the Motif subgraph is calculated using a single-layer attention network: ; in, For learnable attention vectors, The activation function is used; the importance scores of all motif subgraphs are normalized using the softmax function to obtain the attention weights. ; By weighting the graph representations of all Motif subgraphs for each molecular graph: ; Finally, we obtain the graph representation of the motif subgraphs of each molecular graph.
6. The unsupervised domain adaptive method based on molecular graph structure alignment according to claim 5, characterized in that, In step S3, a domain discriminator is deployed for each of the graph representations generated by the GAT branch and the Motif branch of the graph attention network. Determine whether the input graph representation comes from the source domain or the target domain: ; in, and Let represent the graph representations extracted from the source and target domain graphs, respectively. During training, the domain discriminator... The objective is to minimize the discrimination loss; A gradient reversal layer is introduced between the graph representation and the discriminator. The gradient is a unit function during forward propagation and its direction is reversed during backpropagation, thereby maximizing the loss of the feature extraction network. This min-max adversarial game can be formalized as follows: ; In practical implementation, a domain discriminator $D_{\text{gat}}$ and $D_{\text{motif}}$ are designed for the graph attention network GAT and Motif branches, respectively, for adversarial training, making the representations of the two sub-networks indistinguishable between the source and target domains; the final graph structure alignment loss is: 。 7. The unsupervised domain adaptive method based on molecular graph structure alignment according to claim 6, characterized in that, In S4, for each target domain molecular graph The classifiers of the GAT branch and the Motif branch are used respectively to output the predicted class distribution. The GAT branch and the Motif branch, each based on their graph representation, are as follows: ; ; If the prediction results of the two branches are the same and the confidence level of both exceeds the set threshold If so, then the category of the molecular graph of the target domain is considered reliable, that is: ; ; The target domain molecular graph is then assigned a pseudo-label. And add it to the pseudo-label sample set; Then, during model training, the target domain data in the set is treated as labeled data and updated together with the source domain data to obtain the pseudo-label loss: ; in, This represents pseudo-label loss, used to guide model self-training on unlabeled data in the target domain. This represents the number of high-confidence pseudo-labeled samples selected. Represented as the first Target Map Assigned pseudo-labels, This indicates the use of the GAT branching model in the graph. Above pseudo-labels The logarithm of the predicted probability, and the GAT parameter is , This indicates the use of the Motif branching model in the graph. Above pseudo-labels The logarithm of the predicted probability, and the Motif parameter is .
8. The unsupervised domain adaptive method based on molecular graph structure alignment according to claim 7, characterized in that, In S5, the graph representation obtained by branching the same molecular graph using GAT is... The graph representation obtained by Motif branching They are considered positive sample pairs, both representing the semantics of the same molecular graph; The graph representation obtained by branching a molecular graph with GAT and the graph representation obtained by branching different molecular graphs with Motif are considered as negative sample pairs. make If we represent the cosine similarity between two vectors, we can construct a contrastive learning loss that increases the similarity of positive sample pairs and decreases the similarity of negative sample pairs. For each molecular map in a training batch, the contrastive loss can be defined as: ; in For temperature coefficient, Indicates the first The contrastive loss of a molecular diagram in structural contrastive learning is used to bring two representations of the same diagram closer together, while simultaneously widening the gap between representations of different diagrams. Indicates the first Molecular diagram The graph representation obtained after GAT branching is similar. Indicates the first Molecular diagram The graph representation obtained after Motif branching is represented by sim(·,·), which denotes the cosine similarity function. The cross-branch contrastive loss is obtained by summing the contrastive losses of all positive and negative samples from the training samples. : 。 9. The unsupervised domain adaptive method based on molecular graph structure alignment according to claim 8, characterized in that, In S6, independent classifiers are constructed for the GAT branch and Motif branch in the model, and supervised learning is performed on the graph representations extracted by each of them. For each source domain sample and their corresponding real tags Calculate its classification loss in both the GAT and Motif branches, i.e.: ; ; The final source domain supervised classification loss is defined as the sum of the losses from the GAT and Motif branches: 。 10. The unsupervised domain adaptive method based on molecular graph structure alignment according to claim 9, characterized in that, The combined loss function is composed of weighted sums of the individual losses. Let... For source domain supervision classification loss, For graph structure alignment loss, For pseudo-label loss, To compare losses across branches, the joint loss is: ; Minimize the joint loss during training. This enables joint optimization of model parameters.