-
Artificial intelligence-based approaches for chemical research have been evolving rapidly. Machine learning (ML) methods like neural networks have been widely used to predict chemical properties, from estimating quantum properties like bond dissociation energy (BDE) [1-4] to designing new organic synthetic routes (retro-synthesis) [5]. There are two key factors influencing the effectiveness when applying ML methods to chemistry. One is choice of descriptors to generate input for ML models. The other is quality of datasets, in terms of data quantity and precision. Typical ML methods require iterative training on a large training set, to generate a model that can precisely predict values on test data. The quality of data in training set directly dictates the performance of the trained model.
It is often difficult to acquire datasets of high quality in chemistry. Experimental data are very costly and usually sparse in chemical space [6], with experimental errors and limitations. Generating big data with theoretical approaches like ab initio calculation [7] is relatively easier, but still requires time and computational power. In addition, approximations made in theoretical calculations inevitably introduce errors, so do the ML models trained on them.
Different datasets can be calculated with different approximating methods, on different chemical properties, in different range of chemical spaces. Some datasets may be too small to train models on them, but still good candidates for evaluation. It is desirable to explore descriptors and ML methods that can be effectively transferred between datasets, learn fundamental rules from different datasets, and perform cross verification among them.
Graph neural network (GNN) [8, 9] is a category of neural network that can represent structural data of discrete nodes connected by edges between them. It can input and output values on each node and edge. It is natural to represent atoms as nodes and chemical bonds as edges, and the constructed graph can be used as descriptor of molecule structure. There have been multiple studies using GNN to predict chemical properties including BDE [10-12], chemical reactivity [13], and others [14, 15]. In this work, we collected three datasets with different calculation algorithm, size, bond types, and value ranges. We trained GNN models on the two datasets with large number of molecules and evaluated the performance of transferring GNN models to different datasets.
-
Three different datasets were used to test transferring of GNN models between them. The first dataset called MG contains BDEs of 213016 bonds from 29027 molecules with 11 different elements in the molecules, which was calculated by B3LYP-D3/6-311+G(2d,2p)/ SDD (D95 up to Ar and Stuttgart/Dresden energy-consistent pseudopotentials (ECPs) on the remainder of the periodic table) by ourselves [16-18]. The BDE-db dataset was published by John et al. [10, 19], containing BDEs of 482726 single bonds in molecules of only C, H, O, N atoms, up to 10 heavy atoms in molecule, calculated by M06-2X/def2-TZVP (triple zero valance plus polarization function) [20]. The ZINC dataset was used by Qu et al. [4], containing BDEs of 18064 bonds from 4342 molecules of C, H, O, N, S atoms, calculated by B3LYP/6-311++G(d,p)//DFTB (density functional-based tight binding) method. The MG and BDE-db datasets were split as training and test sets by 90% and 10%, while the ZINC dataset was only used as test set. The training and testing portion of datasets were used separately, to compare the performances of different models on exact same test sets.
FIG. 1 shows the difference of distribution of the three datasets. BDE-db dataset consists of only small molecules with 10 heavy atoms at most. MG dataset contains more molecules with fewer heavy atoms and some molecules with up to 25 heavy atoms, while ZINC dataset has more proportion of larger molecules with around 15 heavy atoms. All the three datasets have majority of bonds with BDE around 100 kcal/mol which are typically single bonds. ZINC dataset contains a small amount of double bonds with larger BDE, and MG dataset contains significantly more double and triple bonds with BDE up to 420 kcal/mol. A small amount of bonds in ZINC dataset have negative BDE.
FIG. 2 compares the composition of bond types in the three datasets. BDE-db dataset contains only C, H, O, N atoms in molecules, and the vast majority of bonds are C–C and C–H bonds. ZINC dataset contains a small number of molecules with sulfur atom, and the ratio of C–H bonds is smaller than BDE-db dataset. MG dataset contains 11 elements and much more types of bonds in total.
-
Mathematically, a graph is a set of nodes (also called as vertices) connected by edges between them. A molecule can be naturally represented as a graph with atoms at its vertices and chemical bonds at its edges.
The input features of each vertex and bond are plain vectors of same sizes. For each vertex, the input feature contains the element type of the atom. Atomic number is not used here since it is not linearly related to chemical characteristics of the element. Instead, one-hot encoding is used here, which is widely used in classification input. Different elements are set to 1, representing different positions in the vector, and 0 for other positions. For each bond, technically no input information is provided other than its connection-ship. Bond orders are not included because it is not well defined in many cases like aromatic and conjugated bonds. The GNN implementation requires bonds to be directional with non-zero input features seeded, thus for each chemical bond, we use two edges in each direction with identical input feature vector [1, 1], together with indices of two atoms it connects. FIG. 3 shows the structure of input data for a molecular graph.
-
For the purpose of ML, the MG and BDE-db datasets were randomly split into two parts, 90% for training and 10% for testing. Testing of different GNN models were done on the same test partitions for consistency.
All the GNN models share the same structure and parameters. The models consist of several iterative message passing (MP) layers, which accept vertex features
$ {\boldsymbol{v}}_{i} $ and edge features$ {\boldsymbol{e}}_{k} $ as input, calculate them based on the structures of graph, and generate new features${\boldsymbol{v}}_i^\prime$ and${\boldsymbol{e}}_k^\prime$ as output. Each MP layer contains two fully connected sub-networks${{\Phi }}_{v}$ and$ {{\Phi }}_{e} $ for calculating vertex and edge features, respectively.The process of MP layers can be demonstrated as:
FIG. 4 shows the mechanism of one MP layer. Totally 6 iterations of MP layers were used. The output edge features were filtered for target bond and the values of two directional bonds were accumulated together, then passed into a final sub-network to output prediction for BDE, which was trained with BDE data in the training set. All the sub-networks were fully connected neural networks (FCNN) with 1 hidden layer. The whole GNN network effectively generated prediction for BDE of all chemical bonds, while the training and testing data contained only a fraction of them. Thus, the network was designed to generate BDE for one bond at a time. FIG. 5 demonstrates the structure of GNN model to predict BDEs.
The Adam optimization algorithm was used for training the whole network, and mean square error (MSE) was used as the loss function. Learning rate (LR) between models were also consistent, which increased from 0.00001 to 0.0001 by each 100 epochs. The models were all trained for 400 epochs.
-
Mean absolute error (MAE) was used as a measurement of the precision of evaluations. Pearson correlation coefficient (r) and mean relative error (MRE) were also considered, but they can be interfered by a few exceptional cases, so only r was used for evaluation on the same dataset where exceptional cases were very rare. Systematic error (SE) which is simply defined as mean error was used for measuring the precision of transferring between datasets. MAE with compensation of SE is defined as
where
${y}_{i}'$ is predicted value and$y_i$ is expected value, and MAE with compensation of SE is used for evaluating the composition of error during transferring. -
We first trained two GNN models on the training set split from MG and BDE-db datasets, followed by the testing based on the testing sets from the same two datasets. The two models were trained using the same parameters. Evaluation results on the test sets are shown in FIG. 6.
The same method shows different precision on the two datasets. The mean absolute error of BDE-db dataset is one order of magnitude lower than MG dataset, and Pearson correlation coefficient is also much higher. This suggests that overall quality of BDE-db dataset is much higher than MG dataset.
-
In order to test the ability of predicting data within and beyond the range of training set, we split the datasets in terms of different bond types and bond orders, which also decide the BDE ranges. Two subsets were created for test portion of MG and ZINC datasets. The former subset contains only C, H, O, N elements in the molecules, and the latter one contains only single bonds in the former, corresponding to the element types and bond types in BDE-db dataset. Elements not existing in the training set will result in unknown representations in node input and thus cannot be handled by the GNN model at all. Therefore, the model trained on BDE-db dataset was evaluated on the subsets containing only C, H, O, N elements. The results of cross evaluation are shown in FIG. 6.
Transferring models between datasets generally results in lower precision when compared to evaluation on the same dataset. Some correlations do exist for single bonds in molecules of C, H, O, N (red dots in FIG. 7). The figures clearly show that range of evaluation results are highly related to the range of training set. When using models trained on wider range to evaluate dataset of narrower range, they can effectively predict values of all the range, with only a few cases giving exceptionally large values (FIG. 7(A)). When using models trained on narrower range to evaluate dataset of wider range, the available range of evaluation results will be limited to the range of training set (FIG. 7(C)). For values in the common range of training set, the model can predict them effectively.
-
We organized the cross evaluation results by bonding elements and compared the results on the same test sets. Only the results that range of test set was not wider than training set were considered successful and took into account.
FIG. 6 compares the precision of predictions of different bonds on each test set. For all of the transferring results, the MAEs were close to absolute values of SEs, suggests that errors were generally contributed more by systematic errors of transferring. For BDE-db test set (FIG. 8(A)), the magnitude of mean absolute errors using the MG model was similar to the prediction results on test set of MG itself (shown in FIG. 8(B)), where the error of C–H bonds was noticeably lower. The overall trend of errors on different bond types was similar to the result using BDE-db model that bonds with more occurrence in the datasets would generate lower error. After compensating for systematic error, the differences among different bond types were smaller. Systematic errors were significantly small on C–H, N–H, and O–H bonds, which are always single bonds. For MG test set (FIG. 8(B)), the errors after compensating for systematic error were quite close to evaluation on the same dataset. There were considerably higher precision for C–H and N–H bonds, which produced similar errors with results using MG model, regardless of compensating system error or not. Unlike transferring in the opposite direction, the error of O–H bonds using BDE-db model was even larger compared to other bonds. For predictions on ZINC dataset (FIG. 8(C)), the errors were significantly larger than that of MG and BDE-db datasets in the results of both prediction tasks and cross validation. The trend of errors of two different models was close for bonds with large occurrence count. The precisions of C–H and N–H bonds were still significantly higher.
-
We analyzed cases of bonds with utmost error between GNN predicted-BDE and DFT-calculated BDE for both verification on the same dataset and transferring between datasets, and summarized the trends of errors for similar bonds. FIG. 9(A) shows the error predicting N–N bonds in diazo group with MG model. The BDE of N–N bonds in diazo group is nearly zero in ZINC dataset, but shows high values in MG dataset and the results predicted by MG model. This indicates that the characteristic of GNN model is highly related to the data characteristic of training set. FIG. 10 shows the highest BDE bonds predicted by MG model in BDE-db dataset and single bonds of MG dataset. The cases in two datasets show a similar trend that single bonds affected by conjunction effect often get much higher BDE prediction, especially when in a large conjugated system. The GNN model can not handle every pattern in the training set well, and shows similar systematic error for similar cases.
-
In summary, we trained GNN models for predicting BDEs, and explored the ability of prediction on different datasets acquired with different methods. The results of transferring are generally less accurate than evaluations on the same dataset, but show interesting distributions of errors. The models are able to predict values within the range of training set, with notable systematic error. Some exceptionally large predicted values spread across the range of training set. Different type of bonds generates different precision in model transferring, where the precision of C–H and N–H bonds is constantly higher when compared with other bonds. The characteristics of the GNN model is highly related to, but not totally decided by the data characteristics of training set.
Transferring Graph Neural Network Models for Predicting Bond Dissociation Energy between Datasets
- Received Date: 25/08/2022
- Available Online: 27/02/2024
-
Key words:
- Machine learning /
- Graph neural network /
- Cross validation
Abstract: Machine learning (ML) approaches like neural networks have been widely used in chemical researches for fast estimating chemical properties. Generating ML models of good precision requires datasets of high quality, which can be difficult to obtain. In this work, we trained graph neural network (GNN) models from different datasets and verified transferring of the models to other datasets. Our result shows that cross-dataset evaluation can give less accurate but still correlative prediction results on different datasets. Errors are mainly due to systematic errors. The value range of prediction result is highly related to the range of training set. The precisions of different bonds show different distributions. C–H bond constantly gets the highest precision in the tested bonds.
首页
登录
注册


DownLoad: