A method for predicting molecular labels of a heterogeneous knowledge graph based on molecular domain knowledge enhancement

By constructing a heterogeneous knowledge graph and freezing node parameters, combined with MatSciBERT and ChemBERT models, the problems of poor interpretability and overfitting in traditional machine learning for predicting corrosion inhibitor molecular tags are solved, achieving efficient and accurate prediction of corrosion inhibitor molecular tags.

CN122436058APending Publication Date: 2026-07-21UNIV OF SCI & TECH BEIJING
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
UNIV OF SCI & TECH BEIJING
Filing Date
2026-04-28
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Traditional machine learning methods fail to effectively utilize the explicit knowledge graph of functional groups and chemical rings in molecules when predicting molecular tags of corrosion inhibitors, resulting in poor model interpretability and a tendency to overfit, especially with insufficient generalization ability on small batch datasets.

Method used

We construct a heterogeneous knowledge graph that deeply integrates molecular representation learning and explicit external chemical knowledge. Through principal component analysis, we unify the heterogeneous graph convolution mechanism for dimensionality reduction and freezing node parameters. We combine MatSciBERT and ChemBERT models to extract high-dimensional embeddings of functional groups and chemical rings, construct directed edges and relation types, and perform graph convolution and feature fusion.

Benefits of technology

It significantly improves the accuracy of predicting molecular labels for corrosion inhibitors, has a fast training speed, strong adaptability, conforms to physicochemical laws, has strong interpretability, avoids overfitting and catastrophic forgetting, and is suitable for small batch datasets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122436058A_ABST
    Figure CN122436058A_ABST
Patent Text Reader

Abstract

The application discloses a method for predicting molecular labels of a heterogeneous knowledge graph based on molecular field knowledge enhancement, and specifically comprises the following steps: firstly, constructing an initial data set; respectively analyzing functional group entities and chemical ring entities contained in each SMILES expression in the data set; converting into multi-dimensional vector embeddings to form functional group / chemical ring nodes; meanwhile, converting each expression string into a multi-dimensional vector embedding fused with topological fingerprints and context semantics to form molecular formula nodes; then, inputting each multi-dimensional vector embedding into a PCA model for dimension reduction to obtain each node with a unified dimension to construct a heterogeneous knowledge graph; based on a node embedding freezing mechanism, performing information propagation of the functional group / chemical ring to the molecular node to obtain high-level embedding features of each molecular node, and optimizing a loss function based on the high-level embedding features; finally, inputting a to-be-tested corrosion inhibitor molecule into the trained heterogeneous knowledge graph to output a predicted corrosion efficiency label; the application has fast training speed and high efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer applications that deeply intersects with materials informatics, cheminformatics and artificial intelligence, and specifically relates to a method for predicting molecular tags based on heterogeneous knowledge graphs enhanced with molecular domain knowledge. Background Technology

[0002] Traditional machine learning relies solely on tools like RDKit to extract the overall implicit fingerprint features of molecules. While this can predict corrosion inhibition efficiency to some extent, it neglects the rich relational information preserved in the non-Euclidean biochemical graph structure. For corrosion inhibitor molecules, their corrosion inhibition efficiency is significantly influenced by specific functional groups and chemical rings. The types and numbers of functional groups in a molecule (e.g., the number of amino groups and thiol groups) often directly determine the baseline of adsorption strength. Simply using the number of various functional groups and chemical rings for statistical analysis can achieve a good predictive level.

[0003] However, traditional molecular-level embeddings fail to establish explicit knowledge graph connections between molecular representations and these decisive functional group-level nodes, resulting in poor model interpretability and difficulty in capturing the absolute influence of local key substructures on overall properties.

[0004] With the development of large language models (LLM), the ChemBERT model for processing molecular sequences (SMILES) and the MatSciBERT model specifically designed for training on materials science literature corpora have emerged. MatSciBERT can accurately extract the deep semantic and physicochemical properties of functional groups and chemical rings in the field of materials science, while ChemBERT can capture the global sequence context features of molecules.

[0005] In prediction tasks targeting specific materials such as corrosion inhibitors, we often face typical small-batch datasets. On small-batch chemical datasets, backpropagation to update node parameters can lead to severe catastrophic forgetting and overfitting, as the model quickly remembers the noise of small samples and loses its generalization ability. Summary of the Invention

[0006] To address the aforementioned issues, this invention proposes a method for predicting molecular tags using a heterogeneous knowledge graph based on enhanced molecular domain knowledge. This method constructs a heterogeneous knowledge graph that deeply integrates molecular representation learning with explicit external chemical knowledge (functional groups, chemical rings). Furthermore, it fully utilizes domain knowledge enhancement techniques through principal component analysis for unified dimensionality reduction and a heterogeneous graph convolution mechanism that freezes node parameters, significantly improving the accuracy of predicting corrosion inhibitor molecular tags.

[0007] The specific steps are as follows:

