Molecular graph-oriented primitive-level representation learning method and system

By combining the graph diffusion model and the Barlow twin dual-view contrast loss function, the problem of the disconnect between local neighborhood and global semantics in existing molecular graph representation learning is solved, and the semantic completeness and cross-task generalization ability of primitive-level representation are improved.

CN121122502AActive Publication Date: 2025-12-12TSINGHUA UNIVERSITY

Patent Information

Application Number
CN202511202364.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-26
Publication Date
2025-12-12
Estimated Expiration
2045-08-26

AI Technical Summary

Technical Problem

Existing molecular graph representation learning methods only focus on atomic-level local neighborhoods and cannot model higher-order functional substructures, resulting in a disconnect between local atomic information and global functional semantics. Furthermore, graph contrastive learning relies on random perturbations, leading to features lacking practical biological activity significance and having weak cross-task generalization ability.

Method used

The original molecular graph is noise-added and reconstructed using a graph diffusion model, dividing it into primitive subgraphs. Atomic views and primitive views are constructed, encoded using a graph neural network encoder, and the embedding matrix is ​​optimized using a Barlow twin dual-view contrastive loss function to achieve cross-granularity representation alignment.

Benefits of technology

It improves the semantic completeness and task generalization ability of molecular representation, and significantly enhances the model's understanding and prediction performance of complex molecular structures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121122502A_ABST
    Figure CN121122502A_ABST
Patent Text Reader

Abstract

The invention provides a molecular-graph-oriented primitive-level representation learning method and system, and the method comprises the steps: carrying out the noise addition and reconstruction of an original molecular graph based on a graph diffusion model, calculating an edge reconstruction error, and dividing the original molecular graph into a plurality of primitive sub-graphs according to the edge reconstruction error; constructing an atomic view and a primitive view, and encoding the atomic view and the primitive view by using a graph neural network encoder to obtain an atomic embedding matrix and a primitive embedding matrix; and constructing a positive and negative sample pair based on the atomic view and the primitive view, and optimizing an atomic embedding matrix and a primitive embedding matrix by adopting a Babontwin double-view contrast loss function to realize cross-granularity expression alignment. According to the method, molecular primitives are extracted in a self-supervised mode through the diffusion model, systematic defects of a traditional method in the aspects of cross-granularity structure modeling, semantic guidance contrast learning and multi-level expression fusion are overcome through atom-primitive double-view alignment, and the semantic completeness and task generalization ability of molecular expression are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of artificial intelligence and computer science technology, and in particular to a primitive level representation learning method and system for molecular graph. BACKGROUND

[0002] In the field of artificial intelligence assisted drug design, material screening and molecular property prediction, molecular graph representation learning has become one of the hot directions of current research and industrial practice. This technology is usually based on the graph representation of molecular structure, taking atoms as nodes and chemical bonds as edges, using graph neural network (GNN) to encode the graph structure, thereby providing structural feature representation for downstream tasks (such as toxicity prediction, blood-brain barrier penetration prediction, etc.).

[0003] Current mainstream molecular graph representation learning methods mainly rely on atom-level graph convolution models such as GCN (Graph Convolutional Network), GIN (Graph Isomorphism Network) and MPNN (Message Passing Neural Network). These methods achieve information propagation through recursive aggregation of atomic adjacency structure and have achieved good results on multiple datasets.

[0004] However, traditional molecular graph representation learning methods (such as GCN / GIN) only focus on local neighborhoods at the atomic level and cannot model higher-order functional substructures (such as benzene rings, carboxyl groups, etc.). This results in a disconnection between local atomic information and global functional semantics, making it difficult for the model to understand the chemical groups that determine molecular properties. Moreover, mainstream graph contrast learning (such as GraphCL) relies on random graph perturbations (such as random edge / node deletion), which results in generated contrast views that violate the chemical structure rationality, learned features that lack actual biological activity significance, and weak cross-task generalization ability. Existing methods (such as DiffPool) do not establish an explicit mapping between atoms and primitives, resulting in isolated atomic and primitive level representations, scattered training objectives (such as independent optimization of different granularity losses), and unstable downstream task performance. SUMMARY

[0005] The present application provides a primitive level representation learning method and system for molecular graph, which solves the defects of disconnection between local atomic information and global functional semantics and difficulty for the model to understand the chemical groups that determine molecular properties caused by focusing only on local neighborhoods at the atomic level and being unable to model higher-order functional substructures in the prior art, thereby improving the semantic completeness of molecular representation and task generalization ability.

[0006] The present application provides a primitive level representation learning method for molecular graph, comprising the following steps: adding noise to the original molecular graph based on a graph diffusion model and reconstructing the original molecular graph, calculating an edge reconstruction error, and dividing the original molecular graph into a plurality of primitive subgraphs according to the edge reconstruction error to form a primitive subgraph set; Based on the original molecular graph and the primitive subgraph set, an atomic view and a primitive view are respectively constructed, and a graph neural network encoder is used to encode the atomic view and the primitive view respectively to obtain an atomic embedding matrix and a primitive embedding matrix; Based on the atomic view and the primitive view, a positive and negative sample pair is constructed, and a Balol twin double-view contrast loss function is used to optimize the atomic embedding matrix and the primitive embedding matrix to realize cross-granularity representation alignment.

[0007] According to the primitive level representation learning method for molecular graph provided by the application, the original molecular graph is added noise and reconstructed based on a graph diffusion model, the edge reconstruction error is calculated, and the original molecular graph is divided into a plurality of primitive subgraphs according to the edge reconstruction error, which specifically includes: The original molecular graph is forwardly added noise and reversely reconstructed by the pre-trained graph diffusion model, and the reconstruction error of each edge is calculated , an edge reconstruction error matrix is constructed , wherein The edge reconstruction error matrix E is converted into an edge weight matrix , and the conversion formula is: , , wherein is a temperature hyperparameter; Based on the edge weight matrix , the original molecular graph is divided into a plurality of connected subgraphs using a spectral clustering algorithm; For each clustering cluster, check whether the induced subgraph is connected, if there are multiple connected components, each connected component is regarded as an independent primitive; Finally, a primitive set is obtained, wherein each atomic node is uniquely attributed to a primitive.

[0008] According to the primitive level representation learning method for molecular graph provided by the application, the graph diffusion model is trained by minimizing a diffusion reconstruction loss function, and the construction process of the diffusion reconstruction loss function specifically includes: The original molecular graph is forwardly added noise, and the adjacency matrix is iteratively disturbed according to a noise scheduling coefficient , and the adjacency matrix of the first step is represented as: ; wherein, , denotes a time step, is an adjacency matrix in the original graph, is an adjacency matrix after adding noise; is a node feature matrix, used to represent atomic attribute encoding, is Gaussian noise, is a noise scheduling coefficient, and the calculation formula is: , wherein, , denote the minimum noise amount introduced at the early time step and the maximum noise amount introduced at the last time step ; through a graph neural network encoder and a multi-layer perceptron encoder to predict the step noise term , and reconstruct the adjacency matrix: , wherein, is the reconstructed adjacency matrix, , the calculation formula is: ; ; The diffusion reconstruction loss function is defined as: .

