Molecular property prediction method based on frequency domain enhanced graph neural network
By decomposing the molecular graph into a multi-isomer graph and combining high- and low-frequency feature extraction with a dynamic message passing mechanism, the problems of small-scale datasets and class imbalance are solved, thereby improving the accuracy and generalization ability of molecular property prediction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUIZHOU UNIV
- Filing Date
- 2026-01-13
- Publication Date
- 2026-05-01
AI Technical Summary
Existing molecular property prediction methods are inadequate in small datasets and class imbalance scenarios, failing to fully reflect the complex topological structure and feature distribution of molecular graphs. Furthermore, existing pre-training methods fail to fully utilize the complementary information of multi-isomer graphs.
A frequency-domain enhanced graph neural network-based approach is adopted, which decomposes the molecular graph into a molecular scaffold graph, a functional group graph, and a pharmacophore graph. It combines a high- and low-frequency feature extraction module with a dynamic message passing mechanism to capture features at different levels of the molecule. The model performance is optimized through a class weight adjustment and contrastive learning loss calculation module.
It significantly improves the performance of molecular property prediction, especially in class imbalance and small sample scenarios, and enhances the model's generalization and discrimination capabilities.
Smart Images

Figure CN121963948A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of artificial intelligence and cheminformatics, specifically relating to a method for predicting molecular properties based on frequency domain enhanced graph neural networks. Background Technology
[0002] Molecular property prediction is a core task in cheminformatics and drug development, aiming to predict the physicochemical properties, biological activity, and toxicity of molecules based on information such as molecular structure. Accurate prediction of molecular properties is of great significance for drug discovery, materials design, and environmental protection. For example, in drug development, predicting molecular toxicity and biological activity can significantly reduce experimental costs and accelerate drug screening; in materials science, predicting molecular thermal stability and electrical conductivity is of great value for designing novel functional materials.
[0003] Molecules are typically represented as graphs, where nodes represent atoms and edges represent chemical bonds. This non-Euclidean data structure presents challenges for molecular modeling. In recent years, with the development of deep learning technology, molecular property prediction methods based on graph neural networks have gradually become a research hotspot in this field. Graph neural networks can effectively capture the features of nodes and edges in molecular graphs through neighborhood aggregation operations. However, existing molecular property prediction datasets are usually small in scale. For example, the MoleculeNet dataset typically contains only a few thousand to tens of thousands of molecular samples, while deep learning models usually require large-scale data to fully realize their performance. Directly training deep models on small datasets often leads to overfitting, limiting the model's generalization ability. Furthermore, the class distribution in molecular property prediction tasks is often highly imbalanced. For example, in toxicity prediction tasks, positive examples for some toxicity classes are far fewer than negative examples. Existing methods struggle to effectively handle this class imbalance, resulting in poor prediction ability for minority class samples.
[0004] Molecular graphs are complex, containing multi-level information including global topology, local chemical group properties, and molecular functional sites. Traditional graph neural networks mainly rely on neighborhood aggregation operations, tending to capture low-frequency features of molecular graphs, such as the feature similarity of similar nodes, but are weak in capturing high-frequency features such as local differences between nodes. Therefore, existing methods struggle to fully reflect the complex topology and feature distribution of molecular graphs, and this limitation makes the models inadequate when dealing with molecules with diverse chemical properties.
[0005] In recent years, pre-training methods have effectively mitigated the problems associated with small-scale datasets by learning general molecular representations on large-scale datasets and then fine-tuning them for specific tasks. However, most existing pre-training methods focus only on single characteristics of molecular graphs, failing to fully utilize the complementary information of multi-isomer graphs. Furthermore, many pre-training methods have limited ability to capture overall molecular features, failing to effectively combine global molecular information with the modeling of local characteristics. Existing molecular property prediction methods still have significant limitations in handling small-scale datasets and class imbalance. An innovative solution is urgently needed that can fully utilize the multi-frequency domain features of molecular graphs, mitigate the effects of class imbalance, and possess good generalization capabilities to improve performance in molecular property prediction tasks. Summary of the Invention
[0006] The purpose of this invention is to solve the above-mentioned problems by proposing a molecular property prediction method based on frequency domain enhanced graph neural network that exhibits excellent performance in molecular property prediction tasks, especially with significant advantages in class imbalance and small sample scenarios.
[0007] The present invention provides a method for predicting molecular properties based on a frequency-domain enhanced graph neural network, comprising the following steps:
[0008] Step 1: Pre-training module: Decompose the molecular map into a molecular scaffold map, a functional group map, and a pharmacophore map. Figure 3 Isomer diagrams capture features at different levels of a molecule; molecular scaffold diagrams extract the core framework structure of a molecule, reflecting its overall shape; functional group diagrams focus on key chemical groups in a molecule, demonstrating its chemical reactivity; and pharmacophore diagrams capture the key functional units that interact with the molecule and reveal its functional characteristics.
[0009] Step 2: Graph Neural Network Based on High- and Low-Frequency Feature Extraction Module and Dynamic Message Passing Mechanism
[0010] As the encoder in the pre-training module of step 1, the high- and low-frequency feature extraction module and the neural network with dynamic message passing mechanism enhance the modeling ability of complex features of molecular graphs by introducing the high- and low-frequency feature extraction module; during message passing, high-frequency information of node features is used to enhance the differences between nodes, and low-frequency information is used to capture the consistency of the structure; the Laplacian higher-order features of the graph are introduced to capture global topological information between distant nodes and support message passing in multi-order neighborhood ranges; through the dynamic message passing mechanism, the message strength is dynamically adjusted according to the distance between nodes.
[0011] Step 3: Category weight adjustment mechanism and task weight adjustment mechanism
[0012] The weighting module automatically calculates the weights for a specific class based on the number of samples in each class. For each task, first count the number of samples in each category in the training set. The category weights are calculated based on the category distribution using the following formula:
[0013]
[0014] in, These are hyperparameters used to smooth class weights when... When the value is close to 1, the dynamic range of the weight is small, making it suitable for situations where the category distributions differ significantly. All category weights are normalized after calculation.
[0015] ;
[0016] The adjusted weights are used for loss calculation. Let the predicted value of the graph neural network be... The real label is ,in It refers to the number of samples; in the case of class imbalance, it is determined by class weights. The loss is weighted and adjusted, where the weight of positive examples is... The weight of the negative example is The revised version The loss function for each sample is:
[0017] ;
[0018] At the start of multi-task learning, the same initial weights are assigned to each task, which set the starting point for learning for each task.
[0019] The graph neural network based on high and low frequency feature extraction module and dynamic message passing mechanism in step 2 provides molecular features for each task, which will be used to calculate the loss of the task.
[0020] In the current training iteration, the loss value for each task is calculated, and the task weights are updated based on the deviation between the current loss and the historical average loss.
[0021] The first The loss of each task is denoted as And let the current weight of this task be . The weights are dynamically updated based on the deviation between the current loss of each task and its historical average loss. The update formula is as follows:
[0022]
[0023] in Indicates the first The task in the first Weight at the next update Indicates the first The current loss of each task Indicates the first The historical average loss for each task To control the hyperparameters of adjustment, It is a constant used to prevent division by zero;
[0024] The updated weights are used to weight the loss for each task, ultimately forming the total loss to guide the optimization direction of the graph neural network. The total classification loss is:
[0025] ;
[0026] Step 4: Comparison Learning Loss Calculation Module
[0027] Positive and negative sample pairs are defined based on label values. Samples with the same label constitute positive sample pairs, while samples with different labels constitute negative sample pairs. Through supervised contrastive learning, sample pairs are constructed using real category information.
[0028] The graph neural network based on the high- and low-frequency feature extraction module and dynamic message passing mechanism in step 2 encodes the input molecule into a feature vector representation.
[0029] Cosine similarity is used to calculate the similarity score between the feature representations of two samples. Let the samples be... The features are represented as ,in The dimension of the feature vector. Let be the set of real numbers, which is related to the sample The similarity of feature representations is defined as:
[0030] ,
[0031] in Represents the transpose of a vector. Indicate its L2 norm;
[0032] Similarity matrix It is a similarity measure for all sample pairs, where The sample size is the number of samples. The contrastive learning loss is defined as:
[0033]
[0034] in, Indicates sample The set of positive samples This is a temperature coefficient used to control the distribution range of sample similarity; exp represents an exponential function with the natural constant e as the base. The contrastive learning loss and classification loss are combined to form the total loss function:
[0035]
[0036] in, It is a weight hyperparameter used to control the importance of contrastive learning loss in overall optimization.
[0037] The aforementioned method for predicting molecular properties based on frequency-domain enhanced graph neural networks is characterized in that the pre-training module in step 1 includes the following steps:
[0038] Database: 250,000 unlabeled molecules were randomly sampled from the ZINC15 dataset as a pre-training database;
[0039] Molecular diagram: A global feature node is introduced into the molecular diagram to represent the global features of the molecule as a whole, and it is connected to all atomic nodes in the molecular diagram to capture the global information of the molecule.
[0040] The molecular diagram is decomposed into a molecular scaffold diagram, a functional group diagram, and a pharmacophore diagram:
[0041] Modeling molecules as undirected graphs ,in It is a set of nodes, representing atoms in a molecule. It refers to the number of nodes; It is an edge set, representing the chemical bonds between atoms. It is the number of edges. Represents the node feature matrix, , The dimension of the node feature vector is given for each node. The corresponding row For one A 3D real-valued vector used to describe information such as the chemical properties, atom type, and partial charge of an atom. It is the adjacency matrix of the original molecular graph;
[0042] Global feature node features are represented as ,in As a feature dimension, global feature nodes are connected to all atomic nodes in the molecular graph, forming an extended graph. Its adjacency matrix is:
[0043]
[0044] in, This represents the connection between global feature nodes and all atomic nodes. Global feature nodes allow us to capture the global properties of the entire molecule, and a degree matrix is defined. Its diagonal elements satisfy , representing a node The number of connections, standard Laplacian matrix Defined as This matrix is used to describe the structural relationships between nodes in the graph;
[0045] For the original molecular diagram Three isomerization transformations were performed to generate molecular scaffold diagrams. , sensual group diagram and pharmacophore diagram These isomorphic graphs focus on the global topology of molecules, key chemical groups, and core characteristics of molecular-biological target interactions. The node and edge features of each graph are similar to the original molecular graph, and global information of global feature nodes is preserved.
[0046] Generate the molecular scaffold graph: Use the Murcko skeleton method in the RDKit library to identify and extract the core topological scaffold of the molecular graph, create a binary random mask, retain only the atoms belonging to the scaffold and global feature nodes, and filter out other atoms; apply this random mask to the node features, adjacency matrix and edge features of the original graph to obtain the molecular scaffold graph;
[0047] Generate functional group map: Use the predefined SMARTS pattern library to identify functional groups by substructure matching in the molecular diagram. Traverse these patterns and match them to determine the atomic indices of all functional groups. Create a binary random mask that retains only the functional group atoms and global feature nodes. Generate functional group map based on this random mask.
[0048] Generate pharmacophore map: Use the chemical feature tool of RDKit to identify pharmacophore features in the molecular map, create a random mask, and retain only the atoms that make up these pharmacophore features and global feature nodes to generate the pharmacophore map;
[0049] Encoder: A graph neural network based on high- and low-frequency feature extraction modules and dynamic message passing mechanisms, which inputs molecular scaffold maps, functional group maps, and pharmacophore maps into shared parameters. In this process, their respective node-level hidden representations are obtained:
[0050] ;
[0051] Feature fusion: The node representations obtained by the encoder from three complementary chemical views are stitched together as the fused node features.
[0052] ;
[0053] Transformer encoder: It receives fused node features as input, with each node, including atomic nodes and global feature nodes, serving as a "token". The output of this encoder is used for node-level prediction tasks. Through a self-attention mechanism, the Transformer encoder can capture more complex long-range dependencies between nodes, thereby further enhancing the quality of molecular representation.
[0054] The prediction layer is a module used for node-level prediction: the output of the Transformer encoder is represented as... Used to predict node feature values, for each atomic node The pre-trained module predicts its feature values. and with true characteristics Calculate the loss; for global feature nodes Similarly, predict its features and with true characteristics Calculate the loss:
[0055] .
[0056] The aforementioned method for predicting molecular properties based on a frequency-domain enhanced graph neural network is characterized in that the graph neural network in step 2, based on a high- and low-frequency feature extraction module and a dynamic message passing mechanism, includes the following steps:
[0057] The molecular data was transformed into a graph structure using the RDKit tool, where each atom was represented as a 115-dimensional feature vector that encoded its physicochemical and topological properties. These features formed the initial node features.
[0058] The input node features are projected onto the query matrix Q, key matrix K, and value matrix V through a linear layer, and the attention scores between nodes are calculated and the features are updated.
[0059] The high- and low-frequency feature extraction module utilizes a spectral domain decomposition mechanism, applying a high-frequency filter to obtain high-frequency features, which captures fine, local structural information; and applies a low-frequency filter to obtain low-frequency features, which captures smooth, global topological patterns. This decomposition method enables the graph neural network to simultaneously perceive the global structure and the subtle local changes that lead to the "active cliff".
[0060] The k-th power of the standard Laplacian matrix is calculated as a higher-order Laplacian feature, which reflects the global structural relationship within the k-hop neighborhood. These features are used to adjust the attention matrix to capture information diffusion over a larger neighborhood, thereby alleviating the oversmoothing problem in graph neural networks.
[0061] Message decay is achieved using a dynamic message passing mechanism to adjust the attention matrix: this allows the graph neural network to retain decayed global context information while focusing on close atomic interactions, combined with a higher-order Laplacian matrix. Adjust the attention matrix;
[0062] The random dropout technique is used to randomly drop neurons during training with a probability between 0.1 and 0.5.
[0063] Standardization techniques are used to normalize features to ensure that the numerical range of different features or layers is consistent.
[0064] The above-mentioned molecular property prediction method based on frequency domain enhanced graph neural network is characterized by the following specific steps of the high and low frequency feature extraction module and the neural network with dynamic message passing mechanism in step 2: Input node feature matrix First, obtain the query matrix Q, the key matrix K, and the value matrix V:
[0065]
[0066] Among them, for the first Node feature matrix High-frequency features are extracted as follows:
[0067]
[0068] For the first Node feature matrix Low-frequency features were extracted as follows:
[0069]
[0070] in , , , , It is a learnable parameter matrix. It is a temperature coefficient used to control the distribution range of sample similarity. Represents a node The set of neighboring nodes, The number of sets is represented by `<size>`, and `softmax` represents the normalized exponential function; then, the attention score matrix is calculated:
[0071]
[0072] in , This indicates the number of attention heads in a multi-head attention mechanism;
[0073] The enhanced message matrix is as follows:
[0074]
[0075] in and To adjust the parameters, This represents element-wise multiplication. It is the adjacency matrix of the original molecular graph, using the message matrix. The node feature update is completed, and the update formula is as follows:
[0076] .
[0077] Compared with existing technologies, this invention has significant advantages. As can be seen from the above technical solution: Firstly, in the pre-training module, this invention uses a graph neural network based on a high- and low-frequency feature extraction module and a dynamic message passing mechanism to calculate node features to obtain molecular representations. Then, a comparative learning loss calculation module is used to calculate the loss to train the graph neural network. Finally, based on the calculated loss, a category weight adjustment mechanism and a task weight adjustment mechanism are combined to adjust the task weights. The pre-training module generates molecular scaffold maps, functional group maps, and pharmacophore maps from the original molecular map. Figure 3 The invention employs a variety of molecular property prediction methods: isomer maps capture features at different levels of the molecule; molecular scaffold maps extract the core framework structure of the molecule, reflecting its overall shape; functional group maps focus on key chemical groups within the molecule, demonstrating its chemical reactivity; and pharmacophore maps capture the key functional units that interact between the molecule and its target, revealing the molecule's functional characteristics. By combining graph neural networks with frequency domain enhancement and dynamic task weight adjustment, this method is applied to the accurate prediction of molecular properties in chemistry, materials science, and drug development. The proposed molecular property prediction method achieves significant performance improvements in classification tasks, particularly excelling in scenarios with extreme class imbalance and small sample datasets, demonstrating broad application prospects. Attached Figure Description
[0078] Figure 1 This is a schematic diagram of the structure of the present invention;
[0079] Figure 2 This is a network framework diagram for the pre-trained module;
[0080] Figure 3 This is a diagram of a graph neural network framework based on a high- and low-frequency feature extraction module and a dynamic message passing mechanism.
[0081] Figure 4 Network framework diagram for category weight adjustment mechanism and task weight adjustment mechanism;
[0082] Figure 5 This is a network framework diagram for the comparative learning loss calculation module. Detailed Implementation
[0083] The following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effectiveness of a molecular property prediction method based on a frequency domain enhanced graph neural network proposed in this invention:
[0084] Example 1:
[0085] See Figure 1 The present invention provides a method for predicting molecular properties based on a frequency-domain enhanced graph neural network, comprising the following steps:
[0086] Step 1: Pre-training module
[0087] See Figure 2 The pre-training module aims to learn a universal "chemical language" by mimicking the analytical reasoning methods of chemists, thereby establishing reliable prediction methods. This module decomposes molecular diagrams into molecular scaffold diagrams, functional group diagrams, and pharmacophore diagrams. Figure 3 Isomer diagrams capture features at different levels of the molecule; molecular scaffold diagrams extract the core framework structure of the molecule, reflecting its overall shape; functional group diagrams focus on key chemical groups in the molecule, demonstrating its chemical reactivity; pharmacophore diagrams capture the key functional units that interact with the target, revealing the molecule's functional characteristics.
[0088] Database: 250,000 unlabeled molecules were randomly sampled from the ZINC15 dataset as a pre-training database; the purpose of this database is to enable the present invention to learn molecular representations in a universal chemical language in a large-scale chemical space;
[0089] Molecular diagram: A global feature node is introduced into the molecular diagram to represent the global features of the molecule as a whole, and it is connected to all atomic nodes in the molecular diagram to capture the global information of the molecule.
[0090] The molecular diagram is decomposed into a molecular scaffold diagram, a functional group diagram, and a pharmacophore diagram:
[0091] Modeling molecules as undirected graphs ,in It is a set of nodes, representing atoms in a molecule. It refers to the number of nodes; It is an edge set, representing the chemical bonds between atoms. It is the number of edges. Represents the node feature matrix, , The dimension of the node feature vector is given for each node. The corresponding row For one A 3D real-valued vector used to describe information such as the chemical properties, atom type, and partial charge of an atom. It is the adjacency matrix of the original molecular graph;
[0092] Global feature node features are represented as ,in As a feature dimension, global feature nodes are connected to all atomic nodes in the molecular graph, forming an extended graph. Its adjacency matrix is:
[0093]
[0094] in, This represents the connection between global feature nodes and all atomic nodes. Global feature nodes can capture the global properties of the molecule as a whole. To further characterize the structural information of the graph, a degree matrix is defined. Its diagonal elements satisfy , representing a node The number of connections, standard Laplacian matrix Defined as This matrix is used to describe the structural relationships between nodes in the graph;
[0095] To better represent information about molecules from different perspectives, the original molecular diagram... Three isomerization transformations were performed to generate molecular scaffold diagrams. , sensual group diagram and pharmacophore diagram These isomorphic graphs focus on the global topology of molecules, key chemical groups, and core characteristics of molecular-biological target interactions. The node and edge features of each graph are similar to the original molecular graph, and global information of global feature nodes is preserved.
[0096] Generate the molecular scaffold graph: Use the Murcko skeleton method in the RDKit library to identify and extract the core topological scaffold of the molecular graph, create a binary random mask, retain only the atoms belonging to the scaffold and global feature nodes, and filter out other atoms; apply this random mask to the node features, adjacency matrix and edge features of the original graph to obtain the molecular scaffold graph;
[0097] Functional group map generation: The aim is to highlight the reaction centers and key substructures of molecules. Functional groups are identified by substructure matching in the molecular map using a predefined SMARTS pattern library. These patterns are traversed and matched to determine the atomic indices of all functional groups. A binary random mask is created to retain only the functional group atoms and global feature nodes. The functional group map is generated based on this random mask.
[0098] Generate pharmacophore maps: Abstract spatial and chemical features that are crucial to biological interactions, such as hydrogen bond donors / acceptors and hydrophobic centers. Use the chemical feature tools of RDKit to identify pharmacophore features in the molecular map, create a random mask, and retain only the atoms that make up these pharmacophore features and global feature nodes to generate a pharmacophore map.
[0099] Encoder: A graph neural network based on high- and low-frequency feature extraction modules and dynamic message passing mechanisms, which inputs molecular scaffold maps, functional group maps, and pharmacophore maps into shared parameters. In this process, their respective node-level hidden representations are obtained:
[0100] ;
[0101] Feature fusion: The node representations obtained by the encoder from three complementary chemical views are stitched together as the fused node features.
[0102]
[0103] This strategy aims to integrate different levels of chemical semantics to create a comprehensive and chemically rich node representation, enabling a multi-level and multi-dimensional understanding of molecular structure.
[0104] Transformer encoder: It receives fused node features as input, with each node, including atomic nodes and global feature nodes, serving as a "token". The output of this encoder is used for node-level prediction tasks. Through a self-attention mechanism, the Transformer encoder can capture more complex long-range dependencies between nodes, thereby further enhancing the quality of molecular representation.
[0105] The prediction layer is a module used for node-level prediction: the output of the Transformer encoder is represented as... Used to predict node feature values, for each atomic node The pre-trained module predicts its feature values. and with true characteristics Calculate the loss; for global feature nodes Similarly, predict its features and with true characteristics Calculate the loss:
[0106] ;
[0107] The loss is calculated through node prediction tasks to minimize the prediction error and update the parameters of the graph neural network to learn the general representation ability of molecules.
[0108] Through this design, the present invention can learn global and local feature representations from molecular graphs, and at the same time, combine information from three isomorphic graphs to improve the generalization ability of molecular property prediction.
[0109] Step 2: Graph Neural Network Based on High- and Low-Frequency Feature Extraction Module and Dynamic Message Passing Mechanism
[0110] See Figure 3 As the encoder in the pre-training module of step 1, the high- and low-frequency feature extraction module and the neural network with dynamic message passing mechanism enhance the modeling ability of complex features of molecular graphs by introducing the high- and low-frequency feature extraction module. During message passing, high-frequency information of node features is used to enhance the differences between nodes, while low-frequency information is used to capture structural consistency. Introducing higher-order Laplacian features of the graph captures global topological information between distant nodes, supporting message passing within multi-order neighborhood ranges. Furthermore, through the dynamic message passing mechanism, the message strength is dynamically adjusted according to the distance between nodes, effectively alleviating the oversmoothing problem in traditional graph neural networks. This module, with attention mechanism as its core and combined with frequency domain information extraction, aims to obtain richer node representations.
[0111] The molecular data was transformed into a graph structure using the RDKit tool, where each atom was represented as a 115-dimensional feature vector that encoded its physicochemical and topological properties. These features formed the initial node features.
[0112] The linear layers project the input node features into the query matrix Q, the key matrix K, and the value matrix V. These matrices are key components of the self-attention mechanism, used to calculate attention scores between nodes and update features.
[0113] The high- and low-frequency feature extraction module utilizes a spectral domain decomposition mechanism, applying a high-frequency filter to obtain high-frequency features, which captures fine, local structural information, and applies a low-frequency filter to obtain low-frequency features, which captures smooth, global topological patterns. This decomposition method enables the graph neural network to simultaneously perceive the global structure and the subtle local changes that lead to the "active cliff".
[0114] Specifically, the input node feature matrix First, obtain the query matrix Q, the key matrix K, and the value matrix V:
[0115]
[0116] Among them, for the first Node feature matrix High-frequency features are extracted as follows:
[0117]
[0118] For the first Node feature matrix Low-frequency features were extracted as follows:
[0119]
[0120] in , , , , It is a learnable parameter matrix. It is a temperature coefficient used to control the distribution range of sample similarity. Represents a node The set of neighboring nodes, The number of sets is represented by `<size>`, and `softmax` represents the normalized exponential function; then, the attention score matrix is calculated:
[0121]
[0122] in , This indicates the number of attention heads in a multi-head attention mechanism;
[0123] The k-th power of the standard Laplacian matrix is calculated as a higher-order Laplacian feature, which reflects the global structural relationships within the k-hop neighborhood. These features are used to adjust the attention matrix to capture information diffusion over a larger neighborhood, thereby alleviating the oversmoothing problem in graph neural networks.
[0124] A dynamic message passing mechanism is used for message decay to adjust the attention matrix. The core idea of this mechanism is that the message propagation strength decreases as the node distance increases, thereby mitigating the oversmoothing problem that may occur in deep networks. It allows graph neural networks to retain decayed global context information while focusing on close atomic interactions, combined with a high-order Laplacian matrix. Adjust the attention matrix to construct an enhanced message matrix:
[0125]
[0126] in and To adjust the parameters, This represents element-wise multiplication. It is the adjacency matrix of the original molecular graph, using the message matrix. The node feature update is completed, and the update formula is as follows:
[0127] ;
[0128] Using random dropout as a regularization technique, neurons are randomly dropped during training with a probability between 0.1 and 0.5. This prevents graph neural networks from becoming overly reliant on specific features in the training data, thereby reducing the risk of overfitting and enhancing their generalization ability.
[0129] Standardization techniques are used to normalize features to ensure that the numerical range of different features or layer outputs is consistent, thereby accelerating convergence during the training phase and improving training stability.
[0130] Step 3: Category weight adjustment mechanism and task weight adjustment mechanism
[0131] See Figure 4 The system employs a category weight adjustment mechanism and a task weight adjustment mechanism to address the issues of imbalanced category distribution and multi-task heterogeneity in molecular property prediction tasks.
[0132] The weighting module automatically calculates the weights for a specific class based on the number of samples in each class. For each task, first count the number of samples in each category in the training set. The category weights are calculated based on the category distribution using the following formula:
[0133]
[0134] in, These are hyperparameters used to smooth class weights when... When the value is close to 1, the dynamic range of the weight is small, making it suitable for situations where the category distributions differ significantly. All category weights are normalized after calculation.
[0135] ;
[0136] The adjusted weights are used in the loss calculation, forcing the invention to focus more on those rare but often crucial minority class samples, thereby improving the invention's performance on imbalanced datasets; assuming the graph neural network's predicted value is... The real label is ,in It refers to the number of samples; in the case of class imbalance, it is determined by class weights. The loss is weighted and adjusted, where the weight of positive examples is... The weight of the negative example is ; after revision The loss function for each sample is:
[0137] ;
[0138] At the start of multi-task learning, the same initial weights are assigned to each task, which set the starting point for learning for each task.
[0139] The graph neural network based on high and low frequency feature extraction module and dynamic message passing mechanism in step 2 provides molecular features for each task, which will be used to calculate the loss of the task.
[0140] In the current training iteration, the loss value for each task is calculated, and the task weights are updated based on the deviation between the current loss and the historical average loss. This allows the invention to dynamically allocate more attention to tasks that converge more slowly or are more challenging, ensuring that optimization is balanced during multi-task learning. The loss of each task is denoted as And let the current weight of this task be . To enable the invention to automatically balance the weights of each task during training, the weights are dynamically updated based on the deviation between the current loss of each task and its historical average loss. The update formula is as follows:
[0141]
[0142] in Indicates the first The task in the first Weight at the next update Indicates the first The current loss of each task Indicates the first The historical average loss for each task To control the hyperparameters of adjustment, It is a constant used to prevent division by zero;
[0143] The updated weights are used to weight the loss for each task, ultimately forming the total loss to guide the optimization direction of the graph neural network. The total classification loss is:
[0144] ;
[0145] Step 4: Comparison Learning Loss Calculation Module
[0146] See Figure 5 To further enhance the ability of this invention to learn molecular graph features, a contrastive learning loss calculation module is introduced into the task loss. The core idea of contrastive learning is to improve the discriminative ability of this invention by narrowing the feature distance between positive sample pairs and widening the feature distance between negative sample pairs.
[0147] Positive and negative sample pairs are defined based on label values. Samples with the same label constitute positive sample pairs, while samples with different labels constitute negative sample pairs. Through supervised contrastive learning, sample pairs are constructed using real category information, thereby guiding the invention to learn more discriminative features.
[0148] The graph neural network based on high and low frequency feature extraction module and dynamic message passing mechanism in step 2 encodes the input molecule into a feature vector representation, which is the basis for similarity calculation in contrastive learning in this invention.
[0149] Cosine similarity is used to calculate the similarity score between the feature representations of two samples. Let the samples be... The features are represented as ,in The dimension of the feature vector. Let be the set of real numbers, which is related to the sample The similarity of feature representations is defined as:
[0150] ,
[0151] in Represents the transpose of a vector. Indicate its L2 norm;
[0152] The loss function in contrastive learning aims to increase the similarity between positive sample pairs and decrease the similarity between negative sample pairs. By minimizing this loss, the graph neural network is trained to learn features with high discriminative power, causing molecules of the same class to form compact clusters in the feature space, while molecules of different classes are separated from each other; similarity matrix It is a similarity measure for all sample pairs, where The sample size is the number of samples. The contrastive learning loss is defined as:
[0153]
[0154] in, Indicates sample The set of positive samples This is a temperature coefficient used to control the distribution range of sample similarity; exp represents an exponential function with the natural constant e as its base. The joint optimization of dynamic task weights and contrastive learning loss enables this invention to perform well in multi-task learning and class imbalance problems, thereby achieving accurate prediction of molecular properties. The contrastive learning loss is combined with the classification loss to form the total loss function:
[0155]
[0156] in, It is a weight hyperparameter used to control the importance of contrastive learning loss in overall optimization. By introducing contrastive learning loss, this invention can not only effectively distinguish similar molecules, but also improve the feature quality of minority class samples, thus showing stronger generalization and discrimination capabilities in molecular property prediction tasks.
[0157] Experimental Example 1:
[0158] The performance of this invention and several advanced baseline methods were compared on multiple representative datasets included in the MoleculeNet benchmark platform. These datasets cover a wide range of drug discovery areas, from physicochemical properties to biological activity and toxicity, with ROC-AUC as the evaluation metric.
[0159] Table 1 Performance comparison of the present invention in molecular property prediction tasks
[0160]
[0161] Table 1 shows that the present invention achieved the best results in each task, demonstrating its broad effectiveness and leading performance in molecular property prediction tasks. This confirms that the present invention is not only accurate but also a powerful and versatile tool for addressing real-world drug discovery challenges.
Claims
1. A method for predicting molecular properties based on a frequency-domain enhanced graph neural network, comprising the following steps: Step 1: Pre-training module: Decompose the molecular map into three isomer maps: molecular scaffold map, functional group map, and pharmacophore map, to capture the features of different levels of the molecule. The molecular scaffold map extracts the core skeleton structure of the molecule and reflects the global shape of the molecule; the functional group map focuses on the key chemical groups in the molecule and reflects the chemical reactivity of the molecule; the pharmacophore map captures the key functional units of the interaction between the molecule and the target and reveals the functional characteristics of the molecule. Step 2: Graph Neural Network Based on High- and Low-Frequency Feature Extraction Module and Dynamic Message Passing Mechanism As the encoder in the pre-training module of step 1, the high- and low-frequency feature extraction module and the neural network with dynamic message passing mechanism enhance the modeling ability of complex features of molecular graphs by introducing the high- and low-frequency feature extraction module; during message passing, high-frequency information of node features is used to enhance the differences between nodes, and low-frequency information is used to capture the consistency of the structure; the Laplacian higher-order features of the graph are introduced to capture global topological information between distant nodes and support message passing in multi-order neighborhood ranges; through the dynamic message passing mechanism, the message strength is dynamically adjusted according to the distance between nodes. Step 3: Category weight adjustment mechanism and task weight adjustment mechanism The weighting module automatically calculates the weights for a specific class based on the number of samples in each class. For each of the tasks, first count the number of samples of each class c in the training set. The category weights are calculated based on the category distribution using the following formula: in, These are hyperparameters used to smooth class weights when... When the value is close to 1, the dynamic range of the weight is small, making it suitable for situations where the category distributions differ significantly. All category weights are normalized after calculation. ; The adjusted weights are used for loss calculation. Let the predicted value of the graph neural network be... The real label is ,in It refers to the number of samples; in cases of class imbalance, it is determined by class weights. The loss is weighted and adjusted, where the weight of positive examples is... The weight of the negative example is The revised version The loss function for each sample is: ; At the start of multi-task learning, the same initial weights are assigned to each task, which set the starting point for learning for each task. The graph neural network based on high and low frequency feature extraction module and dynamic message passing mechanism in step 2 provides molecular features for each task, which will be used to calculate the loss of the task. In the current training iteration, the loss value for each task is calculated, and the task weights are updated based on the deviation between the current loss and the historical average loss. The first The loss of each task is denoted as And let the current weight of this task be . The weights are dynamically updated based on the deviation between the current loss of each task and its historical average loss. The update formula is as follows: in Indicates the first The task in the first Weight at the next update Indicates the first The current loss of each task Indicates the first The historical average loss for each task To control the hyperparameters of adjustment, It is a constant used to prevent division by zero; The updated weights are used to weight the loss for each task, ultimately forming the total loss to guide the optimization direction of the graph neural network. The total classification loss is: ; Step 4: Comparison Learning Loss Calculation Module Positive and negative sample pairs are defined based on label values. Samples with the same label constitute positive sample pairs, while samples with different labels constitute negative sample pairs. Through supervised contrastive learning, sample pairs are constructed using real category information. The graph neural network based on the high- and low-frequency feature extraction module and dynamic message passing mechanism in step 2 encodes the input molecule into a feature vector representation. Cosine similarity is used to calculate the similarity score between the feature representations of two samples. Let the samples be... The features are represented as ,in The dimension of the feature vector. Let be the set of real numbers, which is related to the sample The similarity of feature representations is defined as: ,in Represents the transpose of a vector. Indicate its L2 norm; Similarity matrix It is a similarity measure for all sample pairs, where The sample size is the number of samples. The contrastive learning loss is defined as: in, Indicates sample The set of positive samples This is a temperature coefficient used to control the distribution range of sample similarity; exp represents an exponential function with the natural constant e as the base. The contrastive learning loss and classification loss are combined to form the total loss function: in, It is a weight hyperparameter used to control the importance of contrastive learning loss in overall optimization.
2. The molecular property prediction method based on frequency domain enhanced graph neural network as described in claim 1, characterized in that, The pre-training module in step 1 Includes the following steps: Database: 250,000 unlabeled molecules were randomly sampled from the ZINC15 dataset as a pre-training database; Molecular diagram: A global feature node is introduced into the molecular diagram to represent the global features of the molecule as a whole, and it is connected to all atomic nodes in the molecular diagram to capture the global information of the molecule. The molecular diagram is decomposed into a molecular scaffold diagram, a functional group diagram, and a pharmacophore diagram: Modeling molecules as undirected graphs ,in It is a set of nodes, representing atoms in a molecule. It refers to the number of nodes; It is an edge set, representing the chemical bonds between atoms. It is the number of edges. Represents the node feature matrix, , The dimension of the node feature vector is given for each node. The corresponding row For one A 3D real-valued vector used to describe information such as the chemical properties, atom type, and partial charge of an atom. It is the adjacency matrix of the original molecular graph; Global feature node features are represented as ,in As a feature dimension, global feature nodes are connected to all atomic nodes in the molecular graph to form an extended graph. Its adjacency matrix is: in, This represents the connection between global feature nodes and all atomic nodes. Global feature nodes allow us to capture the global properties of the entire molecule, and a degree matrix is defined. Its diagonal elements satisfy , representing a node The number of connections, standard Laplacian matrix Defined as This matrix is used to describe the structural relationships between nodes in the graph; For the original molecular diagram Three isomerization transformations were performed to generate molecular scaffold diagrams. , sensual group diagram and pharmacophore diagram These isomorphic graphs focus on the global topology of molecules, key chemical groups, and core characteristics of molecular-biological target interactions. The node and edge features of each graph are similar to the original molecular graph, and global information of global feature nodes is preserved. Generate the molecular scaffold graph: Use the Murcko skeleton method in the RDKit library to identify and extract the core topological scaffold of the molecular graph, create a binary random mask, retain only the atoms belonging to the scaffold and global feature nodes, and filter out other atoms; apply this random mask to the node features, adjacency matrix and edge features of the original graph to obtain the molecular scaffold graph; Generate functional group map: Use the predefined SMARTS pattern library to identify functional groups by substructure matching in the molecular diagram. Traverse these patterns and match them to determine the atomic indices of all functional groups. Create a binary random mask that retains only the functional group atoms and global feature nodes. Generate functional group map based on this random mask. Generate pharmacophore map: Use the chemical feature tool of RDKit to identify pharmacophore features in the molecular map, create a random mask, and retain only the atoms that make up these pharmacophore features and global feature nodes to generate the pharmacophore map; Encoder: A graph neural network based on high- and low-frequency feature extraction modules and dynamic message passing mechanisms, which inputs molecular scaffold maps, functional group maps, and pharmacophore maps into shared parameters. In this process, their respective node-level hidden representations are obtained: ; Feature fusion: The node representations obtained by the encoder from three complementary chemical views are stitched together as the fused node features. ; Transformer encoder: It receives fused node features as input, with each node, including atomic nodes and global feature nodes, serving as a "token". The output of this encoder is used for node-level prediction tasks. Through a self-attention mechanism, the Transformer encoder can capture more complex long-range dependencies between nodes, thereby further enhancing the quality of molecular representation. The prediction layer is a module used for node-level prediction: the output of the Transformer encoder is represented as... Used to predict node feature values, for each atomic node The pre-trained module predicts its feature values. and with true characteristics Calculate the loss; for global feature nodes Similarly, predict its features and with true characteristics Calculate the loss: 。 3. The molecular property prediction method based on frequency domain enhanced graph neural network as described in claim 1, characterized in that, The graph neural network based on the high- and low-frequency feature extraction module and the dynamic message passing mechanism in step 2 includes the following steps: The molecular data was transformed into a graph structure using the RDKit tool, where each atom was represented as a 115-dimensional feature vector that encoded its physicochemical and topological properties. These features formed the initial node features. The input node features are projected onto the query matrix Q, key matrix K, and value matrix V through a linear layer, and the attention scores between nodes are calculated and the features are updated. The high- and low-frequency feature extraction module utilizes a spectral domain decomposition mechanism to obtain high-frequency features by applying a high-frequency filter, which captures fine, local structural information; and applies a low-frequency filter to obtain low-frequency features, which captures smooth, global topological patterns. This decomposition method enables the graph neural network to simultaneously perceive the global structure and the subtle local changes that lead to the "active cliff". The k-th power of the standard Laplacian matrix is calculated as a higher-order Laplacian feature, which reflects the global structural relationship within the k-hop neighborhood. These features are used to adjust the attention matrix to capture information diffusion over a larger neighborhood, thereby alleviating the oversmoothing problem in graph neural networks. Message decay is achieved using a dynamic message passing mechanism to adjust the attention matrix: this allows the graph neural network to retain decayed global context information while focusing on close atomic interactions, combined with a higher-order Laplacian matrix. Adjust the attention matrix; The random dropout technique is used to randomly drop neurons during training with a probability between 0.1 and 0.
5. Standardization techniques are used to normalize features to ensure that the numerical range of different features or layers is consistent.
4. The molecular property prediction method based on frequency domain enhanced graph neural network as described in claim 1, characterized in that, The specific steps of the high- and low-frequency feature extraction module and the neural network with the dynamic message passing mechanism in step 2 are as follows: Input node feature matrix First, obtain the query matrix Q, the key matrix K, and the value matrix V: Among them, for the first Node feature matrix High-frequency features are extracted as follows: For the Node feature matrix Low-frequency features were extracted as follows: in , , , , It is a learnable parameter matrix. It is a temperature coefficient used to control the distribution range of sample similarity. Represents a node The set of neighboring nodes, The number of sets is represented by `<size>`, and `softmax` represents the normalized exponential function; then, the attention score matrix is calculated: in , This indicates the number of attention heads in a multi-head attention mechanism; The enhanced message matrix is as follows: in and To adjust the parameters, This represents element-wise multiplication. It is the adjacency matrix of the original molecular graph, using the message matrix. The node feature update is completed, and the update formula is as follows: 。