[0008] Step 1: Collect the SMILES expressions of the target corrosion inhibitor molecules and their corresponding experimental labels for corrosion inhibition efficiency to construct the initial dataset;

[0009] Step 2: Use the RDkit software package for chemical pattern recognition algorithms to parse all functional group entities and chemical ring entities contained in each SMILES expression;

[0010] Step 3: Using the MatSciBERT language model, each functional group and chemical ring entity is converted into a multi-dimensional vector embedding to form the corresponding functional group node and chemical ring node.

[0011] Step 4: Using the RDKit cheminformatics toolkit and the ChemBERT pre-trained model, each SMILES expression string is converted into a multi-dimensional vector embedding that integrates topological fingerprints and contextual semantics to form molecular formula nodes.

[0012] Step 5: Embed the multi-dimensional vectors corresponding to the functional group nodes, chemical link nodes, and molecular formula nodes, and input them into the principal component analysis model for dimensionality reduction to obtain nodes of a unified dimension.

[0013] Specifically, the process involves first embedding the multidimensional vectors converted from functional groups, chemical rings, and SMILES expression strings, and then performing standard normalization on each. Finally, PCA dimensionality reduction is used to unify the normalized multidimensional vector embeddings into the same dimension, thereby obtaining the corresponding nodes of the same dimension.

[0014] Step 6: Construct a heterogeneous knowledge graph using nodes of a unified dimension, and define directed edges and various relation types;

[0015] The knowledge graph consists of a central molecular formula node and surrounding functional group nodes and chemical link nodes;

[0016] Define heterogeneous graph , where the node set These are molecular formula nodes, functional group nodes, and chemical linking nodes.

[0017] Directed edge set The direction is set from the functional group / chemical node to the molecular formula node.

[0018] Targeting the current molecular nodes of corrosion inhibitors The discrete number of functional group nodes / chemical link points contained in each functional group node / chemical link point is counted, and the number of nodes / chemical link points of the same functional group node / chemical link point is taken as the number of nodes / chemical link points pointing to molecular nodes. The directed edges are related; based on the number of discrete edges, the relationships are divided into six discrete types:

[0019] For 'containing 1 of this functional group', For 'containing 2 of this functional group', For 'containing more than 3 (including 3) of this functional group', For 'containing 1 of this chemical ring', For 'containing 2 of this chemical ring', It means 'containing more than 3 (including 3) of this chemical ring'.

[0020] Step 7: Based on the node embedding freezing mechanism, the information of functional groups and chemical rings is propagated to molecular nodes on the heterogeneous knowledge graph to obtain the final high-level embedding features of each molecular node.

[0021] During the training of heterogeneous knowledge graphs, in the process of performing graph convolution forward propagation and backward gradient optimization, the initial unified dimension of the multidimensional vector embeddings of all nodes in the knowledge graph is forcibly frozen. Only the multidimensional vector embeddings corresponding to the relations in the message passing process are changed and updated. The initial relation embedding vectors are randomly generated.

[0022] In the GraphSAGE message propagation model, the first In layer forward propagation convolution, given a molecular node The set of neighbor nodes composed of functional group nodes / chemical link nodes is arranged according to relation type. Divided into multiple subsets ;

[0023] Each subset contains the same number of functional group nodes / chemical link nodes;

[0024] Then, for each type of relation Aggregate the neighbor features under this relationship respectively;

[0025]

[0026] Functional group node / chemical link point In the Features of layer -1; Features of the lowest layer Embedding of each multidimensional vector of a frozen uniform dimension; For all neighboring nodes at the 1st Features within the layer.

[0027] Subsequently, the aggregated features of all different relation types are concatenated and then processed using a relation-specific convolution parameter matrix. Perform linear transformation fusion; finally, combine with molecular nodes. Previous layer features In combination, feature evolution updates are achieved through activation functions (such as ReLU):

[0028]

[0029] The value can be 1-L; The parameters for the heterogeneous convolutional layer are initially randomly generated.

[0030] Finally, repeat the above convolution process until... Values To obtain molecular nodes The final high-level embedding features .

[0031] Step 8: Optimize the loss function using the final high-level embedding features of each molecular formula node to obtain a parameter-optimized heterogeneous knowledge graph.

[0032] During the training phase, a standard regression task was set up, and the root mean square error (RMSE) was used as the loss function to measure the deviation between the predicted value and the experimental true value.

[0033] In scenarios involving distinguishing between high-efficiency and low-efficiency corrosion inhibitors or other classification tasks, a Softmax layer is added to the end of the MLP, and the loss function is the multivariate cross-entropy function.

[0034] The mathematical form of the root mean square error (RMSE) is:

[0035]

[0036] in, For training batch size, This is a label for the actual corrosion inhibition efficiency experiment. The final high-level embedding features are input into the corrosion inhibition efficiency label predicted by the MLP regression module.

[0037] Among them, molecular nodes The final high-level embedding features The input consists of two linear MLP (Multilayer Perceptron) regression modules, and the output is a continuous value of the predicted corrosion inhibition efficiency label. :