[0009] According to the method provided by the application, the atomic view and the motif view are encoded by using a graph neural network encoder, and the method specifically comprises the following steps: using a graph neural network encoder to perform information propagation on the atomic view, and the node update formula is: ; wherein, is the output feature vector of the node at the layer, denotes the index of the current layer, , is the total number of layers of the network, denotes the neighbor nodes of the node , denotes the neighbor nodes In the first characteristic vector of the layer, represents a nonlinear activation function, represents the trainable weight matrix of the layer, represents the trainable bias vector of the layer, represents the set of neighbor nodes of node ; randomly pruning the weight matrix on the graph neural network encoder to generate the pruned weight matrix : , wherein is a mask matrix with a retention probability ; encoding the primitive view using the pruned graph neural network encoder to obtain the feature representation of the nodes in the primitive view, and the node update formula is: , wherein represents the feature of the layer node calculated using the pruned weight matrix, represents the feature of the layer neighbor node calculated using the pruned weight matrix, i.e., the approximate representation under the sparsification constraint; respectively performing graph-level pooling on the atomic view and the primitive view updated by the nodes to obtain the atomic embedding matrix and the primitive embedding matrix : ; , wherein is the set of all atomic nodes in the original molecular graph updated by the nodes, is an atomic node in the set , is the final layer output characteristic vector of the atomic node , is the set of all primitive nodes in the primitive view updated by the nodes, is a primitive node in the set , represents the final layer output characteristic vector of the node .

[0010] According to the primitive-level representation learning method for molecular graphs provided by this invention, the graph neural network encoder is a graph isomorphic network, and the node update formula is: , in, This represents a multilayer perceptron. Indicates learnable parameters, For nodes In the The output feature vector of the layer, Indicates the index of the current layer. , It is the total number of network layers. Represents a node The neighboring nodes, Representing neighboring nodes In the The feature vector of the layer, Represents a node The set of neighboring nodes.

[0011] According to the molecular graph-oriented primitive-level representation learning method provided by the present invention, the construction of positive and negative sample pairs based on atomic views and primitive views specifically includes: For each atomic node Select the atomic node Belonging to the primitive Constitute positive samples ; Randomly select nodes from other atomic nodes. , Constructing negative sample pairs ; Randomly select primitive nodes from other primitives. , constitute negative sample pairs .

[0012] According to the molecular graph-oriented primitive-level representation learning method provided by the present invention, the Barlow twin dual-view contrast loss function is specifically as follows: , in, This represents the total two-scale contrast loss. For the contrast loss of atomic views, For the contrast loss of the primitive view, As a weighting factor, , The calculation formula is: ; , in, denotes the dimension of the embedding vector, is the cross-batch correlation matrix of the atom view denotes the element on the diagonal, which represents the correlation of the i-th dimension feature with itself across different samples in the atom view, denotes the element on the diagonal, which represents the correlation of the i-th dimension feature with itself across different samples in the atom view, is the cross-batch correlation matrix of the atom view denotes the element on the diagonal, which represents the correlation of the i-th dimension feature with itself across different samples in the atom view, denotes the element on the diagonal, which represents the correlation of the i-th dimension feature with itself across different samples in the atom view, denotes the element on the diagonal, which represents the correlation of the i-th dimension feature with itself across different samples in the atom view, is the cross-batch correlation matrix of the atom view denotes the element on the diagonal, which represents the correlation of the i-th dimension feature with itself across different samples in the atom view, denotes the element on the diagonal, which represents the correlation of the i-th dimension feature with itself across different samples in the atom view, is the cross-batch correlation matrix of the atom view denotes the element on the diagonal, which represents the correlation of the i-th dimension feature with itself across different samples in the atom view, denotes the element on the diagonal, which represents the correlation of the i-th dimension feature with itself across different samples in the atom view, denotes the element on the diagonal, which represents the correlation of the i-th dimension feature with itself across different samples in the atom view.

[0013] According to the present application, a molecule graph-oriented primitive level representation learning method is provided, 、 、 、 is obtained by the following formula: ; ; ; ; ; ; wherein, 、 respectively represent the cross-batch correlation matrix of the atom view and the primitive view, denotes the atom embedding matrix the i-th feature vector, denotes the mean of denotes the standard deviation of denotes the number of molecule graphs in the batch, denotes the primitive embedding matrix the i-th feature vector, denotes the mean of denotes the standard deviation of denotes the number of molecule graphs in the batch, denotes the primitive embedding matrix the i-th feature vector, denotes the mean of denotes the standard deviation of a standard deviation of the batch, denotes the number of element sets in the batch, , denote the normalized atomic embedding matrix and the element embedding matrix, respectively, is a tiny constant to prevent the denominator from being zero.

[0014] The application further provides a molecular graph-oriented element-level representation learning system, comprising the following modules: a diffusion starting module: configured to add noise to and reconstruct an original molecular graph based on a graph diffusion model, calculate an edge reconstruction error, and divide the original molecular graph into a plurality of element subgraphs according to the edge reconstruction error to form an element subgraph set; a double-scale coding module: configured to construct an atomic view and an element view based on the original molecular graph and the element subgraph set, respectively, and use a graph neural network encoder to code the atomic view and the element view to obtain an atomic embedding matrix and an element embedding matrix; a double-view comparison module: configured to construct positive and negative sample pairs based on the atomic view and the element view, and use a Balol twin double-view comparison loss function to optimize the atomic embedding matrix and the element embedding matrix to realize cross-granularity representation alignment.

[0015] The application further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the molecular graph-oriented element-level representation learning method according to any one of the above when executing the computer program.

[0016] The application further provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program is executable on a processor to implement the molecular graph-oriented element-level representation learning method according to any one of the above.

[0017] The application further provides a computer program product comprising a computer program, wherein the computer program is executable on a processor to implement the molecular graph-oriented element-level representation learning method according to any one of the above.

[0018] This invention provides a primitive-level representation learning method and system for molecular graphs. It adds noise and reconstructs the original molecular graph based on a graph diffusion model, calculates the edge reconstruction error, and divides the original molecular graph into multiple primitive subgraphs based on the edge reconstruction error, forming a primitive subgraph set. Based on the original molecular graph and the primitive subgraph set, atomic views and primitive views are constructed respectively, and a graph neural network encoder is used to encode the atomic views and primitive views respectively, obtaining atomic embedding matrices and primitive embedding matrices. Positive and negative sample pairs are constructed based on the atomic views and primitive views, and the Barlow twin dual-view contrastive loss function is used to optimize the atomic embedding matrices and primitive embedding matrices, achieving cross-granularity representation alignment. This invention uses a diffusion model for self-supervised extraction of molecular primitives and atomic-primitive dual-view alignment to solve the systemic defects of traditional methods in cross-granularity structure modeling, semantically guided contrastive learning, and multi-level representation fusion, significantly improving the semantic completeness and task generalization ability of molecular representations. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0020] Figure 1 This is a flowchart illustrating the primitive-level representation learning method for molecular graphs provided by this invention.

