A few-shot image classification method based on track enhancement and residual prompt
By using orbital augmentation views and orbital anchor representations, this method addresses the issues of insufficient representation of high-order topological structures and poor robustness of single vectors in existing graph pre-training methods. It achieves efficient graph classification in scenarios with few samples, improving the model's generalization ability and the efficiency of pre-training knowledge transfer.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SOUTHWEST PETROLEUM UNIV
- Filing Date
- 2026-02-11
- Publication Date
- 2026-05-01
AI Technical Summary
Existing graph pre-training-downstream hinting methods lack explicit representation and transfer mechanisms for high-order topological structures, which hinders the transfer of pre-training knowledge. Furthermore, a single deterministic vector is insufficient to cover complex, low-sample task distributions, resulting in poor robustness.
By constructing an orbital augmented view and representing orbital anchors, and combining prototype-aware pre-training with orbital prior constraints, learnable graph cue vectors are generated to guide graph-level representation generation and classification. The orbital augmented view is constructed using the orbital association matrix and random walks, and learnable global prototype parameters are introduced to perform asymmetric contrastive learning and prototype consistency constraints, generating graph cue vectors with a mixture of Gaussian distributions.
It significantly improves the accuracy and robustness of molecular property prediction and drug screening, effectively capturing long-range dependencies and structural diversity of molecular structures with very few samples, reducing the dependence on labeled data and accelerating model convergence.
Smart Images