[0038]

[0039] For the parameters of the input layer, The offset of the input layer, For parameters of the intermediate layer, This represents the offset of the intermediate layer.

[0040] If the root mean square error does not decrease for n consecutive training epochs (where n is a set threshold), then the heterogeneous knowledge graph training is complete and all parameters reach their optimal values.

[0041] Among them, the error gradient is calculated during backpropagation. At that time, the Adam optimization algorithm is used to unidirectionally update the parameters of the heterogeneous convolutional layers with the initial learning rate. and The gradient of the feature matrix of the bottom node is always 0, and it is forcibly frozen.

[0042] Step 9: Convert the SMILES expression of the corrosion inhibitor molecule to be tested into functional group nodes / chemical node nodes and molecular nodes, and input them into the trained heterogeneous knowledge graph to output the predicted corrosion inhibition efficiency label.

[0043] The advantages of this invention are:

[0044] 1. It has a fast training speed and high efficiency, and does not require GPU training; CPU can train quickly.

[0045] 2. It conforms to the laws of physicochemistry and has strong interpretability; the larger the amount of data, the stronger the interpretability. The original design intention is to break the "black box" attribute of traditional machine learning and explicitly integrate chemical prior knowledge into the model.

[0046] 3. It is highly adaptable and can be used for label prediction where other functional groups or chemical rings are the main influencing factors. This framework is essentially a highly general feature decoupling and multimodal fusion architecture, not limited to the single scenario of "corrosion inhibition efficiency".

[0047] 4. High accuracy; the R value measured by this method is... 2 Significantly higher than the R obtained from training other models 2 . Attached Figure Description

[0048] Figure 1 This is a flowchart of a method for predicting molecular tags based on heterogeneous knowledge graphs enhanced with molecular domain knowledge, according to the present invention.

[0049] Figure 2 This invention describes the working principle of predicting molecular tags based on heterogeneous knowledge graphs enhanced with molecular domain knowledge.

[0050] Figure 3 This is a schematic diagram illustrating the process of converting each node into an embedded element in this invention.

[0051] Figure 4 This is an importance distribution map of functional group nodes obtained using the GAT model in this invention;

[0052] Figure 5This is an importance distribution diagram of chemical link points obtained using the GAT model in this invention;

[0053] Figure 6 This is a data distribution diagram of the original molecular features of this invention after dimensionality reduction visualization;

[0054] Figure 7 This is a data distribution diagram after dimensionality reduction visualization of the high-level embedding features of molecules in this invention. Detailed Implementation

[0055] To facilitate understanding and implementation of the present invention by those skilled in the art, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Obviously, the described embodiments are merely some, not all, embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort should fall within the scope of protection of the present invention.

[0056] This invention provides a method for predicting molecular tags based on heterogeneous knowledge graphs enhanced with molecular domain knowledge. It utilizes deep learning and graph representation learning for molecular attribute prediction, combining knowledge graph technology to integrate the original multidimensional vector embeddings of molecules with vector embeddings of specific functional groups and chemical rings, thereby predicting corrosion inhibition efficiency tags.

[0057] This invention employs techniques such as multimodal pre-trained feature extraction, non-parametric principal component analysis (PCA) dimensionality reduction, and heterogeneous graph convolutional message passing with node embedding freeze. It utilizes MatSciBERT to extract high-dimensional material semantic embeddings of functional groups and chemical rings, and uses RDKit and ChemBERT to extract global structure and context embeddings of molecular formulas. Finally, it uses the PCA algorithm to unify the embeddings of these heterogeneous nodes to the same latent space dimension.

[0058] Subsequently, a directed heterogeneous knowledge graph was constructed. By strictly constraining the number of relation edge types (classified by "containing 1", "containing 2", and "containing more than 3"), and introducing a training strategy that freezes all initial features of nodes and only updates the parameters of message-passing graph convolutions (such as GraphSAGE), the discrete, physicochemically significant local structural features and molecular global features are deeply integrated and specifically changed in the graph network topology. This achieves the technical effect of significantly improving the prediction accuracy of corrosion inhibition efficiency and completely suppressing model overfitting on small sample chemical datasets. It has the advantages of high prediction accuracy, strong generalization ability, and strong interpretability of model physical meaning.

[0059] like Figure 1 As shown, the specific steps are as follows:

[0060] Step 1: Collect the SMILES expressions of the target corrosion inhibitor molecules and their corresponding experimental labels for corrosion inhibition efficiency to construct the initial dataset;

[0061] Step 2: Use the RDkit software package, which employs chemical pattern recognition algorithms (such as SMARTS matching), to parse and separate all functional group entities and chemical ring entities contained in each SMILES expression;

[0062] This includes identifying which specific functional groups (such as amino, hydroxyl, thiol, etc.) / chemical rings (such as benzene ring, pyridine ring, etc.) are present in a given SMILES molecular formula, and counting the number of each functional group / chemical ring present.