[0021] Figure 2 This is the overall framework of the MotiLa model provided by this invention.

[0022] Figure 3 This is an overall flowchart of the primitive-level representation learning method for molecular graphs provided by the present invention.

[0023] Figure 4 This is a schematic diagram of the structure of the molecular graph-oriented primitive-level representation learning system provided by the present invention.

[0024] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0025] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely below in conjunction with the drawings in the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.

[0026] The current mainstream molecular graph representation learning method mainly depends on an atom-level graph convolution model, such as GCN (Graph Convolutional Network), GIN (Graph Isomorphism Network) and MPNN (Message Passing Neural Network). These methods achieve information propagation through recursive aggregation of atomic adjacency structures, and have achieved good results on multiple data sets. However, they generally have the following limitations: 1) Lack of structure abstraction ability: atom-level graph neural networks focus on local neighborhoods and are difficult to capture larger-scale semantic structures, such as "functional substructures" or "motifs" such as benzene rings and ester groups; 2) Limited generalization of contrastive learning: In recent years, graph contrastive learning (GCL) has been widely used for unsupervised graph representation learning. Methods such as GraphCL, JOAO, SimGRACE and InfoGraph perform contrast by constructing different graph views, but are mostly based on random perturbation or graph transformation, lacking modeling of actual semantic substructures in molecules; 3) Structure representation does not have hierarchy: most existing methods are "single-level embedding", which cannot simultaneously consider local chemical properties and macro functional block characteristics of molecular structures, resulting in limited performance of the model in cross-dataset generalization and cross-task migration.

[0027] In addition, the above methods consider local structures to some extent, but either lack the concept of "motif" or do not explicitly align the structure relationships between multi-granularity representation layers, making it difficult to fully model the multi-level semantic features of molecules.

[0028] Therefore, in terms of efficient and generalizable learning of multi-granularity structure representation of molecules, there is still room for further improvement in the existing technology.

[0029] To solve the problems of single structure granularity, poor generalization ability of contrast learning, and lack of multi-level structure alignment mechanism in existing molecular graph representation learning methods, the present application provides a primitive-level representation learning method and system for molecular graphs to realize automatic extraction and coding of significant primitives in molecules and construct explicit structure alignment between atomic and primitive levels, thereby improving the performance stability and cross-structure generalization ability of the model under multi-task.

[0030] The present application will be described in detail below with reference to the accompanying drawings. The specific operation methods in the method embodiment can also be applied to the device embodiment or the system embodiment. In the description of the present application, unless otherwise specified, "at least one" includes one or more. "Multiple" refers to two or more. For example, at least one of A, B and C includes: A alone, B alone, A and B together, A and C together, B and C together, and A, B and C together. In the present application, " / " means or, for example, A / B can mean A or B; "and / or" in this document only describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone.

[0031] In some specific embodiments of the present application, as shown in Figure 1 The present application provides a primitive-level representation learning method for molecular graphs, comprising: Step 100, adding noise to the original molecular graph based on the graph diffusion model and reconstructing, calculating the edge reconstruction error, and dividing the original molecular graph into a plurality of primitive subgraphs according to the edge reconstruction error to form a primitive subgraph set; Step 200, based on the original molecular graph and the primitive subgraph set, respectively constructing an atomic view and a primitive view, and using a graph neural network encoder to encode the atomic view and the primitive view respectively to obtain an atomic embedding matrix and a primitive embedding matrix; Step 300, constructing positive and negative sample pairs based on the atomic view and the primitive view, and using the Baloo twin double-view contrast loss function to optimize the atomic embedding matrix and the primitive embedding matrix to realize cross-granularity representation alignment.

[0032] It should be noted that the existing molecular graph neural network and contrast learning technology cannot effectively utilize the semantic primitives in the molecule, lack a granularity coordination mechanism, and the training target is scattered, which limits its performance in processing complex structures and achieving high-precision generalization prediction tasks. Therefore, there is an urgent need for a molecular graph representation method that simultaneously has primitive extraction capability and multi-granularity alignment mechanism to solve the above core problems.

[0033] Therefore, the application adopts a graph diffusion model noise-reconstruction mechanism to automatically divide the original molecular graph into a set of primitive subgraphs, and obtain diffusion generated primitives; encodes the atom view (original graph) and the primitive view (subgraph set) using a graph neural network respectively, outputs an embedding matrix, realizes double view encoding; establishes the mapping between atoms and their corresponding primitives; constructs sample pairs based on atom / primitive views, optimizes the embedding using Barlow twin loss, and realizes double view contrast learning. Through a primitive perception method for molecular graph representation learning, a double-granularity information fusion mechanism is adopted, the graph diffusion operation is used to realize self-supervised extraction of primitives, and the primitive-atom double view contrast learning goal is combined to realize cross-granularity structure consistency modeling.

[0034] The embodiment of the application extracts primitives automatically through a diffusion model, breaks through the semantic limitations of atom-level graph neural networks, solves the structure fault problem, unifies the atom and primitive representation spaces through double view encoding+alignment mechanism, realizes multi-granularity collaboration, and structure-guided contrast learning avoids semantic distortion caused by random disturbance, thereby improving the generalization ability.

[0035] In some possible embodiments of the application, the original molecular graph is subjected to noise addition and reconstruction based on the graph diffusion model, the edge reconstruction error is calculated, and the original molecular graph is divided into a plurality of primitive subgraphs according to the edge reconstruction error, specifically including: The edge reconstruction error of each edge is calculated by pre-training a graph diffusion model to add noise forward and reconstruct reversely to the original molecular graph , and an edge reconstruction error matrix is constructed, wherein, ; The edge reconstruction error matrix is converted into an edge weight matrix , and the conversion formula is: , wherein, is a temperature hyperparameter; Based on the edge weight matrix , a spectral clustering algorithm is used to divide the original molecular graph into a plurality of connected subgraphs; For each clustering cluster, it is checked whether the induced subgraph is connected, and if there are multiple connected components, each connected component is taken as an independent primitive; Finally, a set of primitive subgraphs is obtained, wherein each atom node is uniquely attributed to a primitive. Specifically, the embodiment provides an implementation for determining a primitive subgraph, by calculating the edge weight matrix after diffusion, wherein the edge weight value is high for edges with small reconstruction error, Laplace eigenvalue decomposition is performed on the edge weight matrix, and the first The feature vectors are clustered, and the connected nodes are classified into the same primitive. The clustering automatically identifies high-cohesion subgraphs (such as benzene rings), does not need to predefine a primitive library, realizes data-driven primitive generation, avoids overlapping primitives through hard division by a spectral clustering algorithm, simplifies alignment logic (which can be extended to soft attribution), and ensures unique attribution of atoms. In some possible embodiments of the present application, the graph diffusion model is trained by minimizing a diffusion reconstruction loss function, and the construction process of the diffusion reconstruction loss function specifically includes: performing forward noise addition on an original molecular graph , iteratively perturbing the adjacency matrix according to a noise scheduling coefficient , and the adjacency matrix of the th step is represented as: (1); (2), wherein t represents a time step, is an adjacency matrix in the original molecular graph, is an adjacency matrix after adding noise; is a node feature matrix, used to represent atomic attribute encoding, is Gaussian noise, is a noise scheduling coefficient, and the calculation formula is: (3), wherein , respectively represent the minimum noise amount introduced at an early time step and the maximum noise amount introduced at a last time step ; an adjacency matrix is reconstructed by a graph neural network encoder and a multi-layer perceptron encoder to predict the noise term of the th step T , and the reconstructed adjacency matrix is: (4); wherein is the reconstructed adjacency matrix, , the calculation formula is: (5); (6); The diffusion reconstruction loss function is defined as: (7).

