A theoretical yield prediction method for chemical reactions based on hierarchical information extraction mechanism
By combining the hierarchical information extraction mechanism of global and local attention, substructure group information in chemical reactions is extracted, which solves the problem of incomplete extraction of chemical reaction features in the existing technology and achieves more accurate and efficient theoretical output of chemical reactions. predict.
Patent Information
- Application Number
- CN202410040595.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-11
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-01-11
AI Technical Summary
Existing chemical reaction theoretical yield prediction methods based on deep learning are too limited in their attention to chemical reactions, resulting in the loss of chemical reaction features. Traditional feature extraction methods cannot effectively extract important information about the reaction.
Using a hierarchical information extraction mechanism that combines global attention and local attention, by extracting substructural groups in reactants and products, and using group embedding matrices and bidirectional GRU networks, the local and global information of the reaction is extracted, and the analysis is constructed. Chemical reaction theory yield prediction network with layer information extraction mechanism.
It improves the accuracy and efficiency of chemical reaction yield prediction, retains reaction information more comprehensively, narrows the selection range, and significantly improves the speed and accuracy of chemical reaction selection.
Smart Images

Figure CN117877603B
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of deep learning, chemical reaction feature extraction and chemical reaction theoretical yield prediction. Background Art
[0002] 1. Chemical reaction theoretical yield prediction
[0003] Theoretical yield prediction of chemical reactions plays an important role in fields such as chemistry and medicine. It can help chemical engineers and researchers understand the possible yields of unknown chemical equations, and plays an important role in guiding subsequent chemical experiments. In the field of drug development and organic synthesis, theoretical yield prediction can help researchers predict the synthetic yield of compounds, so as to select the most effective reaction path and conditions. This is very important for designing synthetic routes, optimizing reaction steps, and improving synthetic methods, which can speed up the development process of new drugs and improve the efficiency of chemical synthesis.
[0004] Specifically, the prediction of theoretical yield of chemical reactions is to infer the possible product yield of the chemical reaction based on the provided chemical reaction equation. Traditional chemical reaction yield prediction may require the ratio of reactants, the pH value of the reaction environment, the equilibrium constant of the reaction, and the initial amount of reactants to derive the theoretical yield of the product. This calculation process is based on the equilibrium law of chemical reactions, that is, when a chemical reaction reaches equilibrium, the molar ratio of reactants and products will satisfy a certain equilibrium constant relationship.
[0005] In the actual production field, researchers may not be able to clearly understand such detailed information about a reaction. In actual engineering, they often face the problem of how to select the reaction with the highest theoretical yield from a large number of reactions with unknown yields. In this process, what researchers need to know most is which reaction has the highest yield under a unified metric. They do not need to know the actual yield value of each reaction. Detailed yield research on each reaction will undoubtedly greatly delay the speed of research and development. Therefore, it is necessary to introduce new tools to quickly and accurately predict the theoretical yield of the reaction, so that researchers can quickly narrow the range of chemical reactions. Convolutional neural network technology based on residual blocks 2. Deep learning neural network
[0006] A deep learning neural network is a machine learning model that consists of multiple neural network layers, each of which contains many neurons (or nodes). The connections between these layers are organized in a specific pattern, allowing information to be passed and processed in the network. Deep learning neural networks usually have multiple hidden layers. Each hidden layer consists of many neurons that receive inputs from the neurons in the previous layer and process these inputs through some nonlinear transformation functions (such as activation functions). Such a hierarchical structure enables the network to learn more abstract and complex feature representations.
[0007] The training process of deep learning neural networks is achieved through the back-propagation algorithm. During the training process, the network receives a set of known input data and generates corresponding outputs. By calculating the error between the output and the true value and using optimization algorithms such as gradient descent, the weights and biases of the network are adjusted to minimize the error. This process is repeated many times until the network is able to produce accurate outputs on a given input.
[0008] The advantage of deep learning neural networks is that they can automatically learn feature representations in input data without manually designing features. This makes deep learning very effective in processing large-scale, high-dimensional data such as images, text, and audio. By increasing the depth of the network, deep learning models can learn more complex and abstract feature representations, thereby improving the model's expressiveness and performance.
[0009] It is the powerful feature extraction and classification capabilities of deep learning neural networks that enable them to learn known chemical reaction yields and thus classify a certain mapping relationship between these chemical reactions and their yields, thereby predicting the yields of unknown chemical reactions.
[0010] 3. Chemical reaction feature extraction in deep learning
[0011] At present, natural language processing models inevitably need to perform word segmentation operations. This is because in natural language processing tasks, text usually exists in the form of sentences or paragraphs, and the model cannot directly process these continuous texts. Therefore, it is necessary to convert the text into a series of discrete "tokens". For the theoretical yield prediction of chemical reactions, this step can be considered as the extraction of chemical reaction features.
[0012] This process usually includes the following steps: Tokenization:
[0013] (1) Divide the input text into discrete units such as words, subwords, or characters. The purpose of word segmentation is to convert continuous text into discrete tokens so that the natural language processing model can process it. Common word segmentation methods include space-based word segmentation, rule-based word segmentation, and machine learning-based word segmentation algorithms.
[0014] (2) Constructing a dictionary: Construct a dictionary based on the word segmentation results, mapping each token to a unique integer index. This dictionary is used to convert tokens in the text into a digital representation that the model can understand.
[0015] (3) Numericalization: Use a dictionary to convert the segmented text into a corresponding digital representation. Each token is replaced by its integer index in the dictionary, thus generating a sequence of numbers.
[0016] The traditional chemical reaction theory yield prediction based on natural language processing model only uses the simplest method to separate each chemical letter in word segmentation, such as Figure 1 As shown, this undoubtedly greatly erases the characteristics of the chemical reaction itself. Therefore, the present invention also innovates in the feature extraction of chemical reactions. Summary of the invention
[0017] The technical problem solved by the present invention is to propose a chemical reaction theoretical yield prediction method that combines global attention and local attention and extracts chemical reaction features from a deeper level, in response to the problems that the existing deep learning-based chemical reaction theoretical yield prediction method pays too much attention to chemical reactions and the traditional chemical reaction feature extraction method causes the loss of a large number of chemical reaction features.
[0018] The technical solution adopted by the present invention is: a method for predicting theoretical yield of chemical reactions based on a hierarchical information extraction mechanism, comprising the following steps:
[0019] Step 1: Propose a new method for chemical reaction feature extraction
[0020] Step 2: Propose a new mechanism for extracting chemical reaction hierarchical information
[0021] Step 3: Propose a chemical reaction theory yield prediction network architecture based on a hierarchical information extraction mechanism
[0022] The three steps are described as follows:
[0023] Step 1: A new method for chemical reaction feature extraction
[0024] Different from the traditional way of processing chemical reactions in natural language processing models, in order to explore the hidden features of the reactions as much as possible, a new reaction feature extraction method is proposed in the present invention.
[0025] First, by investigating a large number of chemical reaction processes, it is clear that most chemical reactions, if summarized, can be considered as reactions between certain substructures of reactant molecules, thereby generating new structures and thus generating new product molecules. Therefore, for chemical reactions, the substructures in the reactant and product molecules will undoubtedly provide important information for the occurrence of the reaction. Therefore, this model proposes that in the input stage of the model, the token process in the traditional transformer network architecture should be improved. Through the SMILES information of the reaction, the substructures with distances of 0, 1, and 2 between atoms in the reactants and products are extracted and called "groups", and these groups are regarded as a kind of participle of the chemical reaction equation.
[0026] This new word segmentation method overcomes the problem that the token process in the traditional transformer network cannot effectively extract effective features in chemical reactions. By extracting groups with distances between atoms of 0, 1, and 2, it is basically possible to cover the atoms in reactants and products while retaining the structural relationship between different atoms in reactants and products as much as possible, thus retaining the reaction information as much as possible.
[0027] In order to further extract information between different groups, the present invention improves the traditional word2vec word vector model and proposes a group embedding method.
[0028] The specific steps of step 1 are as follows:
[0029] Step 101: According to the SMILES format string of the input reaction equation, the reactants and compounds in the reaction are extracted in turn, and then converted into chemical molecule objects, and then the groups with specified distances in the reaction are calculated and saved as variables datas. For example, for the molecule OP(=O)(O)OP(=O)(O)O, extracting the groups with atomic distance of 1 can obtain four groups: "OP", "O=P(O)(O)O", "O=P", and "POP".
[0030] Step 102: Count the non-repeating groups in all chemical reaction equations, and then label these groups with integers in sequence starting from 0, so as to obtain a mapping table between groups and numbers.
[0031] Step 103: The reaction group set obtained in step 101 is input into word2vec to generate a group vector embedding matrix.
[0032] Step 2: Propose a new mechanism for extracting chemical reaction hierarchical information
[0033] In order to comprehensively consider the changes in the local and overall conditions of the reaction, the present invention innovatively proposes a hierarchical information extraction mechanism for chemical reactions. The main idea of the hierarchical information extraction mechanism in the present invention is to first extract as much information as possible about the local groups of the reaction, then condense the information about the local groups of the reaction to obtain the global information of the reaction, and finally extract and condense the overall information of the reaction again to synthesize the overall information of the reaction. Through this idea, the reaction information can be extracted and integrated as much as possible to obtain a better prediction effect.
[0034] Specifically, the groups obtained after the reaction group extraction will pass through a set of group encoders, which are composed of the group embedding matrix W e and bidirectional GRU. The group embedding matrix first maps the discrete group sequence of each reaction into a vector. Then the vector is input into the bidirectional GRU. As a recurrent neural network, GRU is very suitable for processing sequence data. At the same time, this model uses bidirectional GRU to more easily integrate the information of different groups. As shown in formula (1):
[0035] x it =W e G it , t∈[1,T],
[0036]
[0037]
[0038] Where T represents the total number of groups extracted in the i-th reaction, G it Identify the tth group in the ith reaction, W e represents the initially generated group embedding vector, represents the forward GRU, Represents backward GRU. Formula (1) gives the bidirectional GRU fusion information about the g-th group in the i-th reaction and combines it into formula (2).
[0039]
[0040] However, different groups play different roles in the reaction. Therefore, among the many groups in a reaction, some groups are more important. Therefore, in order to effectively distinguish the importance of different groups, after extracting the fusion gene of the group, the present invention adds an attention mechanism to the groups in the same reaction. The specific attention calculation is shown in formula (3).
[0041] u it=tanh(W g h it +b g ),
[0042]
[0043]
[0044] In formula (3), firstly, h obtained in formula (2) is it Input into a multi-layer perception network with only one layer to get u it , where W g and b g is the coefficient automatically generated by the multi-layer perception network. it and u G Get the normalized group importance matrix α it , where u G is a vector generated by random initialization, and will be continuously learned and updated during the subsequent model operation. Then the weighted sum of the weighted group information is calculated as the reaction vector s of the i-th reaction i , thus integrating the effective information of all groups extracted from the reaction.
[0045] After completing the encoding and attention at the group level, the encoding and attention at the reaction level begins. Similar to the group-level attention model, the global information extracted by the bidirectional GRU of the i-th reaction is first obtained through formula (4).
[0046]
[0047]
[0048]
[0049] After obtaining the global information of each reaction, we first need to integrate the global information of each reaction h i , input into the multi-layer perception network to obtain the weight u of the overall information for the reaction i , and introduces the knowledge vector u at the reaction level R , and the vector u R The overall knowledge of the reaction will be continuously learned in subsequent training, and then the total information weight α for each reaction will be calculated. i The attention formula at the reaction level is shown in formula (5):
[0050] u i =tanh(W s h i +b s ),
[0051]
[0052]
[0053] Finally, the overall weight α of the response is obtained. i , the global fusion information of the response h i By summarizing and extracting the information again, we can obtain the concentrated vector v of the overall information. Thus, a hierarchical information extraction mechanism with reaction group information and reaction global information is constructed.
[0054] Step 3: Propose a chemical reaction theory yield prediction network architecture based on a hierarchical information extraction mechanism
[0055] In summary, the present invention proposes Figure 2 A theoretical yield prediction model architecture for chemical reactions based on a hierarchical information extraction mechanism is shown.
[0056] The specific operation steps of the model architecture are as follows:
[0057] 1) According to the SMILES format expression of the chemical reaction, the characteristic groups with radius r of 0, 1, and 2 are extracted, and the corresponding group embedding matrix is generated.
[0058] 2) The extracted reaction characteristic groups are embedded into a group matrix to convert a group into a set of vectors.
[0059] 3) Input the group vector into the hierarchical information extraction mechanism network.
[0060] 4) First, through the local information extraction layer, a bidirectional GRU is used in the local information extraction layer to fully collect the information of the group.
[0061] 5) Perform group-level self-attention and give more weight to important groups.
[0062] 6) Summarize and condense the group information of each reaction to obtain the global information of the reaction.
[0063] 7) The global information of the response is then input into the global information extraction layer, in which the bidirectional GRU is also used to fully collect information.
[0064] 8) Calculate the information weight of the global response.
[0065] 9) Multiply the global information of the reaction by the global information weight to aggregate and condense the reaction information.
[0066] 10) The comprehensive information is input into the regression head for yield prediction. In order to avoid overfitting during training, a random neuron mask with a probability of 0.2 is set before the regression head.
[0067] 11) Compare with the correct output value and calculate the loss value.
[0068] 12) Back propagation promotes further learning of the network.
[0069] The entire model consists of 11 layers of networks. Taking the prediction of the reaction yield of the Buchwald-Hartwig coupling reaction as an example, Figure 3 The specific composition of the 11-layer network and the size of each layer are shown. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 This is the word segmentation effect diagram of traditional chemical reactions in natural language processing models
[0071] Figure 2 This is the structure diagram of the chemical reaction theory yield prediction model based on the hierarchical information extraction mechanism
[0072] Figure 3 The 11-layer network architecture diagram of the model of the present invention is taken as an example to predict the reaction yield of the Buchwald-Hartwig coupling reaction.
[0073] Figure 4 It is a flow chart of a theoretical yield prediction method for chemical reactions based on a hierarchical information extraction mechanism. DETAILED DESCRIPTION
[0074] 1) Model parameter setting.
[0075] Table 1 Parameter settings of neural network model based on hierarchical attention mechanism
[0076]
[0077] The present invention uses a single NVIDIA 3090 graphics card, and the cuda version is trained on 11.4. The overall training number is set to 200, the learning rate is set to 0.00161, a batch inputs 64 reactions, and the minimum number of group occurrences is set to 0, indicating that all groups are retained. At the same time, the maximum group length is set to 150, indicating that the group extracted from a reaction only retains the first 150, and if it exceeds, it is discarded, and if it is insufficient, it is filled with zero. If the number of classifications is 1, it is represented as a regression task, and only one result is finally obtained. Whether to establish a group mapping table is to consider whether there is an existing group mapping table. If there is an existing group mapping table, there is no need to regenerate, otherwise a new group mapping table will be generated according to the current training set.
[0078] Considering that the Word2Vec word embedding model is also used in this model to generate the embedding matrix, the parameter settings of the Word2Vec model are introduced in Table 3.
[0079] Table 2 Word2Vec model parameter setting table
[0080]
[0081] The input of the Word2Vec model is the groups extracted from each reaction. The vocabulary size determines whether the vocabulary generated by Word2Vec can include all the input groups. The parameter of the vocabulary length is the length of the group mapping table, so as to ensure that the generated vocabulary contains all groups. The number of training threads can accelerate the training process and can be set according to the actual CPU threads. The window size determines the context range in which Word2Vec considers the vector representation that a group should generate. It is recommended to set it to 20. The minimum number of group occurrences is set to 0, which means that any group that has appeared must be considered and cannot be discarded. The random seed is set to 0.
[0082] 2) Training and testing datasets
[0083] The data set used for training and testing in the present invention is a reaction yield set of Buchwald-Hartwig coupling reactions, and the data set includes 3955 data samples, each of which includes the expression of the reaction in SMILES format and the yield of each chemical reaction. Ten random grouping trainings are performed based on the data set for verification, and each data set is divided into a training set and a test set according to a ratio of 7:3.
[0084] 3) Operation process of the chemical reaction theory yield prediction method based on hierarchical information extraction mechanism
[0085] Next, we combine the model's optimal parameter settings and the attached Figure 4 A theoretical yield prediction method for chemical reactions based on a hierarchical information extraction mechanism is described in detail.
[0086] Step 1: Set the parameters of the model according to the parameters in Table 1 and Table 2.
[0087] Step 2: Input the training set data of Buchwald-Hartwig coupling reaction, extract the reaction groups of the training set, which includes extracting the reactants and products in a reaction, and then extracting the groups with atomic radius of 0, 1, and 2 in the reactants and products. According to the parameters set in Table 1, the maximum total number of groups extracted in a reaction is 150, and zeros are added if it is insufficient. The non-repeating groups in all reactions are counted and constructed as a "group-number" mapping table, and then the group set obtained in each reaction is input into word2vec, and the group vector embedding matrix is obtained through training, and the vector length of each group is 200.
[0088] Step 3: Use the obtained group vector embedding matrix and the extracted reaction groups to perform vector embedding, and then use the bidirectional GRU network to extract local group information. According to the training batch size set in Table 1, 64 reactions will be input at a time for local group information extraction.
[0089] Step 4: Perform self-attention on the extracted local group information and assign different information weights to different groups. The higher the weight, the more information the network believes that this group contains for predicting theoretical yield.
[0090] Step 5: According to the information weights of the local groups, the local information of the reaction is summarized to obtain the global information of the reaction.
[0091] Step 6: Use the bidirectional GRU network again to extract the global information of the response.
[0092] Step 7: Calculate the comprehensive weight of the global information.
[0093] Step 8: Use the comprehensive weight of the global information of the reaction obtained in step 7 to aggregate the overall information of the reaction, and then pass the aggregated information through the fully connected layer to obtain the predicted value of the theoretical yield of the reaction. For the test case of the model, the neuron shielding amount in Table 1 will also be turned off to allow the model to be tested at maximum capacity. At the same time, according to the training batch parameters in Table 1, in actual operation, the predicted value of the theoretical yield of 64 reactions in the same batch will be given.
[0094] 4) Beneficial effects of the theoretical yield prediction method of chemical reactions based on the hierarchical information extraction mechanism
[0095] This method was trained and tested ten times in random groups on the Buchwald-Hartwig coupling reaction dataset. The test results are shown in Table 3. Compared with other methods, the chemical reaction theoretical yield prediction results of this method have good performance in terms of determination coefficient (R2), mean absolute error (MAE), and root mean square error (RMSE).
[0096] Table 3 Beneficial effects of the present invention on the Buchwald-Hartwig coupling reaction data set
[0097]
Claims
1. A theoretical yield prediction method for chemical reactions based on a hierarchical information extraction mechanism, Its characteristics are It includes the following three steps: 1) According to the input SMILES of the chemical reaction, groups of different atomic radii of reactants and products are extracted as the characteristics of the chemical reaction, and the groups of the chemical reaction are input into Word2Vec to generate a vector representation of the specified length corresponding to each group; 2) Extracting the information of the local groups of the reaction, concentrating the information of the local groups of the reaction to obtain the global information of the reaction, and extracting and concentrating the overall information of the reaction again to synthesize the overall information of the reaction, specifically including: 21) Use bidirectional GRU to extract information about the local group of the reaction. The process of bidirectional GRU extraction is as follows: x it =W e G it ,t∈[1,T], Where T represents the total number of groups extracted in the i-th reaction, G it Identify the tth group in the ith reaction, W e represents the initially generated group embedding vector, represents the forward GRU, represents backward GRU; 22) The chemical reaction information extracted using the bidirectional GRU is expressed in the following form: 23) A self-attention mechanism is applied to the extracted group information to assign weights to different group information. The specific self-attention calculation is obtained using the following formula: Where W g and b g It is the coefficient automatically generated by the multi-layer perception network, and then through u it and u G Get the normalized group importance matrix α it , where u G is a vector generated by random initialization, and the weighted sum of the weighted group information is calculated as the reaction vector s of the i-th reaction i : 24) The global information of chemical reactions is also obtained using bidirectional GRU based on group information. The formula is as follows: where h i Represents the global information obtained by GRU for the i-th reaction; 25) Finally, use the overall weight α of the response obtained i , the global fusion information of the response h i By summarizing and extracting the information again, we can obtain the condensed vector v of the overall information; The specific formula is as follows: 3) Construct a chemical reaction theory yield prediction network architecture based on hierarchical information extraction and concentration mechanism. The optimal learning rate of the chemical reaction theory yield prediction network architecture based on hierarchical information extraction mechanism is 0.00161; the optimal training batch size of the chemical reaction theory yield prediction network architecture based on hierarchical information extraction mechanism is 64; the optimal group embedding vector size of the chemical reaction theory yield prediction network architecture based on hierarchical information extraction mechanism is 200; the optimal neuron shielding amount of the chemical reaction theory yield prediction network architecture based on hierarchical information extraction mechanism is 0.2; the maximum group set length of the chemical reaction theory yield prediction network architecture based on hierarchical information extraction mechanism is 150; the chemical reaction theory yield prediction network architecture based on hierarchical information extraction mechanism is 150. The yield prediction network architecture has 11 layers of networks, whose names and dimension sizes are input processing layer (64*1*150), group embedding layer (64*150*200), information extraction layer (64*150*100), group self-attention layer (64*150*100), group information weight layer (64*150*1), summary global information layer (64*1*100), global reaction information extraction layer (64*1*100), reaction self-attention layer (64*1*100), reaction information weight layer (64*1*1), aggregation information layer (64*100), and fully connected layer (100*1); the input processing layer processes the input chemical reaction according to the method proposed in step 1).