[0063] Step 3: Using the MatSciBERT language model pre-trained on materials science literature, each functional group and chemical ring entity is converted into a multi-dimensional vector embedding to form the corresponding functional group node and chemical ring node.

[0064] Step 4: Using the RDKit cheminformatics toolkit and the ChemBERT pre-trained model based on the masked language model, each SMILES expression string is converted into a multi-dimensional vector embedding that integrates topological fingerprints and contextual semantics to form molecular formula nodes.

[0065] At this point, all three types of nodes in the heterogeneous knowledge graph (molecular formula nodes, functional group nodes, and chemical link nodes) have obtained initial high-dimensional feature representations.

[0066] Step 5: Embed the multi-dimensional vectors corresponding to the functional group nodes, chemical link nodes, and molecular formula nodes, and input them into the principal component analysis model for dimensionality reduction to obtain nodes of a unified dimension.

[0067] Specifically, the process involves first embedding the multidimensional vectors converted from functional groups, chemical rings, and SMILES expression strings, and then performing standard normalization on each. Then, PCA dimensionality reduction is used to unify the normalized multidimensional vector embeddings into the same dimension, thereby obtaining the corresponding nodes of the same dimension. This significantly reduces the number of parameters and improves computational efficiency.

[0068] Step 6: Construct a heterogeneous knowledge graph using nodes of a unified dimension, and define directed edges and the types of various relationships;

[0069] The knowledge graph consists of a central molecular formula node and surrounding functional group nodes and chemical link nodes;

[0070] Define heterogeneous graph , where the node set These are molecular formula nodes, functional group nodes, and chemical linking nodes.

[0071] Directed edge set The direction is set from the functional group / chemical node to the molecular formula node.

[0072] Targeting the current molecular nodes of corrosion inhibitors The discrete number of functional group nodes / chemical link points contained in each functional group node / chemical link point is counted, and the number of nodes / chemical link points of the same functional group node / chemical link point is taken as the number of nodes / chemical link points pointing to molecular nodes. The directed edges are related; based on the number of discrete edges, the relationships are divided into six discrete types:

[0073] For 'containing 1 of this functional group', For 'containing 2 of this functional group', For 'containing more than 3 (including 3) of this functional group', For 'containing 1 of this chemical ring', For 'containing 2 of this chemical ring', It means 'containing more than 3 (including 3) of this chemical ring'.

[0074] Step 7: Based on the node embedding freezing mechanism, message propagation is performed on the heterogeneous knowledge graph. The information of functional groups and chemical rings will be propagated to the molecular nodes, and the final high-level embedding features of each molecular node will be obtained.

[0075] During the training of heterogeneous knowledge graphs, in the process of performing graph convolution forward propagation and backward gradient optimization, the initial unified dimension of the multi-dimensional vector embeddings of all nodes in the knowledge graph is forcibly frozen. Only the multi-dimensional vector embeddings corresponding to the relations in the message passing process are changed and updated. The initial relation embedding vectors are randomly generated. This effectively reduces the number of trainable parameters and avoids problems such as overfitting and catastrophic forgetting.

[0076] This example uses the GraphSAGE message propagation model, in the... In layer forward propagation convolution, given a molecular node The set of neighbor nodes composed of functional group nodes / chemical link nodes is arranged according to relation type. Divided into multiple subsets ;

[0077] Each subset contains the same number of functional group nodes / chemical link nodes;

[0078] Then, for each type of relation Aggregate the neighbor features under this relationship respectively;

[0079]

[0080] Functional group node / chemical link point In the Features of layer -1; Features of the lowest layer Embedding of each multidimensional vector of a frozen uniform dimension; For all neighboring nodes at the 1st Features within the layer.

[0081] Subsequently, the aggregated features of all different relation types are concatenated and then processed using a relation-specific convolution parameter matrix. Perform linear transformation fusion; finally, combine with molecular nodes. Previous layer features In combination, feature evolution updates are achieved through activation functions (such as ReLU):

[0082]

[0083] The value can be 1-L; The parameters for the heterogeneous convolutional layer are initially randomly generated.

[0084] Finally, repeat the above convolution process until... Values ,here The value is 6, representing 6 relation types. This yields the molecule node. The final high-level embedding features .

[0085] Step 8: Optimize the loss function using the final high-level embedding features of each molecular formula node to obtain a parameter-optimized heterogeneous knowledge graph.

[0086] During the training phase, a standard regression task was set up, and the root mean square error (RMSE) was used as the loss function to measure the deviation between the predicted value and the experimental true value.

[0087] If the task scenario is set to distinguish between high and low efficiency corrosion inhibitors or other classification tasks, a Softmax layer is added to the end of the MLP, and the cross-entropy function is selected accordingly as the loss function. The gradient is calculated through the backpropagation algorithm, and the optimizer is used to iteratively update the parameters of the unfrozen graph convolutional layers and MLP layers in the network until the model converges.

[0088] The mathematical form of the root mean square error (RMSE) is:

[0089]

[0090] in, For training batch size, This is a label for the actual corrosion inhibition efficiency experiment. The final high-level embedding features are input into the corrosion inhibition efficiency label predicted by the MLP regression module.

[0091] Among them, molecular nodes The final high-level embedding features The input consists of two linear MLP (Multilayer Perceptron) regression modules, and the output is a continuous value of the predicted corrosion inhibition efficiency label. :

[0092]

[0093] This example selects an MLP model with one intermediate layer, where... For the parameters of the input layer, The offset of the input layer, For parameters of the intermediate layer, This represents the offset of the intermediate layer.

[0094] If the root mean square error does not decrease for n consecutive training epochs within the effective training period (n is a set threshold, usually 20-50), then the heterogeneous knowledge graph training is complete and all parameters have reached their optimal values.

[0095] Among them, the error gradient is calculated during backpropagation. At that time, the Adam optimization algorithm is used to unidirectionally update the parameters of the heterogeneous convolutional layers with the initial learning rate. and The gradient of the feature matrix of the bottom node is always 0, and it is forcibly frozen.

[0096] If the GAT (Graph Attention Network) model is used instead of the GraphSAGE model, the contribution of each functional group / chemical ring to the predicted value of the efficiency label can be analyzed, indirectly revealing the importance of functional groups / chemical rings to the label. This has significant implications for molecular design. However, GAT introduces relational weights, increasing the number of training parameters, and only performs well on large datasets. For small datasets, analysis may be sufficient.

[0097] Step 9: Convert the SMILES expression of the corrosion inhibitor molecule to be tested into functional group nodes / chemical node nodes and molecular nodes, and input them into the trained heterogeneous knowledge graph to output the predicted corrosion inhibition efficiency label.

[0098] The method described in this invention is based on a molecular corrosion inhibition efficiency prediction system with heterogeneous knowledge graphs and unified dimensional embedding. The system consists of several modules: a data preprocessing and multi-source feature extraction module, a PCA principal component dimensionality reduction unified module, a heterogeneous knowledge graph construction module based on hierarchical rules, a heterogeneous graph convolution propagation module with frozen node embedding, and an MLP attribute prediction and error optimization module.

[0099] This study employs techniques such as cross-modal large model fusion for feature extraction, unsupervised dimensionality reduction using principal component analysis, and node embedding freezing regularization. By performing directed message propagation within a heterogeneous graph neural network framework, specific geometric and algebraic combinations are generated between local molecules (such as functional group characteristics extracted by MatSciBERT) and global molecular topology (such as SMILES features extracted by ChemBERT) within a constrained parameter space. Ultimately, this achieves high-precision, low-variance regression prediction of metal corrosion inhibitor protection efficiency with extremely small sample sizes. It has the advantages of overcoming the curse of dimensionality, lightweight model structure, and good adaptability to severe overfitting in small samples. Example

[0100] Step 1: Construct a molecular entity dataset and perform high-dimensional node feature extraction.

[0101] First, the SMILES string of the corrosion inhibitor molecule is read and fed into the RDKit cheminformatics module; then, the key entities present in the RDKit molecule are detected and separated using the substructure matching algorithm of RDKit.

[0102] In corrosion inhibitor chemistry, polar groups containing lone pairs of electrons (such as hydroxyl-OH, amino-NH2) and aromatic rings containing delocalized electrons (such as benzene rings) are the decisive factors for molecular adsorption on the surface of transition metals with empty d orbitals.

[0103] For each specific functional group and chemical ring entity isolated, the MatSciBERT model is invoked;

[0104] MatSciBERT is a BERT variant fine-tuned on a vast corpus of materials science and engineering literature, capable of capturing the deep contextual knowledge of these substructures in the fields of physical chemistry. The natural language names of these substructures are processed by a tokenizer and then input into MatSciBERT. The pooled output of the last hidden state is extracted to obtain a 768-dimensional vector.

[0105] Meanwhile, the overall molecular features are crucial; the original SMILES string is input into the ChemBERT pre-trained model. ChemBERT is a deep sequence model trained unsupervised on datasets such as ZINC and PubChem with tens of millions of chemical formulas, using masked language modeling, and its output 384-dimensional global semantic vector is extracted.

[0106] Corrosion inhibition efficiency is not only related to the overall topology of molecules, but also directly related to the electron-donating ability of functional groups within the field of materials science. By using dual-channel extraction from MatSciBERT and ChemBERT, we can not only input the macroscopic molecular view into the model, but also introduce the physical microscopic mechanisms at the functional group level into the characterization, thus laying the most solid high-dimensional feature foundation for the subsequent construction of a knowledge graph with explicit chemical rules.

[0107] like Figure 2 As shown, the first image is the SMILE molecular formula extracted using chemical knowledge bases such as Pubchem and Chembl; the second image is the identification of functional groups and chemical ring information of molecules using Rdkit and SMART; and the third image is the use of a graph deep learning model to pass messages between functional group / chemical ring nodes and molecular nodes, thereby enhancing the accuracy of label prediction.