[0036] ​​Specifically, this embodiment provides an implementation of a graph diffusion model. Through forward noise addition, backward reconstruction, and loss function construction, the noise reconstruction process forces the model to learn local dense structures of molecules (such as benzene rings). Subgraphs with small errors are the primitives, realizing the self-supervised generation of primitives. The diffusion loss serves as a self-supervised signal, replacing traditional expert rules and eliminating the need for manual annotation.

[0037] In some possible embodiments of the present invention, the step of encoding the atomic view and the primitive view using a graph neural network encoder specifically includes: Using a graph neural network encoder For information propagation in the atomic view, the node update formula is: (8); in, For nodes In the The output feature vector of the layer, Indicates the index of the current layer. , It is the total number of network layers. Represents a node The neighboring nodes, Representing neighboring nodes In the The feature vector of the layer, Represents a non-linear activation function. Indicates the first The trainable weight matrix of the layer, Indicates the first The trainable bias vectors of the layer Represents a node The set of neighboring nodes; In the weight matrix The graph neural network encoder Perform pruning to generate the pruned weight matrix. : (9), in, The retention probability is The mask matrix; Using a pruned graph neural network encoder Encode the primitive view to obtain the feature representation of the nodes in the primitive view. The node update formula is: (10) in, This represents the weight matrix calculated using the pruned weight matrix. Layer nodes Features denotes the updated feature vector of the atom node layer neighbor node of the atom node , and the primitive embedding matrix is obtained by performing graph-level pooling on the updated atom view and primitive view of the node respectively. (11). (12), wherein is a set of all atom nodes in the original molecular graph after the node is updated, is an atom node in the set , and is the final layer output feature vector of the atom node , and is a set of all primitive nodes in the primitive view after the node is updated, is a primitive node in the set , and is the final layer output feature vector of the node .

[0038] Specifically, the embodiment provides an implementation of encoding the atom view and the primitive view, atom embedding is generated by aggregating neighbor information through a standard graph neural network, a mask (retention probability ) is applied to the weight, pruned weights are generated, the node is updated by a pruned graph neural network, and the features (approximate representation under sparse constraint) of the neighbor of the layer are pruned. The atom embedding is generated by averaging all nodes in the graph, the primitive embedding is obtained by averaging all primitive nodes, and then the embedding matrix is constructed.

[0039] The above setting of the embodiment forces the graph neural network to focus on key connections (such as chemical bonds) by introducing a structure induction bias, and improves the robustness of primitive recognition; the dual-scale feature is decoupled: the atom embedding matrix retains atomic details, and the primitive embedding matrix abstracts functional primitives, providing a basis for alignment.

[0040] In some possible implementations of the present application, the graph neural network encoder is a graph isomorphism network (GIN), and the node update formula is: (13), wherein denotes a multi-layer perceptron, denotes a learnable parameter,​ node In the first layer, the output feature vector of the current layer is denoted as , and the index of the current layer is denoted as , , where L is the total number of layers of the network. The neighbor nodes of the node are denoted as , and the feature vector of the neighbor node in the first layer is denoted as . The set of neighbor nodes of the node is denoted as

[0041] . Specifically, the embodiment provides another implementation of a graph neural network encoder, which adopts a graph isomorphism network (GIN) node update formula. The GIN is more suitable for the molecular graph isomorphism property and enhances the structure discrimination ability through a multi-layer perceptron and a parameterized aggregation function than the GCN / GAT.

[0042] The graph neural network can be directly used in general cases, and the accuracy of the primitive division is improved.

[0043] In possible embodiments, the graph neural network encoder can include one or more combinations of GCN, GIN, and GAT. In some possible embodiments of the present application, the positive and negative sample pairs are constructed based on the atomic view and the primitive view, specifically including: For each atomic node , the primitive to which the atomic node belongs is selected to form a positive sample ; , Randomly selected nodes from other atomic nodes form a negative sample pair ; Randomly selected primitive nodes from other primitives form a negative sample pair .

[0044] Specifically, the embodiment provides an implementation of constructing a positive and negative sample pair. The positive sample is a positive sample formed by an atom and the primitive to which it belongs. The negative sample is an atomic level negative sample pair and a primitive level negative sample pair . Through the construction of structure perception contrast, the positive sample anchors the primitive attribution relationship, and the negative sample enhances the cross-primitive distinguishability.

[0045] In some possible embodiments of the present invention, the Barlow twin dual-view contrast loss function is specifically as follows: (14) in, This represents the total two-scale contrast loss. For the contrast loss of atomic views, For the contrast loss of the primitive view, As a weighting factor, , The calculation formula is: (15); (16) in, This represents the dimension of the embedding vector. Cross-batch correlation matrix for atomic views The elements on the diagonal are used to represent the atomic view, the first... Each dimension of feature and its correlation with different samples Cross-batch correlation matrix for atomic views Off-diagonal elements are used to represent the atomic view, the first... The first dimension feature and the first Redundancy between features in each dimension Cross-batch correlation matrix for primitive view The elements on the diagonal are used to represent the primitive view, specifically the first element. Each dimension of feature and its correlation with different samples Cross-batch correlation matrix for primitive view Off-diagonal elements are used to represent the primitive view, specifically the element that is the first element. The first dimension feature and the first Redundancy between features in each dimension.

[0046] Specifically, this embodiment provides an implementation of the Barlow twin dual-view contrastive loss function, including atomic embedding autocorrelation and redundancy in different dimensions, to maximize information compression: It forces feature dimensions to be independent and highly discriminative; by jointly optimizing the atomic / primitive views, it solves the problem of scattered training targets and achieves unified comparison at multiple granularities.