Figure CN121708404B_ABST
Abstract
Description
A few-shot graph classification method based on orbit enhancement and residual cues Technical Field
[0001] This invention relates to the fields of artificial intelligence and graph deep learning technology, and in particular to a few-sample graph classification method based on orbit enhancement and residual hints. Background Technology
[0002] In the fields of biochemistry and computer-aided drug design, graph data structures (graphs) are widely recognized as the optimal mathematical model for characterizing molecular topological properties and chemical microenvironments. Unlike traditional Euclidean space data, molecular graphs construct a highly nonlinear non-Euclidean space through the complex coupling of nodes (mapping atomic entities and their physicochemical properties) and edges (mapping chemical bond connections and interaction forces). In this context, graph classification tasks are no longer merely simple clustering of data structures, but rather reveal potential quantitative structure-activity relationships between molecular structures and biological activities through deep analysis of the graph's topological structure. This technical approach plays a crucial role in modern drug development processes and is widely used in core scenarios such as high-throughput candidate drug screening, prediction of molecular ADMET properties (absorption, distribution, metabolism, excretion, and toxicity), and target affinity determination.
[0003] In recent years, Graph Neural Networks (GNNs) have become a core tool for graph representation learning due to their powerful ability to model non-Euclidean space data, especially in processing biochemical data with highly nonlinear characteristics (such as compound molecular graphs and protein interaction networks) and mining their deep topological semantics. However, in practical applications, data often exhibits characteristics of "abundant unlabeled data, scarce labeled data, and diverse downstream tasks." For example, determining the properties of a new molecule usually requires expensive and time-consuming experiments; traditional supervised GNN training methods heavily rely on large amounts of manually labeled data, making them difficult to apply directly in scenarios with few samples.
[0004] To address the aforementioned issues, the "graph pre-training-downstream hint" technique has emerged. This paradigm learns a general graph representation on massive amounts of unlabeled graph data and then transfers it to specific downstream tasks. This method freezes the backbone parameters of the pre-trained graph model and adapts it to the downstream task by learning only a small number of hint parameters. While these methods demonstrate excellent parameter efficiency, in few-sample graph classification tasks with extremely limited samples, existing techniques still suffer from the following two significant drawbacks:
[0005] First, existing methods lack explicit representation and transfer mechanisms for higher-order topological structures, hindering the transfer of pre-trained knowledge. For example, in scenarios such as molecular property prediction, the key to determining properties is often specific local substructures (such as functional groups or specific ring systems). Existing methods focus more on feature-level alignment and fail to effectively extract and retain the semantics of these higher-order structures shared across graphs. This results in the model being unable to effectively invoke the general structural rules learned in the pre-training stage in downstream low-sample tasks, severely limiting its generalization ability in the recognition of new molecular structures.
[0006] Second, existing downstream suggestions are mostly modeled as a single deterministic vector and initialized randomly, which makes it difficult to adapt to complex task distributions. However, in real-world applications, molecules of the same class often have huge structural differences (for example, molecules with the same pharmacological activity may have completely different skeletal structures). This single representation method cannot cover the distribution space with large intra-class variance, which makes it difficult for the model to capture the real data distribution patterns when there are very few training samples. It is prone to overfitting and has poor robustness. Summary of the Invention
[0007] To address the aforementioned technical problems—namely, the lack of explicit representation and transfer mechanisms for high-order topological structures in existing graph cueing learning methods, leading to hindered knowledge transfer during pre-training, and the poor robustness caused by the inability to cover complex few-sample task distributions using a single deterministic vector—this invention provides a few-sample graph classification method based on orbital enhancement and residual cues. This method can effectively mine latent structural semantics in data and is particularly suitable for applications such as molecular property prediction and drug screening, which are highly dependent on topological structure and have scarce samples. The method mainly includes the following steps:
[0008] S1: Construction of the enhanced track view: The original graph data is statistically analyzed to identify the corresponding tracks of primitives with 2-5 nodes to characterize the structural roles of the nodes, generating a track counting matrix and normalizing it; the track correlation matrix is calculated based on the normalized track counting matrix, and the track correlation matrix is used as the adjacency relationship of the track topology space. The enhanced track view is obtained through random walk; the original graph data is used as the original view, and the original view and the enhanced track view constitute dual-view training data.
[0009] S2: Prototype-aware pre-training of orbit prior constraints: The graph encoder is pre-trained based on the dual-view training data, and learnable global prototype parameters are introduced; the graph-level representations of the original view and the orbit-enhanced view are respectively calculated on the global prototype, and consistency constraints are applied to the allocation probability distributions of the two views to obtain the pre-trained graph encoder.
[0010] S3: Orbit Anchor Representation Construction: For each category of the downstream few-shot task, obtain M training samples of that category, and construct the corresponding downstream orbit augmentation view for the training samples; use the pre-trained graph encoder obtained in step S2 to extract the graph-level representation vector of the training samples of that category, and perform mean aggregation on the graph-level representation vectors of the same category to obtain the orbit anchor representation of that category.
[0011] S4: Graph cue vector generation based on track anchor representation: Using the track anchor representation obtained in step S3 as a reference, a cue distribution is constructed through a learnable parameterized mapping; and a graph cue vector is obtained from the cue distribution;
[0012] S5: Graph-level representation generation and classification guided by graph cue vectors: Keep the parameters of the pre-trained graph encoder frozen, use the graph cue vectors as attention guides, aggregate node-level representation vectors to obtain graph-level representation vectors; and update the learnable parameters in the graph cue vectors by minimizing the objective function containing classification loss and regularization constraints, and use the updated graph cue vectors to guide the generation of graph-level representation vectors to complete the classification.
[0013] Further, in step S1, the enhanced orbital view specifically includes: using the original view The occurrence frequency of each node on 73 types of orbits corresponding to primitives of 2-5 predefined nodes is counted to generate an orbit counting matrix, and the orbit counting matrix is then normalized to obtain a normalized matrix. ; Calculate the orbital correlation matrix based on the normalized matrix. The orbital correlation matrix is used to characterize the higher-order co-occurrence relationships between different primitive orbits; and a random walk is performed on the topological space defined by the orbital correlation matrix to generate the orbital augmentation view. .
[0014] Further, in step S2, the learnable global prototype set K represents the global prototype set. The number of prototype vectors in the middle (i.e., the number of prototypes); This represents the k-th prototype vector. Update according to the following formula:
[0015] ;
[0016] in To update the momentum coefficient; Within each training batch, the batch aggregate representation corresponding to the k-th prototype is calculated.
[0017] Further, in step S2, the prototype perception pre-training of the orbital prior constraints includes: constructing an asymmetric contrastive learning architecture, wherein the online network is composed of an online encoder. With predictor The target network consists of a target encoder. Composition; Initialization of online encoder parameters With target encoder parameters and with momentum coefficient The target encoder parameters are updated using the following formula:
[0018] ;
[0019] The original view and track-enhanced view of the same sample in batch B are obtained through the global readout operator. Graph-level representations were obtained respectively. and , Based on graph-level representation and learnable global prototype set The similarity between the prototype vectors is used to calculate the original view-level representation vector. Assignment probability to the kth structural prototype for:
[0020] ;
[0021] in, Representing the j-th global prototype vector, the graph-level representation vector is calculated. The similarity between the sample and each prototype vector characterizes the degree of matching between the sample and different structural semantic clusters; by traversing all... The K allocation probabilities calculated above together constitute the allocation probability distribution under the original view. Similarly, the enhanced track view can be obtained. Distribution probability distribution The symmetric KL divergence between the probability assignments of the two views is used as the prototype consistency loss.
[0022] ;
[0023] in This indicates gradient stopping; KL represents the Kullback-Leibler divergence, used to measure the degree of difference between two probability distributions; simultaneously, it obtains the prediction vectors of the online network for the original view and the track-enhanced view. and Calculate the bidirectional prediction negative cosine similarity as the contrast loss:
[0024] ;
[0025] Negative cosine similarity constraints are applied to the representations of the two views to align the prediction results in both directions, thereby establishing a symmetrical and consistent representation space constraint relationship. The prototype consistency loss and the contrastive loss are then weighted and summed to form a pre-trained objective function, thus obtaining the pre-trained graph encoder.
[0026] ;
[0027] in, These are the weighting coefficients for the loss term, used to balance the prototype consistency loss. Compared with loss The relative contribution of pre-training to the total pre-training loss.
[0028] Further, in step S3, the construction of the orbital anchor representation includes: the training sample set of the c-th category in the downstream few-shot task. Each training image sample Construct the corresponding downstream track augmentation view according to step S1. Enhance the view of the downstream track. Input pre-trained graph encoder Obtain node-level representations and use global readout operators. Obtain the graph-level representation vector; aggregate all graph-level representation vectors of the c-th category to obtain the orbital anchor representation of that category. It satisfies:
[0029] ;
[0030] in, This represents the number of samples in the training sample set for the c-th category.
[0031] Further, in step S4, the generation of the graph cue vector includes: for category c, representing its orbital anchor. A sampling distribution for generating graph cue vectors is constructed based on this distribution; the center parameters of the sampling distribution are obtained through the following affine residual transformation:
[0032] ;
[0033] in For learnable scaling factors, The bias vector is a learnable vector; and a learnable log-variance parameter is introduced to obtain the variance vector. Construct constraints on the suggested sampling distribution. The constraints are then incorporated into the training objective function:
[0034] ;
[0035] in, The model represents a standard normal distribution; KL represents the Kullback-Leibler divergence, constraining the latent variable distribution learned by the model to approximate a standard normal distribution; based on the central parameters and variance vector, a differentiable sampling mapping is used to obtain the corresponding category. Hint component vector Generate learnable hybrid weight vectors The cue component vectors are then weighted and fused according to the mixing weights to obtain the graph cue vector for that category. .
[0036] Further, in step S5, the aggregation of node-level representation vectors into graph-level representation vectors satisfies: for graph samples Node set Let the node-level representation vector be... The graph hint vector obtained using step S4 is Then calculate each node The relevance score is the dot product of the node representation and the graph cue vector:
[0037] ;
[0038] The node weights are obtained in an exponentially normalized form. :
[0039] ;
[0040] in, Represents node u and graph hint vector The matching score satisfies And based on this, the graph-level representation vector is obtained:
[0041] .
[0042] Furthermore, in step S5, the overall training objective function of the downstream model is... for:
[0043] ;
[0044] in, Cross-entropy loss is used to supervise classification accuracy; distribution difference constraint term. The difference between the sampling distribution used to generate the graph cue vector in step S4 and the preset prior distribution is used to constrain the difference between the two, with weighted coefficients. The total objective function is obtained by performing a weighted summation. During the optimization process, the parameters of the pre-trained graph encoder are kept frozen, and only the learnable parameters related to graph cue vector generation and classification prediction are updated.
[0045] The beneficial effects of this invention are:
[0046] Effectively capturing high-order structural information: This invention constructs orbital-enhanced views through random walks based on primitive orbits, enabling explicit mining of high-order structural roles and topological co-occurrence relationships within the graph. This solves the problem of structural semantic loss caused by traditional methods relying solely on first-order neighbor information. Particularly in molecular property prediction scenarios, the physicochemical properties of molecules are often determined by specific functional groups (such as benzene rings and carboxyl groups) and their spatial positions. This invention can accurately identify these key substructures (i.e., pharmacophores) that determine molecular activity, effectively capturing long-range dependencies between atoms even in complex and variable molecular skeletons, thereby significantly improving the accuracy of predicting molecular properties such as water solubility and toxicity.
[0047] Enhanced adaptability and robustness of prompts: The graph cue vector generation based on orbital anchor representation proposed in this invention breaks the limitations of traditional fixed vector cueing. By introducing residual structure and Gaussian distribution sampling, the model not only inherits the orbital prior from the pre-training stage but also flexibly adjusts to adapt to the semantic biases specific to downstream tasks, significantly improving generalization ability in scenarios with few samples. Taking high-throughput screening in new drug development as an example, active molecules often have huge structural diversity (i.e., significant within-class variance). This invention uses a Gaussian mixture distribution to model graph cue vectors, which can cover a wider range of chemical spatial distributions. This allows the model to adapt to test data with different skeletal structures even when faced with only a very small number of known active molecules, effectively solving the overfitting problem caused by sample scarcity.
[0048] This invention improves the efficiency of pre-training knowledge transfer: Through prototype-aware pre-training with orbital prior constraints, and utilizing asymmetric contrastive learning and prototype consistency constraints, it achieves the alignment of semantic distributions between different views during the pre-training stage. This allows downstream tasks to more effectively utilize the prior knowledge of the pre-trained model, reducing the risk of negative transfer. In practical applications, this means that the model can efficiently transfer general chemical rules (such as atomic valence rules and ring system stability) learned from large-scale general molecular databases to specific target affinity prediction tasks. This not only significantly reduces the dependence of downstream tasks on labeled data but also significantly accelerates the convergence speed of the model on specific biochemical tasks, reducing R&D costs. Attached Figure Description
[0049] Figure 1 is a schematic diagram of the overall process of a few-sample graph classification method based on orbit enhancement and residual hints provided in an embodiment of the present invention;
[0050] Figure 2 is a schematic diagram of the principle of constructing the orbital enhancement view described in step S1 of this embodiment of the invention;
[0051] Figure 3 is a schematic diagram of the element track described in step S1 of the present invention;
[0052] Figure 4 is a schematic diagram of the prototype perception pre-trained network architecture for the orbit prior constraint described in step S2 of this embodiment of the invention.
[0053] Figure 5 is a schematic diagram of the framework for graph cue vector generation and downstream task adaptation described in steps S3 to S5 of this embodiment of the invention.
[0054] Figure 6 is a comparison table of experimental results between the method of the present invention and existing mainstream methods on four standard graph classification benchmark datasets in the fields of biochemistry / medicine (including COX2, MUTAG, BZR, NCI1). Detailed Implementation
[0055] To make the objectives, technical solutions, and advantages of this invention clearer, the implementation steps of this invention will be described in detail below with reference to the accompanying drawings, using a standard image classification benchmark dataset in the field of biochemistry / medicine as an example. Here, the illustrative embodiments and descriptions of this invention are used to explain the invention, but are not intended to limit the invention.
[0056] As shown in Figure 1, the specific implementation steps of the method in this embodiment are as follows:
[0057] S1: Construction of the enhanced track view: The original graph data is statistically analyzed to identify the corresponding tracks of primitives with 2-5 nodes to characterize the structural roles of the nodes, generating a track counting matrix and normalizing it; the track correlation matrix is calculated based on the normalized track counting matrix, and the track correlation matrix is used as the adjacency relationship of the track topology space. The enhanced track view is obtained through random walk; the original graph data is used as the original view, and the original view and the enhanced track view constitute dual-view training data.
[0058] The orbital enhancement view construction described in step S1, as shown in Figure 2, specifically involves obtaining a biochemical molecular original map dataset from the input original map dataset, as shown in Figure 2(A). Each graph data in the original graph dataset Each node in the graph represents a specific compound molecule (e.g., a drug molecule) as the original molecule. The corresponding set of atoms in the molecule, where Represents the number of nodes (atoms) in a molecular graph; edge set The set of chemical bonds in the corresponding molecule (such as single bonds, double bonds, or aromatic bonds); initial characteristic matrix This provides the initial characteristic data for the nodes (atoms) (specifically including physicochemical properties such as atomic number, chirality, and hybridization type). For ease of description, in subsequent steps, nodes are equivalent to atoms, and edges are equivalent to chemical bonds; the original graph data serves as the initial view.
[0059] First, based on predefined primitive orbitals, the frequency of occurrence of each atom in the original molecule on different primitive orbitals is counted; here, "primitive orbital" refers to the structural role divided according to topological symmetry in a specific substructure. In chemical molecules, these primitives represent the basic geometric patterns that constitute complex molecules; Figure 3 shows the structural templates of all connected non-isomorphic primitives (graphlets) with 2 to 5 nodes. – The primitive and its corresponding automorphic orbital partitioning. Each primitive represents a local topological pattern, and the structures of different primitives are different. The numbers 0-72 next to the nodes in the figure represent automorphic orbital numbers, used to distinguish position types with different topological roles under structural symmetry transformations; nodes with the same color under the same primitive structural template belong to the same orbital category. Primitives with 2-5 nodes can cover a variety of chemical patterns from simple chemical bonds to complex ring systems and functional group skeletons. Orbitals are equivalent sets of nodes partitioned according to automorphic symmetry within the same primitive. It reflects the relative positions of atoms in a specific geometric structure; as shown in the primitive orbitals in Figure 2(B), taking a chain primitive composed of 3 atoms as an example, the atoms at both ends of the chain are topologically "symmetrical"; therefore, they belong to the same orbital (corresponding to orbital 1 in the primitive orbitals of Figure 2(B), while the atom in the middle of the chain has a topological position that is obviously different from that at the end; therefore, it belongs to another orbital (corresponding to orbital 2 in Figure 3); the orbitals distinguish the functional differences of atoms in functional groups; for example, in the same primitive, it distinguishes between "atoms on the ring" and "atoms at the branch points of the side chain". Typically, primitives with 2-5 nodes correspond to 73 orbital roles. In this embodiment, these 73 orbital roles are used as a unified benchmark for describing the topological properties of molecules. For each atom in a molecule, the number of times it appears in orbital 0, orbital 2, ... up to orbital 72 is counted, which forms a 73-dimensional vector. This 73-dimensional vector is the "structural role" of the atom. If two atoms (even if they belong to different molecules) have similar structural roles, it means that they are in extremely similar chemical microenvironments (e.g., both are para carbon atoms with a benzene ring connected to an electron-withdrawing group), so that they can share similar embedding representations in the subsequent graph neural network.
[0060] Based on the above statistics, an orbital-enhanced view is constructed, as shown in Figure 2(B). The orbital count matrix corresponding to the original view (i.e., the molecular diagram) is generated. To eliminate the scale differences caused by different molecular sizes, the matrix is normalized to obtain a normalized orbital count matrix. Then, the orbital correlation matrix corresponding to the diagram is calculated. This matrix captures the higher-order co-occurrence relationships of different orbitals within the graph topology. The calculation formula is as follows:
[0061] ;
[0062] in, The physical meaning of this matrix is that if two orbitals frequently appear simultaneously on multiple atoms in the same molecule, their correlation value in the matrix is high; this constructs an abstract topological space with "orbitals" as nodes and "co-occurrence intensity" as edges.
[0063] Finally, as shown in Figure 2(C), The topological space is defined as the adjacency matrix, and the Node2Vec random walk algorithm is performed on this space to extract orbit embeddings containing rich high-order structure information, denoted as . Based on the above information, an enhanced orbital view that explicitly includes structural role information is constructed; the data in this view is called the orbital graph. ,in Depend on In order to distinguish it from the original molecular graph, the graph data that constitutes the orbital enhancement view is defined as an orbital graph in this embodiment.
[0064] The orbital augmentation view constructed in step S1 not only provides a complementary view rich in high-order semantics for subsequent contrastive learning, but also fundamentally injects the entire model with the intrinsic ability to recognize complex topological patterns. This is a decisive technical feature for achieving efficient transfer learning with few samples. Specifically, traditional graph neural networks, limited by local message passing mechanisms based on chemical bonds, often struggle to capture long-range dependencies in molecular graphs that are geographically distant but functionally closely related. This step constructs an orbital graph that transcends physical connections by calculating the orbital correlation matrix and performing random walks. This orbital augmentation view can directly link spatially non-adjacent atoms with similar structural roles (such as those located at similar pharmacophore centers), thus breaking through the technical bottleneck of traditional methods being limited by local receptive fields. This allows the model to quickly lock onto and generalize general structural patterns with very few samples, rather than merely memorizing local atomic features.
[0065] S2: Prototype-aware pre-training of orbit prior constraints: The graph encoder is pre-trained based on the dual-view training data, and learnable global prototype parameters are introduced; the graph-level representations of the original view and the orbit-enhanced view are respectively calculated on the global prototype, and consistency constraints are applied to the allocation probability distributions of the two views to obtain the pre-trained graph encoder.
[0066] The prototype-aware pre-training of the orbital prior constraints mentioned in step S2, as shown in Figure 4, specifically involves using an asymmetric contrastive learning architecture as the base model, including parameters... The online network (by encoder) Predictor Composition) and parameters are The target network (by the encoder) (Composition). Both the online encoder and the target encoder use a 3-layer graph neural network (such as GIN) as the base encoder. The parameters of the target encoder are evolved using the exponential moving average (EMA) of the online encoder parameters to maintain the stability of structural feature extraction during training.
[0067] ;
[0068] in, This is the momentum update coefficient.
[0069] During training, for an input batch B of the original view and its corresponding enhanced orbital view Perform bidirectional prediction to calculate the symmetric consistency loss: First, transform the molecular graph from the original view... The molecular prediction vector is obtained by inputting into the online network. This will enhance the track map in the view. Inputting the target network yields the target molecule representation vector. Simultaneously, swap view inputs to obtain the track diagram. Inputting the data into an online network yields the predicted vector. Molecular diagram Input the target network to obtain the target vector Comparative losses Defined as the sum of negative cosine similarities in bidirectional predictions, it aims to narrow the representational distance of the same molecule under different views (original view vs. orbital-enhanced view), ensuring the robustness of molecular representation vectors to structural perturbations.
[0070] ;
[0071] To constrain global chemical semantic consistency, a set of learnable global prototypes is introduced. (Representing the centers of K representative structural clusters in the latent feature space), as shown in Figure 4(A). Calculate the original view-level representation vector. Assignment probability to the kth structural prototype for:
[0072] ;
[0073] in, Representing the j-th global prototype vector, the graph-level representation vector is calculated. The similarity between the sample and each prototype vector characterizes the degree of matching between the sample and different structural semantic clusters; by traversing all... The K allocation probabilities calculated above together constitute the allocation probability distribution under the original view. Similarly, the enhanced track view can be obtained. Distribution probability distribution As shown in Figure 4(B); Prototype consistency loss Defined as the symmetric KL divergence between two bidirectional distributions:
[0074] ;
[0075] in, The gradient stopping operation is used to prevent model collapse; KL represents the Kullback-Leibler divergence, which measures the degree of difference between two probability distributions, and is achieved by minimizing the prototype consistency loss. This ensures that the graph-level representations of the same sample obtained under different structural views are consistently distributed in the global prototype space, thereby achieving cross-view semantic alignment, enhancing the model's robustness to structural perturbations, and improving the stability and transferability of structural semantic clustering during the pre-training stage; the final total pre-training loss is:
[0076] ;
[0077] in, These are the weighting coefficients for the loss term, used to balance the prototype consistency loss. Compared with loss The relative contribution of the learnable global prototype to the total pre-training loss; in addition, the learnable global prototype is updated using a momentum-based evolutionary strategy, which uses the mean of the molecular representations assigned to a specific prototype within the current batch to perform an exponential moving average update on the prototype vector, so that it dynamically adapts to the changing feature space:
[0078] ;
[0079] in To update the momentum coefficient; Within each training batch, the batch aggregate representation corresponding to the k-th prototype is calculated.
[0080] The prototype-aware pre-training of orbital prior constraints described in step S2 not only successfully trained a feature extractor with strong robustness to graph structure perturbations through an asymmetric momentum contrastive learning architecture, but its more profound key technological contribution lies in constructing a bridge connecting the chemical bond connections between atoms with the roles of higher-order orbital structures. Specifically, by introducing dynamically updated learnable global prototypes, this invention creatively implements a cross-view semantic alignment mechanism during the pre-training stage: this mechanism mandates that the original view (explicit chemical bond information) and the orbital-enhanced view (implicit structural role information) of the same molecule, although exhibiting drastically different forms in the input space, must be mapped to the same cluster of structural prototypes and their distribution in the latent feature space. This process effectively encodes general chemical structure-activity relationships into the weight parameters of the neural network, thereby forming a solid foundation of structural prior knowledge. When the model is transferred to a classification task with very little labeled data, this internalized prior knowledge can serve as a powerful inductive bias, allowing the model to explore the feature space from scratch without having to do so. This effectively overcomes the feature sparsity problem in low-sample scenarios and significantly suppresses overfitting caused by data scarcity, greatly improving the model's generalization boundary and transfer efficiency across different biochemical tasks.
[0081] S3: Orbit Anchor Representation Construction: For each category of the downstream few-sample task, obtain M training samples of that category, and construct the corresponding downstream orbit augmentation view for the training samples; use the pre-trained graph encoder obtained in step S2 to extract the graph-level representation vector of the training samples of that category, and perform mean aggregation on the graph-level representation vectors of the same category to obtain the orbit anchor representation of that category.
[0082] The orbital anchor representation construction described in step S3, as shown in Figure 5(A), specifically involves using the general structural knowledge captured during the pre-training phase to provide a high-quality initialization starting point for downstream few-shot tasks. Given a downstream training dataset containing C categories... For each category of downstream few-sample tasks (Mutogenic / Non-mutogenic, Anti-cancer screening activity / Inactive, Benzodiazepine receptor activity / Inactive, COX-2 inhibitor activity / Inactive), obtain the training set data for this category. And construct a downstream track augmentation view based on the training data. Utilize the pre-trained graph encoder obtained in step S2. Extract the track map from the downstream track augmentation view The graph-level representation vector is obtained, and the representation vectors of all orbit graphs under the same category are aggregated by mean to obtain the orbit anchor representation. The calculation formula is as follows:
[0083] ;
[0084] in, The same global pooling operator as in the pre-training phase is used.
[0085] The core value of step S3 lies in establishing a high-quality "structural prior anchor" for downstream tasks, thereby solving the optimization divergence problem caused by random initialization parameters in few-shot learning. Specifically, this step acts as a semantic adapter connecting the general pre-trained model and the specific domain task; it not only concretizes the general topological knowledge learned in stage S2 (such as the widely existing pharmacophore pattern) into the category feature center of the current specific task (such as mutagenicity classification) through feature extraction; more importantly, by aggregating the mean of the orbital augmentation view representations of supporting data under the same category, this step effectively smooths and suppresses the individual structural noise (such as the interference of inactive side chains) that is common in few-shot data, and extracts the most essential topological commonality of the category. This mechanism defines a precise and compact parameter search range for the subsequent prompting fine-tuning process in step S4, avoiding the model blindly exploring in a huge feature space; therefore, it is the key initialization step that enables the present invention to achieve rapid model convergence and significantly improve prediction accuracy even in the harsh scenario with only a few samples.
[0086] S4: Graph cue vector generation based on track anchor representation: Using the track anchor representation obtained in step S3 as a reference, a cue distribution is constructed through a learnable parameterized mapping; and a graph cue vector is obtained from the cue distribution;
[0087] The graph cue vector generation based on track anchor representation described in step S4, as shown in Figure 5(B), specifically involves: existing downstream cue vectors are mostly modeled as single deterministic vectors and initialized randomly, making it difficult to adapt to complex task distributions. This invention proposes a graph cue vector generation mechanism based on track anchor representation. First, based on the track anchor representation, a learnable scaling factor is introduced. and bias vector Construct the residual mean, and perform affine transformation and correction on the orbital anchor representation obtained in step S3:
[0088] ;
[0089] Next, in order to flexibly compensate for semantic biases specific to downstream tasks and improve the model's robustness to limited sample data, this embodiment abandons the traditional fixed vector hint strategy and instead adopts probability distribution modeling, introducing a learnable log-variance parameter to obtain the variance vector. Specifically, the c-th category c-th ... To achieve differentiable sampling, a learnable log-variance parameter is introduced. The cue component is obtained by sampling from the Gaussian distribution using the reparameterization technique. :
[0090] ;
[0091] At the same time, a distribution difference constraint term is introduced:
[0092] ;
[0093] in, The model follows a standard normal distribution; KL represents the Kullback-Leibler divergence, which constrains the latent variable distribution learned by the model to approximate a standard normal distribution, thereby achieving regularization, stabilizing training, and ensuring the controllability of the latent space structure. Finally, to generate a final cue that integrates information from multiple categories, let the mixture weight vector be... Normalized weights are obtained using the Gumbel-Softmax sampling technique, and the final graph cue vector is generated through weighted mixing. :
[0094] .
[0095] The fundamental significance of step S4 lies in overcoming the inherent limitations of traditional graph cue learning, which relies solely on "static, deterministic" representations, and solving the technical challenge of fixed vectors failing to fully express intra-class diversity. By constructing a differentiable residual Gaussian mixture distribution, this invention essentially endows graph cue vectors with the ability to model multimodal distributions in the feature space and to dynamically tolerate structural perturbations. This mechanism, by introducing learnable distribution parameters, enables the model to effectively inherit the general structural priors acquired in the upstream pre-training stage, while also flexibly covering complex intra-class semantic changes in downstream tasks through probabilistic sampling. This not only prevents the model from getting trapped in local optima during fine-tuning with few samples but also provides an uncertainty-aware buffer zone at the classification decision boundary, which is the core technical guarantee that the model can maintain high robustness and high accuracy even in scenarios with extremely scarce data.
[0096] S5: Graph-level representation generation and classification guided by graph cue vectors: Keep the parameters of the pre-trained graph encoder frozen, use the graph cue vectors as attention guides, aggregate node-level representation vectors to obtain graph-level representation vectors; and update the learnable parameters in the graph cue vectors by minimizing the objective function containing classification loss and regularization constraints, and use the updated graph cue vectors to guide the generation of graph-level representation vectors to complete the classification.
[0097] The graph-level representation generation and classification guided by graph cue vectors in step S5, as shown in Figure 5(C), specifically involves: using the generated graph cue vectors... As an attention-guided approach, atomic-level representations within molecules are aggregated into graph-level representations. Specifically, a representation vector for each node (i.e., an atom) is calculated using a formula. With diagram hint vector Match score between:
[0098] ;
[0099] The node weights are obtained in an exponentially normalized form. :
[0100] ;
[0101] in, Represents node u and graph hint vector The matching score satisfies And based on this, the graph-level representation vector is obtained:
[0102] ;
[0103] After obtaining the graph-level representation vector, it is input into the classifier for property prediction; to prevent overfitting and distribution collapse under conditions of few samples, a method incorporating classification cross-entropy loss is constructed. Distribution difference constraint term The overall objective function; where the distribution difference constraint term... This is used to constrain the sampling distribution to approximate a standard normal distribution, in order to maintain the compactness of the representation vector and avoid parameter divergence due to a few extreme cases; ultimately, the overall training objective function of the downstream model is... for:
[0104] ;
[0105] in, To balance hyperparameters; during the parameter update phase, maintain the pre-trained graphical encoder. The parameters are frozen, and only the learnable parameters related to the generation of the graph hint vector and classification prediction are updated.
[0106] The core value of step S5 lies in constructing a closed-loop execution system of "task-oriented dynamic feature aggregation" and "parameter-efficient robust inference". Specifically, this step abandons the global average pooling strategy that treats all nodes indiscriminately in traditional graph classification, and uses the graph cue vector generated in S4 as an attention query. This mechanism gives the model the ability to perform semantic focusing in the molecular graph, enabling it to accurately locate and activate key substructures (such as specific pharmacophores or toxic functional groups) with high weights according to the specific biochemical properties required by the current task, while suppressing noise interference from irrelevant skeletons, thereby achieving a refined reconstruction from general pre-trained features to task-specific semantic features.
[0107] Meanwhile, at the parameter optimization level, this step adopts the "graph pre-training - downstream hints" parameter efficiency update paradigm, and introduces a distribution difference constraint term on this basis. This dual defense mechanism not only effectively avoids the catastrophic forgetting problem common in few-shot learning with extremely low parameter update cost, but also imposes topological constraints on the distribution pattern of the feature space, preventing distribution collapse caused by individual extreme samples. This is the decisive technical feature of this invention to achieve high-precision and high-robust adaptation for specific tasks while ensuring the generalization boundary of the model.
[0108] Example 1: Prediction of Molecular Drug Properties
[0109] Background: Drug molecules have highly complex internal spatial structures, making it difficult to accurately predict their properties using traditional computational methods. This embodiment utilizes a graph classification model to identify drug molecules, directly predicting whether a molecule possesses biological activity or toxicity risks, thus providing reliable data support for new drug development and candidate drug screening.
[0110] Track Enhancement View Construction:
[0111] Input: Compound molecular structure diagram and molecular feature data (atom corresponding node, chemical bond corresponding edge).
[0112] Output: An orbital augmentation view (orbit graph) that explicitly includes higher-order topological semantics.
[0113] Steps: Calculate the orbital role of each atom in the molecule in 2-5 node primitives, calculate the orbital correlation matrix, and perform random walks to obtain orbital embeddings containing rich high-order structural information.
[0114] Prototype perception pre-training for trajectory prior constraints:
[0115] Mechanism: An asymmetric contrastive learning architecture is used as the basic model, and a learnable global prototype is introduced.
[0116] Objective: To narrow the semantic distance between the original view and the orbital-enhanced view on large-scale unlabeled molecular data, capture common chemical structure-activity relationships and pharmacophore patterns, and obtain a pre-trained graph encoder for generating molecular characterization vectors.
[0117] Orbital anchor characterization construction:
[0118] Process: For specific downstream property prediction tasks (such as COX-2 inhibitor screening or mutagenicity classification), a small amount of training data with known labels is obtained, a downstream orbital augmentation view containing high-order topological semantics is constructed, and finally the orbital anchor representation is obtained.
[0119] Function: The pre-trained encoder extracts the track graph representation and performs mean aggregation to obtain the track anchor representation, providing a high-quality "semantic anchor" for subsequent prompt generation.
[0120] Graph cue vector generation based on orbital anchor representation:
[0121] Distribution modeling: Based on the orbital anchor representation, a learnable scaling factor and bias are introduced to construct the residual mean and establish a mixture Gaussian distribution model.
[0122] Sampling generation: Diverse cue components are sampled from the distribution using reparameterization techniques and weighted to generate the final graph cue vector to cover complex intra-class structural differences.
[0123] Graph-level representation generation and classification guided by graph hint vectors:
[0124] Attention aggregation: Using the generated graph cue vector as an attention query, the atomic features within the molecule are weighted and aggregated to accurately locate the key substructures (such as active functional groups) that determine the properties of the molecule.
[0125] Model training: Construct an objective function that includes classification cross-entropy loss and prototype consistency loss, and fine-tune only the relevant parameters while freezing the pre-trained backbone.
[0126] Property prediction (graphical classification):
[0127] Inference: Newly input candidate drug molecules are encoded, and molecular characterization vectors are generated under the guidance of optimized graph cue vectors. The classifier outputs prediction results, such as determining whether the molecule is mutagenic or has specific target binding ability.
[0128] Based on the process of Embodiment 1 above, to verify the effectiveness of the present invention in practical applications, the experimental data used were general benchmark datasets in the field of molecular property prediction, specifically including: MUTAG (molecular mutagenicity prediction), BZR (benzodiazepine receptor ligand screening), NCI1 (anticancer active compound screening), and COX2 (cyclooxygenase-2 inhibitor activity prediction); among which, the orbital augmentation view data was constructed based on primitive orbital statistics of 2 to 5 nodes. In downstream evaluation, a 5-shot few-sample setup was adopted: for each category of each dataset, 5 samples were randomly selected from its labeled samples to form a training set for model training, and the remaining samples formed a test set; to reduce the variance caused by random partitioning, the same sampling strategy was used to conduct 5 repeated experiments, and the prediction accuracy was averaged. The training process of this invention is strictly divided into two stages, with the specific optimization strategies as follows: The first stage is a prototype-aware pre-training stage with orbital prior constraints. This stage aims to obtain a pre-trained graph encoder for generating graph-level representation vectors. The optimizer uses the Adam algorithm, with an initial learning rate set to 0.001 and a batch size of 32. In this stage, the model uses contrastive loss and prototype consistency loss to iteratively update on massive amounts of unlabeled raw molecular data until the loss function converges, thereby capturing general chemical structure patterns and high-order topological semantic consistency. The second stage is a residual Gaussian mixture hint fine-tuning stage. This stage aims to adapt to downstream few-shot graph classification tasks. The optimizer also uses the Adam algorithm, but to adapt to the fast convergence and anti-overfitting requirements in few-shot scenarios, the learning rate is adjusted to 0.005 and the batch size is set to 32. In this stage, the pre-trained graph encoder parameters are frozen, and only the learnable parameters related to graph hint vector generation and classification prediction are updated to achieve rapid adaptation to the data distribution of specific prediction tasks.
[0129] Accordingly, based on the above settings, under the 5-shot few-sample experimental setting, the present invention was compared with mainstream methods such as GCN, GraphCL and GPF on four standard graph classification benchmark datasets in the fields of biochemistry / medicine, such as COX2 and BZR. As shown in Figure 6, the data marked in red in the figure are the best results and the data marked in blue are the second best results. The experimental results show that the present invention (DGA-MGPL) achieved the best prediction accuracy on all test datasets. Specifically, this invention demonstrates superior structure capture capabilities on these datasets, particularly on the COX2 dataset, where it achieves an accuracy of 68.52%, a significant improvement of nearly 8 percentage points compared to the second-best method (All-in-one). On the BZR dataset, the average accuracy reaches 68.08%, an improvement of approximately 5% compared to the second-best method (HeterGP). This significant advantage indicates that the model can effectively identify the key pharmacophore structures and structure-activity relationships that determine drug-receptor binding. It also exhibits robustness in complex topological pattern recognition, achieving accuracies of 74.57% and 62.34% on the MUTAG and NCI1 datasets, respectively. This strongly demonstrates that orbital enhancement views based on primitive orbits can effectively capture complex topological patterns that determine the physicochemical properties of molecules. In summary, this invention achieves optimal or leading prediction accuracies on all four standard molecular graph classification benchmark datasets, indicating that the proposed method has consistent and stable performance advantages in few-sample graph classification scenarios. The fundamental reason lies in the following: This invention explicitly introduces high-order topological semantics through a primitive-based orbital augmentation view, enabling the pre-training stage to learn and solidify shared structural priors across samples. In the downstream stage, using the class orbital prior mean as an anchor point, and combining residual Gaussian mixture hints, the priors are adaptively corrected, thus achieving efficient and stable task adaptation while freezing the main parameters of the pre-trained graph encoder. Furthermore, the hint-guided attention aggregation mechanism allows the model to highlight key substructures related to property discrimination and suppress noise structural interference. Combined with the joint optimization of classification loss and regularization constraints, the model maintains a low standard deviation while improving prediction accuracy. This fully verifies that this invention can not only effectively capture complex topological patterns such as pharmacophore structures and structure-activity relationships, but also exhibits good robustness and stability when facing few samples and experimental noise, making it suitable for practical applications in biochemistry / pharmaceutical fields such as molecular property prediction.
[0130] The technical means disclosed in this invention are not limited to those disclosed in the above embodiments, but also include technical solutions composed of any combination of the above technical features. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this invention, and these improvements and modifications are also considered within the scope of protection of this invention.
Claims
1. A few-sample image classification method based on orbit enhancement and residual cues, characterized in that, The graph classification method described above is designed for molecular graph data of compound molecules. Each graph in the molecular graph data represents a compound molecule. The nodes in the graph correspond to atoms in the molecule, and the edges correspond to chemical bonds in the molecule. The initial features of the nodes include physicochemical properties such as atomic number, chirality, and hybridization type. Includes the following steps: S1: Construction of orbital augmentation view: Perform orbital statistics on primitives with 2-5 nodes in the molecular graph data to characterize the node structure role, generate an orbital counting matrix and normalize it; calculate the orbital correlation matrix based on the normalized orbital counting matrix, and use the orbital correlation matrix as the adjacency relationship of the orbital topology space, and obtain the orbital augmentation view through random walk. The molecular map data is used as the original view, and the original view and the orbital enhancement view constitute dual-view training data. S2: Prototype-aware pre-training of track prior constraints: The graph encoder is pre-trained based on the dual-view training data, and learnable global prototype parameters are introduced. Calculate the allocation probability distribution of the graph-level representations of the original view and the orbit-enhanced view on the global prototype, and apply a consistency constraint to the allocation probability distributions of the two views to obtain a pre-trained graph encoder; S3: Orbit anchor representation construction: For each category of the downstream few-shot task, obtain M training samples of that category, and construct the corresponding downstream orbit-enhanced view for the training samples. The pre-trained graph encoder obtained in step S2 is used to extract the graph-level representation vector of the training samples of this category, and the graph-level representation vectors of the same category are aggregated by mean to obtain the orbital anchor representation of this category. S4: Graph cue vector generation based on orbital anchor representation: Using the orbital anchor representation obtained in step S3 as a reference, a cue distribution is constructed through a learnable parameterized mapping; and a graph cue vector is obtained from the cue distribution; S5: Graph-level representation generation and classification guided by graph cue vector: Keeping the parameters of the pre-trained graph encoder frozen, the graph cue vector is used as attention guide to aggregate node-level representation vectors to obtain a graph-level representation vector; and by minimizing the learnable parameters in the graph cue vector by minimizing the objective function containing classification loss and regularization constraints, the graph-level representation vector generated is guided by the updated graph cue vector to output the classification result of the compound molecule; The construction of the track enhancement view in step S1 includes: using the original view The occurrence frequency of each node on 73 types of tracks corresponding to primitives of 2-5 predefined nodes is counted to generate a track counting matrix, and the track counting matrix is then normalized to obtain a normalized matrix. The primitives of the 2-5 nodes cover chemical patterns ranging from chemical bonds to ring systems and functional group skeletons, and the orbitals can distinguish the different topological roles of atoms in chemical molecular structures; the orbital correlation matrix is calculated based on the normalized matrix. The orbital correlation matrix is used to characterize the higher-order co-occurrence relationships between different primitive orbits; and a random walk is performed on the topological space defined by the orbital correlation matrix to generate the orbital augmentation view. The generation of the graph cue vector in step S4 includes: for category c, representing its orbital anchor. A sampling distribution for generating graph cue vectors is constructed based on this distribution; the center parameters of the sampling distribution are obtained through the following affine residual transformation: ;in For learnable scaling factors, The bias vector is a learnable vector; and a learnable log-variance parameter is introduced to obtain the variance vector. Construct constraints on the differences in the prompt distribution. The constraints are then incorporated into the training objective function: ;in, The model represents a standard normal distribution; KL represents the Kullback-Leibler divergence, constraining the latent variable distribution learned by the model to approximate a standard normal distribution; based on the central parameters and variance vector, a differentiable sampling mapping is used to obtain the corresponding category. Hint component vector Generate learnable hybrid weight vectors The cue component vectors are then weighted and fused according to the mixing weights to obtain the graph cue vector for that category. 。 2. The few-sample map classification method based on orbit enhancement and residual cues according to claim 1, characterized in that, The learnable global prototype set mentioned in step S2 K represents the global prototype set. The number of prototype vectors, i.e., the number of prototypes; This represents the k-th prototype vector. Update according to the following formula: ;in To update the momentum coefficient; Within each training batch, the batch aggregate representation corresponding to the k-th prototype is calculated.
3. The few-sample map classification method based on orbit enhancement and residual cues according to claim 2, characterized in that, Step S2, the prototype perception pre-training of the orbital prior constraints, includes: constructing an asymmetric contrastive learning architecture, wherein the online network is composed of an online encoder. With predictor The target network consists of a target encoder. Composition; Initialization of online encoder parameters With target encoder parameters and with momentum coefficient The target encoder parameters are updated according to the following formula: The original view and track-enhanced view of the same sample in batch B are obtained through the global readout operator. Graph-level representations were obtained respectively. and Based on the graph-level representation and the learnable global prototype set The similarity between prototype vectors in the original view is used to calculate the original view graph-level representation vector. Assignment probability to the kth structural prototype for: ;in, Representing the j-th global prototype vector, the graph-level representation vector is calculated. The similarity between the sample and each prototype vector characterizes the degree of matching between the sample and different structural semantic clusters; by traversing all... The K allocation probabilities calculated above together constitute the allocation probability distribution under the original view. Similarly, the enhanced track view can be obtained. Distribution probability distribution The symmetric KL divergence between the probability assignments of the two views is used as the prototype consistency loss. : ;in This indicates gradient stopping; KL represents the Kullback-Leibler divergence, used to measure the degree of difference between two probability distributions; simultaneously, it obtains the prediction vectors of the online network for the original view and the track-enhanced view. and Calculate the bidirectional prediction negative cosine similarity as the contrast loss. : The negative cosine similarity constraint is applied to the representations of the two views respectively, so that the prediction results in the two directions are aligned simultaneously, thereby establishing a symmetrical and consistent representation space constraint relationship; and the prototype consistency loss and the contrast loss are weighted and summed to form the pre-trained objective function to obtain the pre-trained graph encoder: ;in, These are the weighting coefficients for the loss term, used to balance the prototype consistency loss. Compared with loss The relative contribution of pre-training to the total pre-training loss.
4. The few-sample map classification method based on orbit enhancement and residual cues according to claim 3, characterized in that, The construction of the orbital anchor representation in step S3 includes: the training sample set of the c-th class in the downstream few-shot task. Each training image sample Construct the corresponding downstream track augmentation view according to step S1. Enhance the view of the downstream track. Input pre-trained graph encoder Obtain node-level representations and use global readout operators. Obtain the graph-level representation vector; aggregate the mean of all graph-level representation vectors for the c-th category to obtain the orbital anchor representation for that category. It satisfies: ;in, This represents the number of samples in the training sample set for the c-th category.
5. A few-sample map classification method based on orbit enhancement and residual cues according to claim 4, characterized in that, In step S5, the graph cue vector generated in step S4 is used as attention guide to perform weighted aggregation of node-level representation vectors: for graph samples Node set Let the node-level representation vector be... The graph hint vector obtained using step S4 is Then calculate each node The relevance score is the dot product of the node representation and the graph cue vector: The node weights are obtained using exponential normalization. : ;in, Represents node u and graph hint vector The matching score satisfies And based on this, the graph-level representation vector is obtained: 。 6. A few-sample map classification method based on orbit enhancement and residual cues according to claim 5, characterized in that, The overall training objective function of the downstream model in step S5 for: ;in, Cross-entropy loss is used to supervise classification accuracy; distribution difference constraint term. The difference between the sampling distribution used to generate the graph cue vector in step S4 and the preset prior distribution is used to constrain the difference between the two, with weighted coefficients. The total objective function is obtained by performing a weighted summation. During the optimization process, the parameters of the pre-trained graph encoder are kept frozen, and only the learnable parameters related to graph cue vector generation and classification prediction are updated.
Citation Information
Patent Citations
Graph model fine tuning method based on graph prompt learning
CN121145986A
Privacy perception graph prompt learning method based on adaptive topology recovery
CN121351929A