[0108] Step 2: Unified dimensionality reduction mechanism for non-parametric heterogeneous nodes based on principal component analysis.

[0109] Because the 768-dimensional local entity nodes (functional groups / chemical rings) extracted using MatSciBERT differ in feature dimensions from the 384-dimensional global entity nodes (molecular formulas) extracted using RDKit combined with ChemBERT, if the dimensions are inconsistent, Hadamard product or linear mapping after matrix concatenation cannot be performed during the feature aggregation stage of the graph neural network.

[0110] This step introduces principal component analysis (PCA) algorithm, which inputs the functional group node matrix, chemical node matrix, and molecular formula node matrix into independent PCA models to extract the principal components that maximize variance and reduce the dimensionality to a preset unified dimension.

[0111] After this processing, all nodes in the knowledge graph are aligned in a semantic space of the same dimension, eliminating the dimensional barrier of matrix multiplication for subsequent convolution operations of isomorphic and heterogeneous graphs.

[0112] The mathematical formula is as follows:

[0113] First, the mean of each feature dimension is calculated and centered; then, the feature covariance matrix is ​​calculated.

[0114]

[0115] For covariance matrix Perform eigenvalue decomposition to obtain the eigenvalues ​​in descending order. And its corresponding eigenvectors. Before selection... Construct a projection matrix from the eigenvectors corresponding to the largest eigenvalues. In this embodiment, a unified target dimension of 256 is set, and the dimension-reduced node feature representation is calculated using a linear mapping formula:

[0116]

[0117] Through the matrix operations described above, both the 768-dimensional vector from MatSciBERT and the 384-dimensional vector from ChemBERT are mapped into a latent feature space of dimension 64.

[0118] The conventional approach to addressing dimensionality mismatch in this field is to add a randomly initialized multilayer perceptron (MLP) as a trainable dimensionality reduction mapping layer. However, in scenarios with small batch datasets, training a dense weight matrix ranging from 384 to 64 dimensions (containing approximately tens of thousands of parameters) can easily lead to the model absorbing data noise and overfitting. PCA, as a classic orthogonal transformation and unsupervised dimensionality reduction method, not only does not consume any training gradients, saving computational overhead, but also removes collinearity redundancy and noise in the output features of large models by preserving the principal components in the direction of maximum variance.

[0119] Step 3: Construction of heterogeneous knowledge graph topology based on hierarchical frequency truncation.

[0120] Heterogeneous knowledge graphs are constructed using nodes embedded with a unified dimension. Relationship edges are discretized and classified according to the statistical distribution of the dataset: the specific number of each functional group or chemical ring contained in the statistical molecule is counted. Since the number distribution may vary from 1 to more than a dozen, but the number of instances containing 1 or 2 is the majority, the relationship edges are strictly named into three discrete types: 'containing 1 functional group / chemical ring', 'containing 2 functional groups / chemical rings', and 'containing more than 3 (including 3) functional groups / chemical rings'.

[0121] Detailed implementation process: Since the dimensions of each chemical sub-entity have been unified, the next step is to construct their relationships within the graph space; define the heterogeneity graph. , where the node set It consists of molecular formulas, functional groups, and chemical rings. Directed edge set. The direction is uniformly set from local sub-entities (functional groups / chemical rings) to global entities (molecular formulas).

[0122] The core of this step lies in the set of relationships. The rules are set. The system scans the molecular dataset, targeting a specific molecule. To count a specific sub-entity contained within it Discrete number Based on statistical analysis of thousands of corrosion inhibitor data from the laboratory, examples containing one or two functional groups / chemical rings account for over 85% of the total data. If... The absolute values ​​are used as different graph network relationships (i.e., defining the relationship type as...). This would result in an extremely sparse graph relation matrix. Therefore, a hierarchical frequency classification logic is introduced.

[0123] Heterogeneous graph neural networks (such as CompGCN or GraphSAGE) assign independent weight tensors to each relation type during feature aggregation. By forcibly truncating and merging the infinite number of possible functional groups in a hierarchical manner ("1, 2, or 3 or more"), they successfully lock the number of trainable parameters at the relation level to an extremely small, fixed constant level. This eliminates the distortion of the local feature space caused by sample sparsity and adapts to the topological rules of chemical molecules.

[0124] Step 4: Message passing in a heterogeneous graph convolutional neural network (GNN) based on node gradient freezing mechanism.

[0125] Message propagation is performed on the constructed unified dimension heterogeneous knowledge graph. The message passing method of this method is not the ordinary isomorphic propagation of ordinary GNN, but heterogeneous propagation, and the message passing passes through a specific graph convolutional layer.

[0126] The heterogeneous propagation process can use the GraphSAGE model with fewer parameters as the convolutional layer, or more complex models such as GAT and CompGCN. For small-batch datasets, this step selects the GraphSAGE model with fewer parameters to perform heterogeneous convolutions to reduce optimization difficulty; for large datasets, a smooth transition to more complex models such as GAT (Graph Attention Network) or CompGCN can be achieved to pursue extremely high accuracy and interpretable attention weights.