[0047] In some possible embodiments of the present invention , , , It is obtained through the following formula: (17); (18); (19); (20); (21); (22); wherein, 、 respectively represent the cross-batch correlation matrix of atom view and motif view, represents the atom embedding matrix the first dimension eigenvector, represents the mean of represents the standard deviation of represents the number of molecular graphs in the batch, represents the first dimension eigenvector of motif embedding matrix, represents the mean of represents the standard deviation of represents the number of motif sets in the batch, , respectively represent the normalized atom embedding matrix and motif embedding matrix, is a small constant to prevent the denominator from being zero.

[0048] Specifically, the embodiment provides an implementation of a kind of, by standardization eliminates dimensional influence, 、 so that different molecules can be compared, by constructing correlation matrix 、 and , measure the internal consistency of atom embedding and motif embedding.

[0049] The present application proposes a motif-aware method for molecular graph representation learning, which adopts an atom-level and motif-level dual-granularity information fusion mechanism, realizes motif self-supervised extraction through graph diffusion operation, and combines motif-atom dual-view contrast learning target to realize cross-granularity structure consistency modeling.

[0050] In some specific embodiments of the present application, as shown in Figure 2 Figure 2 ​​​​​This paper presents the overall framework of the MotiLa model proposed in this invention, which consists of three main stages: diffusion initiation, dual-scale training, and task-specific fine-tuning. Specifically, the diffusion module generates and reconstructs the molecular graph, the dual-scale module extracts and aligns global and local features, and the fine-tuning stage applies the pre-trained representation to a specific molecular property prediction task.

[0051] During the diffusion initiation phase, noise is added to the molecular graph through a series of forward processes, transforming it from the original graph. Evolved into a high-noise graph Then, through a parameterized backpropagation process... Achieving noise reduction and reconstruction. This process involves... The model learns the denoising path step by step, thereby reconstructing the original molecular structure.

[0052] During the dual-scale training phase, after pruning The model also considers the global structural representation of molecules. ) and local functional groups ( ), and respectively through two graph neural network encoders and after pruning Extraction. Graph structural information is further integrated through a multilayer perceptron, and Barlow twin-style contrastive loss is used to optimize global and local representations, ensuring that the model can effectively capture both structural and functional semantics.

[0053] Finally, in the task-specific fine-tuning stage, the pre-trained representations are used for downstream tasks, such as hepatotoxicity prediction and solubility assessment. This stage introduces real labels and fine-tunes parameters using classification or regression heads to achieve highly targeted molecular property predictions.

[0054] This framework supports parameter sharing and feature alignment between different molecular graphs, enhancing the model's generalization ability. The overall structural design emphasizes a modeling philosophy that integrates structure awareness and function orientation, providing a systematic solution for efficiently learning the properties of complex molecules.

[0055] The following is in conjunction with the appendix Figure 2 The overall operation process of the MotiLa model that implements the above method provided by the present invention will be described in detail.

[0056] First, in the diffusion initiation phase: This stage involves constructing a diffusion generation model to introduce controllable Gaussian noise into the graph structure and achieve reverse reconstruction of the original graph. Specifically, this includes: Step 1: Noise Addition Process Given an initial graph The model at each time step The structure of the inner iterative perturbation graph. The step graph is represented as The adjacency matrix updating method is as follows: , , wherein, is a noise scheduling coefficient, is a Gaussian noise, The calculation formula is as follows: .

[0057] Step two, noise removal process: Constructing a graph neural network encoder and a multilayer perceptron encoder for predicting the noise term of the first step T : .

[0058] Using the reparameterization trick to perform one-time adjacency matrix reconstruction, obtaining : , wherein, .

[0059] Step three, training target: the final goal is to restore the original graph structure, and the loss function is as follows: .

[0060] Further, in the bi-scale training stage: This stage contains two parts: network coding and representation optimization, further improving the model's learning ability of structure features and motifs, specifically: Step one, bi-scale network coding: Using a graph neural network model for graph structure information propagation, and the node updating method is as follows: ; .

[0061] To realize model pruning, random masking operation is performed on the weight matrix of the graph neural network encoder to generate : .

[0062] wherein, is a mask matrix with a retention probability of p . The node updating formula after pruning is: ​ .

[0063] Step two, double-scale representation optimization: After obtaining the node representation, the whole graph representation and motif representation are constructed using graph and subgraph structure respectively . : ; .

[0064] The process of constructing positive and negative sample pairs based on atomic view and motif view includes: For each atomic node , select the motif node to which the atomic node belongs to form a positive sample ; For each atomic node , randomly select the embedding vector of other atomic nodes as a negative sample pair ; For each motif node , randomly select the embedding vector of other motif nodes as a negative sample pair .

[0065] The training loss using the Barlow twin double-view contrast loss function is defined as follows: , where is the total double-scale contrast loss, is the contrast loss of the atomic view, is the contrast loss of the motif view, is the weight factor.

[0066] The graph-level loss and motif-level loss are designed using the Barlow twin loss, that is, , The calculation formula is: ; , where represents the dimension of the embedding vector, is the element on the diagonal of the atomic view cross-batch correlation matrix , which is used to represent the correlation between the th dimension feature and itself in the atomic view across different samples, is the element off the diagonal of the atomic view cross-batch correlation matrix , which is used to represent the correlation between the The first dimension feature and the first Redundancy between features in each dimension Cross-batch correlation matrix for primitive view The elements on the diagonal are used to represent the primitive view, specifically the first element. Each dimension of feature and its correlation with different samples Cross-batch correlation matrix for primitive view Off-diagonal elements are used to represent the primitive view, specifically the element that is the first element. The first dimension feature and the first Redundancy between features in each dimension.

[0067] Among them, the cross-batch correlation matrix of atomic views cross-batch correlation matrix of primitive views The calculation is as follows: ; ; in, Indicates the number of molecular maps in the batch. Indicates the number of primitive sets in the batch. , These represent the normalized atom embedding matrix and primitive embedding matrix, respectively. , ; ; , in, Represents the atomic embedding matrix No. 3D feature vectors express The mean, express standard deviation Represents the primitive embedding matrix No. 3D feature vectors express The mean, express standard deviation It is a small constant used to prevent the denominator from being zero.

[0068] During the task fine-tuning phase: The pre-trained model is then applied to specific molecular property prediction tasks, including: The first category is classified tasks: For the new map The model outputs a predicted vector: (twenty three); And cross-entropy is used as the classification loss: (twenty four).

[0069] The second type is regression tasks: The predicted value is: (25); The loss is the mean squared error: (26).