[0127] During the forward propagation and backward gradient optimization of graph convolution, the initial uniform dimension embedding of all nodes in the knowledge graph is forcibly frozen (node ​​features are set to be untrainable), and only the convolution parameters of the relation edges in the message passing process are changed and updated (the weight matrix when aggregating neighbor information).

[0128] The engineering task of this invention is specific regression prediction of a single physicochemical property, not an intelligent recommendation collaborative filtering task that requires reshaping the spatial location of nodes. If the open node parameters are fully fine-tuned, within dozens of training epochs, the model will drastically distort the chemical manifold space pre-established by the large language model in order to fit the small bias of the small dataset, resulting in severe rote overfitting.

[0129] The essence of freezing node parameters is to use the high-dimensional features in the knowledge graph as an absolutely reliable constant reference system, allowing the model to adapt to the specific prediction task only by learning the relation weight coefficients on the network edges. This not only greatly reduces the computation time of each round, but also theoretically blocks the path of overfitting caused by high-capacity pre-trained features, enabling the model to maintain good generalization ability even with a very small sample size.

[0130] like Figure 3 As shown, based on knowledge enhancement, molecular tag prediction uses MatSciBert to embed functional group / chemical ring nodes and ChemBert to embed molecular nodes. Then, with domain knowledge enhancement, functional group and chemical ring features are fused with molecular features, and tag values ​​are predicted through an MLP layer.

[0131] Step 5: Fully connected MLP prediction, decoding, and loss function convergence optimization.

[0132] After the heterogeneous message passing iteration is completed (usually 2 to 3 layers), each target molecule node that has been significantly enriched and updated in the knowledge graph is extracted. The final high-level embedding features To output specific corrosion inhibition efficiency values, a multilayer perceptron (MLP) regression module consisting of two linear layers is connected at the top of the graph neural network to predict continuous values ​​of the corrosion inhibition efficiency of the target molecule.

[0133] If the engineering requirements change to a classification task that predicts the type of corrosion inhibitor (e.g., only roughly distinguishing between excellent / qualified / inferior corrosion inhibitors), a Softmax layer is added to the end of the MLP, and the loss function is simultaneously switched to a multivariate cross-entropy function.

[0134] Finally, the Adam optimization algorithm is used to, for example The initial learning rate, based on the calculated gradient One-way update of graph convolution weights and the weights of the fully connected layer This continues until the entire network reaches optimal convergence on the validation set.

[0135] Under 10-fold cross-validation, the results of this method compared to other machine learning methods are as follows:

[0136]

[0137] like Figure 4 As shown, this invention uses the GAT model to analyze the influence weight of each functional group on the corrosion inhibition efficiency label, obtains the importance distribution of functional group nodes, selects the 5 most important functional groups for visualization, and the ranking shows that it conforms to the physicochemical corrosion inhibition law.

[0138] like Figure 5 As shown, this invention utilizes the importance distribution of chemical rings obtained by the GAT model, selects the five most important chemical rings, and uses GAT to analyze the influence weight of the corrosion inhibition efficiency label on the chemical rings.

[0139] like Figure 6 As shown, the original molecular features are visualized using dimensionality reduction to obtain the data distribution map; the molecular embeddings are obtained by pre-training a large model with ChemBert, and then visualized using T-SNE dimensionality reduction. Molecules with similar structures will cluster very closely, indicating that the molecular clustering effect is good.

[0140] like Figure 7 As shown, the data distribution map after dimensionality reduction visualization of high-level molecular embedding features is visualized using T-SNE visualization with knowledge-enhanced high-level molecular features. The clustering effect is better, indicating that the embedding features of molecules with similar corrosion inhibition efficiencies will be more similar after knowledge enhancement. On the other hand, it shows that knowledge enhancement can effectively separate high-efficiency and low-efficiency molecular regions.

Claims