[0070] In another specific embodiment of the present invention, to more clearly and intuitively illustrate the technical solution and overall structure of the present invention, by... Figure 3 The method steps and module relationships of the present invention are summarized below. Figure 3 The document sequentially demonstrates the core modules, including original molecular graph input, primitive graph generation, dual-graph neural network encoder learning, cross-layer consistency alignment, and dual-view comparison target training, as well as the data flow and logical relationships between these modules. Specifically, it includes the following steps: Step 310: Input molecular diagram structure: Construct a standard molecular diagram with atoms as nodes and chemical bonds as edges. G = (V, E) ; Step 320, Graph Diffusion Processing Module: Calculate edge diffusion weights to form a weighted graph structure for primitive partitioning; Step 330, Molecular Generator: Divide the molecular graph into multiple local subgraphs to form a molecular structure; Step 340, Atomic Graph and Primitive Graph Encoder: Embed the two granularity structures using independent graph neural networks respectively; Step 350, Dual-view Comparison Learning Module: Use graph augmentation to construct multiple sets of graph-view pairs for comparative learning training; Step 360, Structural Representation Output: Output a structure-aware and semantically aligned graph embedding vector, which can be used for molecular property prediction tasks.

[0071] It is important to note that although graph neural networks (GNNs) have been widely used in the field of molecular graph representation learning, existing techniques still have significant shortcomings in areas such as structural granularity modeling, multi-level representation alignment, and contrastive learning generalization ability. These shortcomings are mainly manifested in the following aspects: Defect 1: The structural modeling granularity is too limited, making it impossible to explicitly express semantic substructures. Current mainstream graph neural network methods (such as GCN, GIN, MPNN, etc.) mainly aggregate features and encode graphs at the atomic level. Although this method can learn the information of the local neighborhood, it is difficult to accurately identify and express functional motifs (motifs) with biological activity significance such as benzene rings, carboxyl groups, and ester bonds. Since these high-order structures often determine the physicochemical properties and reactivity of molecules, the atomic-level encoding method lacks the necessary abstraction ability, limiting the model's expression depth and task performance.

[0072] Defect two: lack of structure semantic guidance in graph contrastive learning, and insufficient generalization ability In recent years, widely used graph contrastive learning methods (such as GraphCL, JOAO, SimGRACE) rely on random graph view transformation (such as node deletion, edge replacement, feature perturbation, etc.) to construct positive and negative sample pairs. This type of enhancement lacks specificity in structure and semantics, may violate chemical rationality, and can cause the model to learn contrastive features without actual semantics, reducing the generalization ability and transferability of complex molecular structures.

[0073] Defect three: lack of explicit mechanism for multi-granularity information fusion, making it difficult to establish alignment between local and global A small number of methods attempt to use subgraphs or graph pooling (such as DiffPool, InfoGraph) to achieve multi-level structure representation, but most fail to establish a clear semantic correspondence mechanism between atomic and motif levels, resulting in information duplication or expression faults in the fused representation. It is difficult to form a clear alignment path between structure embeddings, affecting the stability and interpretability of downstream tasks.

[0074] Defect four: lack of unified training objective for different granularity representations, and scattered learning objectives In existing methods, multi-granularity structures (such as graph as a whole, subgraph, and node) are often optimized using independent objective functions during training, lacking a unified information transmission and collaboration mechanism. This approach makes the correlation between different levels of embedding representation weak, making it difficult to form a unified discriminative space.

[0075] To address the above deficiencies of existing technologies, the present application provides a motif-level representation learning method for molecular graphs, which aims to solve the following key technical problems: How to automatically mine semantically meaningful motifs from molecular graphs without relying on expert annotations and encode them; How to construct a structure-consistent contrastive learning objective to enable the model to unsupervisedly enhance the discriminability and generalization ability between multi-granularity representations; How to make the above mechanism compatible with existing graph neural network architectures, maintaining efficient, transferable, and scalable training and inference capabilities.

[0076] By solving the above technical problems, the application can significantly improve the semantic expression ability of molecular representation, and provide more structure-aware feature input for molecular property prediction, structure analysis, drug screening and other tasks.

[0077] Therefore, based on the motif self-supervised extraction method of the graph diffusion mechanism, the edge diffusion weight modeling strategy is used to automatically extract high-density local subgraphs from the molecular graph under the unlabeled condition, and the subgraphs are defined as motifs, without manual annotation, and have high automation and structure perception ability.

[0078] A double-view construction and explicit alignment mechanism of atomic graph and structural motif graph is proposed, and on the basis of the atomic graph, a structural motif graph is generated by graph partitioning, so that each atom and its corresponding motif establish a corresponding mapping, realizing collaborative learning of structural consistency.

[0079] Through the double-view graph neural network coding and cross-layer consistency loss function design, independent graph neural network encoders are used for atomic graphs and motif graphs respectively, and cross-layer consistency regularization terms are used to align their embedding representations, improving the multi-granularity feature fusion capability of the model.

[0080] Through the cross-contrast learning objective function design between atomic graph and motif graph, the application constructs a cross-contrast loss function based on multi-granularity structure view, guiding the model to automatically learn the embedding space with strong structure discrimination in unsupervised training.

[0081] A multi-loss joint optimization mechanism of the overall training target is proposed, which introduces graph diffusion modeling loss, intra-view contrast loss and inter-view contrast loss to form a joint optimization target, and cooperatively improves the robustness and generalization ability of structural representation.

[0082] Through the flexibility and scalability design of the graph partitioning module, the motif extraction process in the method can be replaced by various methods such as graph clustering, spectral clustering and attention aggregation, and has configurability and task adaptation ability.

[0083] Moreover, the method structure is compatible with existing graph neural network architecture, the proposed scheme is compatible with existing GCN, GIN, GAT and other graph neural network module structures, and does not need to modify the network main body framework, so that the application is suitable for various industrial task scenarios.

[0084] Through the above settings of the application, the following advantages of the application are realized: compared with the existing molecular graph representation learning technology based on graph neural network, the molecular motif representation learning method based on molecular graph diffusion and double-scale alignment proposed by the application significantly improves the structure expression ability, contrast generalization performance, cross-task adaptability and explainability. Specifically, it includes: Effect one, improve the hierarchical nature and semantic integrity of structure expression: The present application automatically extracts high-density structure regions through graph diffusion mechanism, forms data-driven motif graph representation, effectively makes up for the expression deficiency of traditional atomic-level graph neural network in functional motif recognition; Through the alignment mechanism of atomic graph and motif graph, the model can capture micro atomic information and macro functional motif information at the same time, thereby enhancing the hierarchical perception ability of structure embedding; On actual molecular graph data (such as Tox21, HIV, ZINC, etc.), the model can accurately capture important structure modules such as benzene ring, carboxyl group and ester chain, and significantly improve the performance of downstream tasks.

[0085] Effect two, improve the discriminability and generalization performance under unsupervised contrast learning The present application introduces a double-view contrast mechanism and designs a cross-granularity structure consistency loss function to encourage the model to learn structure representation with strong discriminability and clear semantics on unlabeled data; Experimental results show that without using any label, the proposed method still outperforms the models trained based on GraphCL, JOAO, etc. in multiple downstream tasks, with 2%-4% improvement in ROC-AUC and RMSE indicators; The multi-granularity contrast method significantly enhances the robustness of the model to graph perturbation, local deletion, structure transformation and other distribution changes.

[0086] Effect three, enhance the transferability and task adaptability of the model Benefiting from cross-layer embedding alignment and double-scale feature fusion, the graph representation constructed by the present application can be flexibly applied to different tasks such as classification, regression and retrieval; Experiments show that when migrating from pre-training tasks (such as structure contrast) to downstream toxicity prediction or efficacy evaluation, the fine-tuning model can achieve excellent performance in only a few training cycles, showing good transfer efficiency and convergence speed.

[0087] Effect four, improve structure explainability and model transparency Unlike black-box graph neural networks, the present application explicitly divides motifs so that each prediction result can be mapped to a specific motif combination, making it easier for researchers or pharmaceutical chemists to understand the prediction reasons; For example, in the HIV activity prediction task, the model has high activation for some nitrogen-containing heterocyclic motifs, which is consistent with the known structure-activity relationship in pharmacology, and has strong structure explainability.

[0088] Effect five, efficient calculation of structure, controllable training process The proposed double-graph modeling scheme has graph partitioning and embedding parallel capability, and the overall calculation amount is similar to that of a traditional graph neural network, and can be run on mainstream GPU devices. Without relying on large-scale graph traversal or complex generated networks, the training is more stable, and is suitable for industrial deployment and large-scale structure screening.

[0089] In summary, the present application has significant innovation in the structure modeling mechanism, and is superior to the prior art in terms of expression ability, generalization performance, migratability and interpretability, and has outstanding technical application value and industrial transformation potential.

[0090] In some specific embodiments of the present application, as shown in Figure 4 The present scheme provides a molecular graph-oriented elementary representation learning system, which includes: The diffusion starting module 41 is used for adding noise and reconstructing the original molecular graph based on a graph diffusion model, calculating the edge reconstruction error, and dividing the original molecular graph into a plurality of elementary subgraphs according to the edge reconstruction error to form an elementary subgraph set; The double-scale coding module 42 is used for constructing an atomic view and an elementary view based on the original molecular graph and the elementary subgraph set, respectively, and using a graph neural network encoder to encode the atomic view and the elementary view to obtain an atomic embedding matrix and an elementary embedding matrix; The double-view comparison module 43 is used for constructing a positive and negative sample pair based on the atomic view and the elementary view, and using a Balol twin double-view comparison loss function to optimize the atomic embedding matrix and the elementary embedding matrix to realize cross-granularity representation alignment The molecular graph-oriented elementary representation learning system provided by the embodiments of the present application has similar implementation principles and beneficial effects to those of the molecular graph-oriented elementary representation learning method as shown in the above embodiments, and can refer to the implementation principles and beneficial effects of the molecular graph-oriented elementary representation learning method as shown in the above embodiments, which will not be repeated here.

[0091] Figure 5 An example of an entity structure schematic diagram of an electronic device is shown in Figure 5As shown, the electronic device can include a processor 510, a communications interface 520, a memory 530, and a communications bus 540, wherein the processor 510, the communications interface 520, and the memory 530 complete mutual communication through the communications bus 540. The processor 510 can invoke a logic instruction in the memory 530 to execute a molecular graph-oriented primitive level representation learning method, which includes: adding noise and reconstructing an original molecular graph based on a graph diffusion model, calculating an edge reconstruction error, and dividing the original molecular graph into a plurality of primitive subgraphs according to the edge reconstruction error to form a primitive subgraph set; based on the original molecular graph and the primitive subgraph set, an atomic view and a primitive view are constructed respectively, and a graph neural network encoder is used to encode the atomic view and the primitive view respectively to obtain an atomic embedding matrix and a primitive embedding matrix; based on the atomic view and the primitive view, a positive and negative sample pair is constructed, and a Barlow twin double-view contrast loss function is used to optimize the atomic embedding matrix and the primitive embedding matrix to realize cross-granularity representation alignment.

[0092] In addition, the logic instruction in the memory 530 described above can be implemented in the form of a software functional unit and sold or used as an independent product, which can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various program code storage media.

[0093] In another aspect, the present application also provides a computer program product comprising a computer program, which can be stored on a non-transitory computer-readable storage medium, and the computer program can be executed by a processor to enable the computer to perform the method of learning a molecular graph-oriented elementary representation, which comprises: adding noise to and reconstructing an original molecular graph based on a graph diffusion model, calculating an edge reconstruction error, and dividing the original molecular graph into a plurality of elementary subgraphs according to the edge reconstruction error to form an elementary subgraph set; constructing an atom view and an elementary view based on the original molecular graph and the elementary subgraph set, respectively, and using a graph neural network encoder to encode the atom view and the elementary view, respectively, to obtain an atom embedding matrix and an elementary embedding matrix; constructing positive and negative sample pairs based on the atom view and the elementary view, and optimizing the atom embedding matrix and the elementary embedding matrix using a Balol twin double-view contrast loss function to realize cross-granularity representation alignment.

[0094] In yet another aspect, the present application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and the computer program can be executed by a processor to implement the method of learning a molecular graph-oriented elementary representation, which comprises: adding noise to and reconstructing an original molecular graph based on a graph diffusion model, calculating an edge reconstruction error, and dividing the original molecular graph into a plurality of elementary subgraphs according to the edge reconstruction error to form an elementary subgraph set; constructing an atom view and an elementary view based on the original molecular graph and the elementary subgraph set, respectively, and using a graph neural network encoder to encode the atom view and the elementary view, respectively, to obtain an atom embedding matrix and an elementary embedding matrix; constructing positive and negative sample pairs based on the atom view and the elementary view, and optimizing the atom embedding matrix and the elementary embedding matrix using a Balol twin double-view contrast loss function to realize cross-granularity representation alignment.

[0095] The apparatus embodiments described above are merely illustrative, wherein the units shown as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., they can be located in one place, or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the present embodiment scheme according to actual needs. Those skilled in the art can understand and implement it without creative labor.

[0096] Those skilled in the art can clearly understand the technical solutions of the various embodiments from the above description of the embodiments, and the various embodiments can be implemented by means of software with the necessary general hardware platforms, and of course, can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part of the prior art that makes a contribution, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0097] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A primitive-level representation learning method for molecular graphs, characterized in that, include: The original molecular graph is subjected to noise addition and reconstruction based on the graph diffusion model. The edge reconstruction error is calculated, and the original molecular graph is divided into multiple primitive subgraphs according to the edge reconstruction error, forming a set of primitive subgraphs. Based on the original molecular graph and the set of primitive subgraphs, atomic views and primitive views are constructed respectively, and graph neural network encoders are used to encode the atomic views and primitive views respectively to obtain atomic embedding matrices and primitive embedding matrices. Positive and negative sample pairs are constructed based on the atomic view and the primitive view. The Barlow twin dual-view contrast loss function is used to optimize the atomic embedding matrix and the primitive embedding matrix to achieve cross-granularity representation alignment.