1. A method for predicting molecular tags based on heterogeneous knowledge graphs enhanced with molecular domain knowledge, characterized in that, The specific steps are as follows: Step 1: Collect the SMILES expressions of the target corrosion inhibitor molecules and their corresponding experimental labels for corrosion inhibition efficiency to construct the initial dataset; Step 2: Parse each SMILES expression to obtain all functional group entities and chemical ring entities it contains; It is then converted into a multidimensional vector embedding to form corresponding functional group nodes and chemical link nodes; Step 3: Convert each SMILES expression string into a multi-dimensional vector embedding that integrates topological fingerprints and contextual semantics to form molecular-type nodes; Step 4: Embed the multi-dimensional vectors corresponding to the functional group nodes, chemical link nodes, and molecular formula nodes, and input them into the principal component analysis model for dimensionality reduction to obtain nodes of a unified dimension. Step 5: Construct a heterogeneous knowledge graph using nodes of a unified dimension, and define directed edges and various relation types; Targeting the current molecular nodes of corrosion inhibitors The discrete number of functional group nodes / chemical link points contained in each functional group node / chemical link point is counted, and the number of nodes / chemical link points of the same functional group node / chemical link point is taken as the number of nodes / chemical link points pointing to molecular nodes. The relationship of directed edges ; Based on the number of discrete elements, the relation Divided into six discrete types: For 'containing 1 of this functional group', For 'containing 2 of this functional group', For 'containing more than 3 (including 3) of this functional group', For 'containing 1 of this chemical ring', For 'containing 2 of this chemical ring', It is defined as 'containing more than 3 (including 3) of this chemical ring'; Step 6: Based on the node embedding freezing mechanism, the information of functional groups and chemical rings is propagated to molecular nodes on the heterogeneous knowledge graph to obtain the final high-level embedding features of each molecular node. During the training of heterogeneous knowledge graphs, in the process of performing graph convolution forward propagation and backward gradient optimization, the initial unified dimension of each multidimensional vector embedding of all nodes in the knowledge graph is forcibly frozen, and only the multidimensional vector embedding corresponding to the relationship in the message passing process is changed and updated. The initial relationship embedding vector is randomly generated. Step 7: Optimize the loss function using the final high-level embedding features of each molecular formula node to obtain a parameter-optimized heterogeneous knowledge graph; Step 8: Convert the SMILES expression of the corrosion inhibitor molecule to be tested into functional group nodes / chemical node nodes and molecular nodes, and input them into the trained heterogeneous knowledge graph to output the predicted corrosion inhibition efficiency label.

2. The method as described in claim 1, characterized in that, In step two, the SMILES expression is parsed using the RDkit software package for chemical pattern recognition algorithms; functional groups and chemical ring entities are converted into multi-dimensional vector embeddings, which are implemented using the MatSciBERT language model.

3. The method as described in claim 1, characterized in that, In step three, each SMILES expression is converted into a multidimensional vector embedding, which is then used with the RDKit cheminformatics toolkit and the ChemBERT pre-trained model.

4. The method as described in claim 1, characterized in that, Step four specifically involves: first, embedding the multidimensional vectors converted from functional groups, chemical rings, and SMILES expression strings, and then performing standard normalization on each. Then, using PCA dimensionality reduction technology, the normalized multidimensional vectors are unified into the same dimension, thereby obtaining the corresponding nodes of the same dimension.

5. The method as described in claim 1, characterized in that, In step five, a heterogeneous graph is defined. , where the node set These are molecular formula nodes, functional group nodes, and chemical linking points; Directed edge set The direction is set from the functional group / chemical node to the molecular formula node.

6. The method as described in claim 1, characterized in that, In step six, in the GraphSAGE message propagation model... In layer forward propagation convolution, given a molecular node The set of neighbor nodes composed of functional group nodes / chemical link nodes is arranged according to relation type. Divided into multiple subsets ; Each subset contains the same number of functional group nodes / chemical link nodes; Then, for each type of relation Aggregate the neighbor features under this relationship respectively; ; Functional group node / chemical link point In the Features of layer -1; most underlying features Embedding of each multidimensional vector of a frozen uniform dimension; For all neighboring nodes at the 1st Features in the layer; Subsequently, the aggregated features of all different relation types are concatenated and then processed using a relation-specific convolution parameter matrix. Perform linear transformation fusion; Finally, with molecular nodes Previous layer features In combination, feature evolution and updates are achieved through activation functions: ; The value can be 1-L; The parameters for the heterogeneous convolutional layer are initially randomly generated. Finally, repeat the above convolution process until... Values To obtain molecular nodes The final high-level embedding features .

7. The method as described in claim 1, characterized in that, In step six, the training phase is set as a standard regression task, and the root mean square error is used as the loss function to measure the deviation between the predicted value and the experimental true value. The mathematical form of the root mean square error is: ; in, For training batch size, This is a true experimental label for corrosion inhibition efficiency; The final high-level embedding features are input into the corrosion inhibition efficiency label predicted by the MLP regression module; In scenarios involving distinguishing between high- and low-efficiency corrosion inhibitors or other classification tasks, a Softmax layer is added to the end of the MLP, and the multivariate cross-entropy function is chosen as the loss function.

8. The method as described in claim 7, characterized in that, Molecular nodes The final high-level embedding features The input consists of two linear MLP regression modules, and the output is the predicted continuous label value of the corrosion inhibition efficiency. : ; For the parameters of the input layer, The offset of the input layer, For parameters of the intermediate layer, The offset of the intermediate layer; If the root mean square error does not decrease for n consecutive training epochs within the effective training period, then the heterogeneous knowledge graph training is complete and all parameters have reached their optimal values. n is the set threshold.

9. The method as described in claim 6, characterized in that, Calculate the error gradient during backpropagation. At that time, the Adam optimization algorithm is used to unidirectionally update the parameters of the heterogeneous convolutional layers with the initial learning rate. and The gradient of the feature matrix of the bottom node is always 0, and it is forcibly frozen.