2. The primitive-level representation learning method for molecular graphs according to claim 1, characterized in that, The method involves adding noise and reconstructing the original molecular graph based on a graph diffusion model, calculating the edge reconstruction error, and dividing the original molecular graph into multiple primitive subgraphs based on the edge reconstruction error. Specifically, this includes: The original molecular graph is subjected to forward noise addition and reverse reconstruction using a pre-trained graph diffusion model, and the results for each edge are calculated. Reconstruction error Construct the edge reconstruction error matrix ,in, ; Reconstruct the error matrix of the edges Convert to edge weight matrix The conversion formula is: , in, This refers to temperature hyperparameters. Based on the edge weight matrix The original molecular graph is divided into multiple connected subgraphs using a spectral clustering algorithm. For each cluster, check whether its induced subgraph is connected. If there are multiple connected components, treat each connected component as an independent structural primitive. The final result is a set of structural primitive subgraphs, in which each atomic node uniquely belongs to a structural primitive.

3. The primitive-level representation learning method for molecular graphs according to claim 2, characterized in that, The graph diffusion model is trained by minimizing the diffusion reconstruction loss function, and the construction process of the diffusion reconstruction loss function specifically includes: For the original molecular diagram Add forward noise and iteratively perturb the adjacency matrix according to the noise scheduling coefficient. , No. adjacency matrix of steps Represented as: ; in, , Indicates a time step. This is the adjacency matrix in the original molecular graph. This is the adjacency matrix after adding noise; This is the node feature matrix, used to characterize the atomic attribute encoding. It is Gaussian noise. The noise dispatch coefficient is calculated using the following formula: , in, , These represent the early time steps. Minimum noise introduced and final time step The maximum amount of noise introduced; Through graph neural network encoder With multilayer perceptron encoder Predicting the first Step noise item And reconstruct the adjacency matrix: , in, The reconstructed adjacency matrix, , The calculation formula is: ; ; The diffusion reconstruction loss function is defined as: 。 4. The primitive-level representation learning method for molecular graphs according to claim 3, characterized in that, The process of encoding the atomic view and the primitive view using a graph neural network encoder specifically includes: Using a graph neural network encoder For information propagation in the atomic view, the node update formula is: ; in, For nodes In the The output feature vector of the layer, Indicates the index of the current layer. , It is the total number of network layers. Represents a node The neighboring nodes, Representing neighboring nodes In the The feature vector of the layer, Represents a non-linear activation function. Indicates the first The trainable weight matrix of the layer, Indicates the first The trainable bias vectors of the layer Represents a node The set of neighboring nodes; In the weight matrix The graph neural network encoder Perform random weight pruning to generate the pruned weight matrix. : , in, The retention probability is The mask matrix; Using a pruned encoder Encode the primitive view to obtain the feature representation of the nodes in the primitive view. The node update formula is: , in, This represents the weight matrix calculated using the pruned weight matrix. Layer nodes Features This represents the weight matrix calculated using the pruned weight matrix. Layer neighbor nodes The characteristic of this is the approximate representation under sparsification constraints; Graph-level pooling is performed on the updated atomic views and primitive views to obtain the atomic embedding matrix. and primitive embedding matrix : ; , in, This is the set of all atomic nodes in the original molecular graph after node updates. For set One of the atomic nodes, atomic nodes The final layer outputs a feature vector. This represents the set of all primitive nodes in the updated primitive view. Represents a set One of the primitive nodes, Represents primitive nodes The final layer outputs a feature vector.

5. The primitive-level representation learning method for molecular graphs according to claim 4, characterized in that, The graph neural network encoder is a graph isomorphic network, and the node update formula is: , in, This represents a multilayer perceptron. Indicates learnable parameters, For nodes In the The output feature vector of the layer, Indicates the index of the current layer. , It is the total number of network layers. Represents a node The neighboring nodes, Representing neighboring nodes In the The feature vector of the layer, Represents a node The set of neighboring nodes.

6. The primitive-level representation learning method for molecular graphs according to claim 4 or 5, characterized in that, The construction of positive and negative sample pairs based on atomic views and primitive views specifically includes: For each atomic node Select the atomic node Belonging primitive node Constitute positive samples ; Randomly select atomic nodes from other atomic nodes. , Constructing negative sample pairs ; Randomly select a primitive node from the other primitive nodes. , constitute negative sample pairs .

7. The primitive-level representation learning method for molecular graphs according to claim 6, characterized in that, The Barlow twin dual-view contrast loss function is specifically as follows: , in, This represents the total two-scale contrast loss. For the contrast loss of atomic views, For the contrast loss of the primitive view, As a weighting factor, , The calculation formula is: ; , in, This represents the dimension of the embedding vector. Cross-batch correlation matrix for atomic views The elements on the diagonal are used to represent the atomic view, the first... Each dimension of feature and its correlation with different samples Cross-batch correlation matrix for atomic views Off-diagonal elements are used to represent the atomic view, the first... The first dimension feature and the first Redundancy between features in each dimension Cross-batch correlation matrix for primitive view The elements on the diagonal are used to represent the primitive view, specifically the first element. Each dimension of feature and its correlation with different samples Cross-batch correlation matrix for primitive view Off-diagonal elements are used to represent the primitive view, specifically the element that is the first element. The first dimension feature and the first Redundancy between features in each dimension.

8. The primitive-level representation learning method for molecular graphs according to claim 7, characterized in that, , , , It is obtained through the following formula: ; ; ; ; ; ; in, , These represent the cross-batch correlation matrices of the atomic views and the primitive views, respectively. Represents the atomic embedding matrix No. 3D feature vectors express The mean, express standard deviation Indicates the number of molecular maps in the batch. Represents the primitive embedding matrix No. 3D feature vectors express The mean, express standard deviation Indicates the number of primitive sets in the batch. , These represent the normalized atom embedding matrix and primitive embedding matrix, respectively. It is a small constant used to prevent the denominator from being zero.

9. A primitive-level representation learning system for molecular graphs, characterized in that, include: Diffusion initiation module: used to add noise and reconstruct the original molecular graph based on the graph diffusion model, calculate the edge reconstruction error, and divide the original molecular graph into multiple primitive subgraphs according to the edge reconstruction error to form a primitive subgraph set; Dual-scale encoding module: used to construct atomic views and primitive views based on the original molecular graph and the set of primitive subgraphs, respectively, and use a graph neural network encoder to encode the atomic views and the primitive views respectively to obtain the atomic embedding matrix and the primitive embedding matrix; Dual-view comparison module: used to construct positive and negative sample pairs based on the atomic view and the primitive view, and to optimize the atomic embedding matrix and the primitive embedding matrix using the Barlow twin dual-view comparison loss function to achieve cross-granularity representation alignment.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the primitive-level representation learning method for molecular graphs as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Training method and device of drug intermolecular interaction prediction model

    CN117133382A

  • Molecular representation learning distribution external generalization method based on graph neural network

    CN120354085A

  • Methods, systems, and software for predicting biochemical networks or pathways

    WO2005054978A2

Cited By

  • Parameter and data processing correction method and system for power grid energy management

    CN121502624A