scieee AI-readable full text Open interactive document viewer

Graph kernels and neural networks for predicting yields of chemical reactions

Braga, Diogo Filipe Ribeiro Ferreira

Abstract

Predicting chemical reaction yields is a widely investigated problem in drug discovery due to the natu ral appearance of diseases and viruses worldwide. With the evolution and further study of machine learn ing, this area of computer science has provided alternatives that help chemists search for more effective molecule combinations. This dissertation presents two research hypotheses with different bases that seek to improve this prediction problem. The first research hypothesis is related to the support vector regression algorithm, which uses graph kernels to measure similarity between molecules and then perform the pre diction. We propose the application of non-linearity in the Weisfeiler-Lehman graph kernel to improve the measure of comparison between molecules and thus enhance the complexity of the support vector regres sion models. The second research hypothesis is related to the class of neural networks. We propose a deep learning base to solve this problem through graph neural networks, which use graph convolutional layers and global read-out operations to extract molecular features from graph-structure data. The main focus is to ensure that all models generalise well to obtain good results in experiments with unknown molecules. We performed tests on chemical data for both methods and achieved improvements. The non-linearity in graph kernels proved to be the most advantageous, having surpassed the state-of-the-art methods in one of the two global tests performed. The graph neural networks were not as effective, although they showed competitive results. Concerning neural networks, we highlight the creation of the deep learning base and the in-depth analysis of the hyperparameters to enhance further research on the reaction yield prediction problem, as this area shows immense potential in drug discovery.

Full text

Universidade do Minho Escola de Engenharia Diogo Filipe Ribeiro Ferreira Braga Graph Kernels and Neural Networks for Predicting Yields of Chemical Reactions December, 2021 Universidade do Minho Escola de Engenharia Diogo Filipe Ribeiro Ferreira Braga Graph Kernels and Neural Networks for Predicting Yields of Chemical Reactions Master’s Dissertation Integrated Master’s in Informatics Engineering Work supervised by Professor César Analide Rodrigues December, 2021 COPYRIGHT AND TERMS OF USE OF THIS WORK BY A THIRD PARTY This is academic work that can be used by third parties as long as internationally accepted rules and good practices regarding copyright and related rights are respected. Accordingly, this work may be used under the license provided below. If the user needs permission to make use of the work under conditions not provided for in the indicated licensing, they should contact the author through the RepositoriUM of Universidade do Minho. License granted to the users of this work Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en STATEMENT OF INTEGRITY I hereby declare having conducted this academic work with integrity. I confirm that I have not used plagiarism or any form of undue use of information or falsification of results along the process leading to its elaboration. I further declare that I have fully acknowledged the Code of Ethical Conduct of the Universidade do Minho. Universidade do Minho, Braga, December 22, 2021 Acknowledgements The achievement of this dissertation is far from belonging to me alone. One of the lessons that life has given me so far is knowing how to recognise the guidance and opportunities provided by the people I work with, and to them acknowledge gratitude. To professor César Analide, from the University of Minho, for always being totally available to me and, right from the start, for having aligned himself with the adventure I wanted to undertake in my last academic year: studying abroad. More than anything, a genuine friend. From the host university, the Technical University of Vienna, my special gratitude to Professor Thomas Gärtner and Maximilian Thiessen. To the first, for having made it possible to make this adventure a reality and welcome me into the Machine Learning Research Unit. To the second, for supervising me every week, for always being available for my questions, for teaching me an innumerable amount of topics, for being dedicated to our discussions, for all the time spent and, finally, for being the best academic influence I can advise. Lastly, I want to express gratitude to Alexe Haywood, from the University of Nottingham, for giving me the opportunity to work on her promising drug design project. Without these four influences, this dissertation would never have been possible, much less successfully completed. The fulfilment of this incredible chapter would not be possible if it were not for some of the most important people in my life. The accomplishments of my life were never mine alone. This one, in particular, is not either, and those that the future holds for me will never be either. They are shared with the most special people in my life, to whom I send thankfulness that will never reach the support they provide me. To my parents, Filomena and António, and my brothers, Marco e Miguel, for supporting, defending, encouraging, tolerating, inspiring, and raising the human being I am today. Special consideration for my remaining relatives. To my other family, in which I consider myself fortunate that life has given me the opportunity to cross my path with theirs. Joana, Maria, Ana, Bárbara, Miguel, Pedro, Diogo. To the crew who followed this long academic path with me, sharing moments of learning and achieving success in innumerable exams and projects. João, Ricardo, Henrique, Ferreira, Moreira, Milhazes, Nélson. To my oldest ones, of whom I share countless good childhood memories that we continue to create. António, Rui, Alexandre. To the figures who brought me happiness and life balance in this last year of full change to Vienna. Eylül, José, Luís, Tihana, Tamara, Gabriel, Catarina, João, Leonie, Cristina. To everyone concerned, a thank you will never be enough. iii Abstract Predicting chemical reaction yields is a widely investigated problem in drug discovery due to the natural appearance of diseases and viruses worldwide. With the evolution and further study of machine learning, this area of computer science has provided alternatives that help chemists search for more effective molecule combinations. This dissertation presents two research hypotheses with different bases that seek to improve this prediction problem. The first research hypothesis is related to the support vector regression algorithm, which uses graph kernels to measure similarity between molecules and then perform the prediction. We propose the application of non-linearity in the Weisfeiler-Lehman graph kernel to improve the measure of comparison between molecules and thus enhance the complexity of the support vector regression models. The second research hypothesis is related to the class of neural networks. We propose a deep learning base to solve this problem through graph neural networks, which use graph convolutional layers and global read-out operations to extract molecular features from graph-structure data. The main focus is to ensure that all models generalise well to obtain good results in experiments with unknown molecules. We performed tests on chemical data for both methods and achieved improvements. The non-linearity in graph kernels proved to be the most advantageous, having surpassed the state-of-the-art methods in one of the two global tests performed. The graph neural networks were not as effective, although they showed competitive results. Concerning neural networks, we highlight the creation of the deep learning base and the in-depth analysis of the hyperparameters to enhance further research on the reaction yield prediction problem, as this area shows immense potential in drug discovery. Keywords: Machine Learning, Chemistry, Graphs, Kernel Methods, Graph Neural Networks iv Resumo A previsão do rendimento de reações químicas é um problema amplamente investigado na descoberta de medicamentos devido ao aparecimento natural de doenças e vírus em todo o mundo. Com a evolução e o estudo do machine learning, esta área da ciência da computação tem oferecido alternativas que ajudam os químicos a encontrar combinações de moléculas mais eficazes. Esta dissertação apresenta duas hipóteses de pesquisa com bases distintas que procuram melhorar este problema de previsão. A primeira hipótese de pesquisa está relacionada com o algoritmo support vector regression, que usa graph kernels para medir a similaridade entre as moléculas e, em seguida, realizar a previsão. Propomos a aplicação da não-linearidade no Weisfeiler-Lehman graph kernel para melhorar a medida de comparação entre moléculas e, assim, aumentar a complexidade dos modelos support vector regression. A segunda hipótese de pesquisa está relacionada com as redes neuronais. Propomos uma base de deep learning para resolver este problema através de redes neuronais, que usam camadas convolucionais adaptadas a grafos e operações de aglomeração de nodos que extraem características moleculares dos grafos. O objetivo principal é garantir que todos os modelos generalizam bem para obter bons resultados em novas experiências com moléculas desconhecidas. Realizámos testes em dados químicos para ambos os métodos e alcançamos melhorias. A não-linearidade nos graph kernels mostrou-se a mais vantajosa, tendo superado os métodos do estado-da-arte em um dos dois testes globais realizados. As redes neuronais de grafos não foram tão eficazes, embora tenham apresentado resultados competitivos. Ainda no que diz respeito às redes neuronais, destacamos a criação da base de deep learning e a análise aprofundada dos hiperparâmetros como fundamentação para as pesquisas futuras no problema de previsão de rendimento de reações químicas, uma vez que esta área apresenta muito potencial na descoberta de medicamentos. Palavras-chave: Machine Learning, Química, Grafos, Kernel Methods, Redes Neuronais de Grafos v Contents Acronyms viii 1 Introduction 1 1.1 Aim of the Work ................................... 2 1.2 Notation ...................................... 5 1.3 Structure ...................................... 5 2 State of the Art 6 2.1 Chemical Data ................................... 6 2.2 Prediction using Quantum Chemical Descriptors ................... 7 2.3 Test Set Design ................................... 8 2.4 Prediction using Structure-based Descriptors ..................... 10 3 Graph Kernel Methods 15 3.1 Kernels ....................................... 16 3.2 Graph Isomorphism ................................. 17 3.3 The Weisfeiler-Lehman Subtree Kernel ........................ 18 3.4 Non-linearity .................................... 21 3.4.1 Distance Kernel Function .......................... 23 3.5 Support Vector Regression Models .......................... 24 4 Graph Neural Networks 25 4.1 Basics ....................................... 25 4.2 Primary GNN .................................... 26 4.3 Graph Convolutional Layers ............................. 29 4.4 Graph Read-out ................................... 30 4.5 Network Learning .................................. 30 4.5.1 Loss Function and Back-propagation .................... 31 4.6 Network Architecture ................................ 33 5 Experiments and Results 35 vi CONTENTS 5.0.1 Evaluation Metrics in Non-linear Regression Problems ............ 36 5.1 Graph Kernel Methods ............................... 37 5.1.1 Non-linear Kernels Hyperparameters .................... 37 5.1.2 Support Vector Regression Hyperparameters ................ 38 5.1.3 Analysis of Kernels Hyperparameters .................... 39 5.1.4 Training Results .............................. 39 5.1.5 Test Results ................................ 41 5.2 Graph Neural Networks ............................... 44 5.2.1 Hyperparameter Optimisation ........................ 45 5.2.2 Training .................................. 45 5.2.3 Hyperparameters on the Test Set ...................... 46 5.2.4 Results ................................... 52 5.3 Methods Comparison ................................ 57 6 Conclusion 59 6.1 Future Work .................................... 60 Bibliography 62 vii Chapter 2 State of the Art As noted in the previous sections, the prediction of chemical reactions has been subject of several studies. These studies aim to develop new techniques that support the pharmaceutical industry and, consequently, help promote better health worldwide. In particular, the two preliminary investigations that form the foundation for this thesis are: Predicting reaction performance in C–N cross-coupling using machine learning [Doyle et al. (2018)], and Kernel methods for predicting yields of chemical reactions [Haywood et al. (2021)]. 2.1 Chemical Data The research of Doyle et al. (2018) aimed at predicting the performance of reactions in multidimensional chemical space through data collected via high-throughput experimentation. They chose the palladiumcatalysed Buchwald-Hartwig cross-coupling reaction as the test reaction because, according to Ruiz-Castillo and Buchwald (2016), it is a reaction with significant influence on pharmaceutical synthesis. One limitation when applying this reaction is the low performance of isoxazoles [Vitaku et al. (2014)]. Thus, they explored the use of ML to predict the Buchwald-Hartwig reaction performance in the presence of isoxazoles. They conducted the coupling reactions using an ultra-high-throughput setup [Buitrago Santanilla et al. (2015)]. This setup reached a total of 4608 reactions through three plates consisting of a full matrix of 15 aryl and heteroaryl halides, 4 Buchwald ligands, 3 bases, and 23 isoxazole additives. As output of the models, they used the yields of the mentioned reactions. These were the foundations for the dataset that Doyle et al. (2018) created, which is the basis for this project development. The reactions originated 4599 data points (excluding NaN yields). The data points were initially clustered in a dataset with 16 features: plate, row and column of the reaction; characteristics of each compound with SMILES representation [Weininger (1988)]; the reaction product and the related reaction yield. 6 CHAPTER 2. STATE OF THE ART 2.2 Prediction using Quantum Chemical Descriptors Traditionally, in reaction prediction projects, models were based on linear [Draper and Smith (1998)], multivariate linear or polynomial regressions [Bess (2014)]. In these models, the selection of chemical descriptors was typically made through principal component analysis to reduce the frequently extensive parameter set to a sustainable number for the algorithm execution [Shahlaei (2013)]. Other ML approaches accept multiple input descriptors without demanding dimensionality reduction and use functions with higher flexibility to find patterns in data. Therefore, Doyle et al. (2018) sought to investigate different ML approaches to solve this chemical problem, avoiding the requirement of selecting relevant descriptors for large and multidimensional datasets. In this chemical problem, ML models require a collection of descriptors that appropriately describes the variations between the reactions without resorting to a particular hypothesis. Doyle et al. (2018) produced software to extract molecular, atomic, and vibrational properties. In total, 120 descriptors were extracted through the software to characterise each reaction. Some examples are additive electronegativity, aryl halide dipole moment, base hardness, and ligand electrostatic charge. Using these chemical data, they evaluated the accuracy of a collection of ML methods through a split of 70% of the data for training and 30% for testing (Figure 2.1). For the linear regression models, they evaluated dimension reduction by removing correlated descriptors and using regularisation methods, but none showed a prime prediction. They verified that 𝑘-nearest neighbours, support vector machines, and a Bayes generalised linear model did not improve over a linear regression model. Nevertheless, a single hidden layer neural network showed a significant increase over these methods. Furthermore, they discovered that the random forest algorithm produced even better predictions. Random forest algorithms produce a prediction based on the combination of decision trees built on random samples of the given data [Breiman (2001)]. Doyle et al. (2018) concluded that by combining many low-precision models, the algorithm provided great accuracy without overfitting the training data. Although these results were promising, they observed that ML faces limitations when considerably diverse reaction conditions are employed in the test set. This problem is intensified by activity cliffs, which are areas in the reaction space where simple variations in the chemical structure can guide to significant variations in the reaction result [Cruz-Monteagudo et al. (2014)]. One method to improve the extrapolative ability of a model is to change the distribution of training data to spread out over the chemical space of interest. Performing prediction under sparsity effectively improves the reaction space that can be examined with an equal number of experiments. In this new training method, the random forest model continued to perform significantly better than the other methods. After obtaining these results, Doyle et al. (2018) continued to explore the chemical descriptors by checking the precision of the random forest to predict yields of reactions containing additives that were not included in the training set. Thus, they performed out-of-sample prediction based on fifteen training additives with sufficient information to predict the outcomes among eight different additives. On average, they obtained an RMSE of 11.3% and an R2of 0.83. It was a worse result compared to the in-sample 7 CHAPTER 2. STATE OF THE ART Figure 2.1: Test set plots for the considered ML algorithms [Doyle et al. (2018)]. additive prediction since, in this test set, some additives were not included in the training. Nevertheless, it was a promising result considering that, using this method, ML could predict the influence of a new additive or aryl halide structure on the outcome of a reaction and identify the mixture of base and ligand that provides the highest yield. 2.3 Test Set Design Regarding the test set design, Chuang and Keiser (2018) noted that alternative splits on the data resulted in much lower performance, implying limitations on the random forest model based on quantum chemical descriptors presented by Doyle et al. (2018). Chuang and Keiser (2018) used one-hot representations indicating only the presence or absence of each component, and the performance was identical to each model (presented by Doyle et al. (2018)). ML algorithms trained on one-hot representations learn simply from the presence or absence of additives in the training set, and they proposed to prove that the models could not generalise to new additives. To explain the problem in sampling, they completed analyses on the plates that had not been presented in [Doyle et al. (2018)] and stated worse results (Figure 2.2). In the end, Chuang and Keiser (2018) postulated that the ML algorithms learned patterns within the underlying empirical design rather than exploiting meaningful chemical information. In response to this, Estrada et al. (2018) noted that Chuang and Keiser (2018) did not consider the chemistry underlying the dataset, meaning that they could not perform reliable predictions for new chemical substances not present in training. Then, Estrada et al. (2018) identified that the problem with the 8 CHAPTER 2. STATE OF THE ART Figure 2.2: Out-of-sample performance on individual plate predictions [Chuang and Keiser (2018)]. splits on Chuang and Keiser (2018) was the not use of considerable variation in model performance over the different plate test sets. When performing these tests, it should be ensured that the training sets of the models cover a similar scope in chemical space (Figure 2.3A). To observe these differences, they replaced additive 13 with 2, and the results were, in fact, contradictory (Figure 2.3B). Estrada et al. (2018) confirmed that their original out-of-sample test set was ineffective in identifying non-generalisable models, even though it represented a good generalisability of the chemical descriptor model. The inefficiency happened because the test set was created primarily by average-yielding additives. With a test set composed of components reactions that the model had seen in training at least once, an ML algorithm could learn the reactivity of each component on the reaction. To better evaluate model generalisability, Estrada et al. (2018) applied activity ranking on the out-of-sample test set method, a better index of generalisation than the before used random splitting [Doyle et al. (2018)]. The mean yield of the reactions, including each additive, was ranked from lowest to highest. Test sets were built from the additives by adding every fourth molecule, and so repeatedly. The highest and lowest yielding additives were added in all training sets. In the end, there was a total of four test sets. These test sets using activity ranking ensured the model was trained on a range of reaction yields (Figure 2.3C). Using this training/test set method, they split the data into four additive out-of-sample test sets, resulting in models with an R2range of 0.69 ± 0.12. 9 CHAPTER 2. STATE OF THE ART These results confirmed that the chemical descriptor model had good generalisability along the additive dimension. Because of the updated training and testing split technique to consider activity ranking, they also created four new training and testing datasets, following the logic shown in Figure 2.3C. Figure 2.3: (A) Average yields of 180 possible reactions involving all combinations of compounds, emphasising four additives (10, 11, 13 and 14) with reaction yields considerably lower than the others, exposing their characteristic as reaction poisons. (B) The Plate 2 out-of-sample test set where they replaced additive 13 with 2, showing that the training set contained one additive that poisoned the reaction. (C) Designed test sets applying activity ranking and covering a vast chemical space [Estrada et al. (2018)]. 2.4 Prediction using Structure-based Descriptors The research of Haywood et al. (2021) addressed the application of support vector machines (SVM) in the reaction yield prediction problem through quantum chemical and structure-based descriptors, comparing both types. This investigation can be seen as an extension of the work of Doyle et al. (2018), considering that Haywood et al. (2021) used the same chemical data and fundamentals. In addition, Haywood et al. (2021) introduced a new ML algorithm to solve the problem and new methods for representing molecules at the level of structural features, something that was not investigated in Doyle et al. (2018). The choice of using SVM was due to the applicability that different types of kernels had shown in chemoinformatics problems [Ivanciuc (2007)]. On the other hand, the search for new methods of representing molecules was due to the high computational demand presented when using quantum chemical descriptors. This demand occurs because of density functional theory (DFT) calculations. Consequently, chemical descriptors did not always seem appropriate for large datasets, especially if the dataset included large molecules. In addition to the physiochemical and electronic features of molecules, Haywood et 10 CHAPTER 2. STATE OF THE ART al. (2021) noted that structural features could also be applied to solve the prediction problem. Therefore, in this investigation, they presented alternative representations based on the structure of molecules, where a wide variety of reaction components can be investigated using fewer resources. They developed three types of structure-based descriptors: molecular fingerprints, molecular graphs and one-hot encoding vectors. First, in molecular fingerprints, they tested three methods: • MACCS Keys: represent the presence or absence of predefined structural fragments [Durant et al. (2002)]; • Morgan circular fingerprints: use the radius of each atom to encode the neighbourhood within [Rogers and Hahn (2010)]; • RDK fingerprints: topological paths up to a particular path length [Landrum (2016)]. In molecular graphs, in contrast to local search in fingerprints, the global structure of the molecule is analysed. Thus, we can measure similarity between molecules and apply kernel methods, such as SVMs, to take advantage of the kernel trick, i.e., mapping the data to a high dimensional feature space and performing the regression linearly in this space [Gärtner et al. (2003)]. Lastly, one-hot encoding vectors were used as a baseline to validate model performance and expose possible irrelevant patterns in training data without chemically meaningful information. Doyle et al. (2018) stated that the random forest method outperformed the SVR in an in-sample test. Despite that, Haywood et al. (2021) examined the application of kernel methods further, building SVR models based on the above-mentioned quantum chemical descriptors, molecular fingerprints and molecular graphs. To ensure the generalisability of the models, test sets were designed through activity ranking. The data and the preparation method were the same performed by Doyle et al. (2018), using the Buchwald- Hartwig amination reaction with the same reagents and the division into three plates. However, additive seven was removed since quantum chemical descriptors could not be calculated [Doyle et al. (2018)]. After the remotion of control reactions and reactions containing additive seven, a total of 3955 reactions prevailed. The aryl halide, additive, base and ligand identification in each reaction was transformed to the SMILES (Simplified Molecular Input Line Entry Specification) format in order to describe their structure [Weininger (1988)]. The format and notation used in the different molecular descriptors for a single reaction are presented in Figure 2.4. The presented molecular descriptors were applied through the use of the SVR algorithm. The kernel functions (Table 2.1) explored were: linear, polynomial, sigmoid, Gaussian radial basis function (RBF), Tanimoto and Weisfeiler-Lehman (WL) [Shervashidze et al. (2011)]. The sigmoid kernel is not a valid kernel but has been successfully applied [Liu et al. (2008)]. The first four kernels were tested on quantum chemical descriptors, concatenated molecular fingerprints and one-hot encodings, where the format of the descriptors per reaction is a single vector (Figure 2.4). On the other side, the Tanimoto and WL kernels used molecular fingerprints and molecular graphs, which are structures with a single entity per component (Figure 2.4). The equations of kernels between two reactions (𝑥and 𝑦) are shown below in Table 2.1.To 11 CHAPTER 2. STATE OF THE ART Figure 2.4: Format and notation used in the different molecular descriptors for a single reaction [Haywood et al. (2021)]. determine the Tanimoto and Weisfeiler-Lehman kernels between two reactions (𝑥and 𝑦), the Hadamard product of reaction component kernels was considered. They reduced the similarity of the experiments to the similarity of the molecules through a product between all molecules used in each experiment, which is also a valid kernel. This is shown in Equation 2.1, where ℎ𝑖,𝑎𝑖,𝑏𝑖and 𝑙𝑖are the aryl halide, additive, base and ligand in reaction 𝑖, respectively. 𝑘(𝑥,𝑦)=𝑘#(𝑎𝑥,𝑎 𝑦)𝑘#(ℎ𝑥,ℎ𝑦)𝑘#(𝑏𝑥,𝑏𝑦)𝑘#(𝑙𝑥,𝑙𝑦)(2.1) Table 2.1: Kernel equations for reactions. Kernel Name Equation, 𝑘(𝑥,𝑦) Linear 𝑥𝑇𝑦 Polynomial (𝛾𝑥𝑇𝑦+𝑐)𝑑 Sigmoid 𝑡𝑎𝑛ℎ(𝛾𝑥𝑇𝑦+𝑐) RBF 𝑒𝑥𝑝(−𝛾&𝑥−𝑦&2) Tanimoto 𝑇𝑎𝑥,𝑎𝑦𝑇ℎ𝑥,ℎ𝑦𝑇𝑏𝑥,𝑏𝑦𝑇𝑙𝑥,𝑙𝑦 WL 𝐾𝑎𝑥,𝑎𝑦𝐾ℎ𝑥,ℎ𝑦𝐾𝑏𝑥,𝑏𝑦𝐾𝑙𝑥,𝑙𝑦 The performance of the yield prediction models built on different molecular descriptors under activity ranking test design is presented in Figure 2.5. The random forest model built in [Doyle et al. (2018)] and the models built on one-hot encodings were also included for a more extensive comparison. From the results presented, Haywood et al. (2021) drew some significant conclusions also for the production of this project. In the additive ranked test, the models learned the reactivity of the aryl halides, bases and ligands in training and predicted the yield of reactions in the test set to a relatively high level. However, in the aryl halide ranked test, the models struggled to extrapolate to new aryl halides as they had a more significant 12 CHAPTER 2. STATE OF THE ART effect on the yield reaction than the additives, bases, and ligands fitted in training. This is a relevant characteristic to consider for future tests. Regarding the molecular descriptors, the random forest showed better results on the quantum chemical descriptors than the SVR. However, the SVR learned more with structure-based descriptors (molecular fingerprints and molecular graphs) than with quantum chemical descriptors, thus enhancing the research on structure-based descriptors, one of the goals of this project. As for the comparison of kernel functions, the performance of the quantum chemical, concatenated molecular fingerprints and one-hot encoding SVR models, implementing the polynomial and RBF kernels, tended to be higher than the linear and sigmoid kernels. The WL kernel showed a result close to the best, even though it was only combined with a linear kernel function. This is a promising result since one of the main goals of the project is the combination of the WL kernel with non-linear kernels, in order to enhance the results further. For a better assessment of the test design, Haywood et al. (2021) also performed an out-of-sample prediction without activity ranking, but the results were mainly worse. Compared to the activity ranked splits, the lower performance of the tests without activity ranking implemented emphasises the importance of the test set design, as inferred before from the Chuang and Keiser (2018) and Estrada et al. (2018) papers. In order to draw more conclusions regarding the prediction performance, they linked the metrics (RMSE and R2) with the similarity to training data. This correlation helps to identify molecules that might be outside the applicability domain. Maximum similarity to training is defined as the maximum product of pairwise Tanimoto scores (between molecules in the reaction components’ training and test sets). They concluded that, overall, the performance of the models improves with maximum similarity to training as expected, considering the increase of training data. To validate the generalisability of the SVR models, Haywood et al. (2021) collected a new set of prospective combinatorial reactions, particularly along the aryl halide dimension, and tested the models. They generated all possible combinations of 59 aryl halides, three bases, four catalyst ligands, and two additives that produced 1416 proposed reactions (data points). Five of the aryl halides were present in the Doyle et al. (2018) dataset and were used as standards. The remaining aryl halides covered other comprehensive chemical features, as well as the remaining components. They designed tests to study the predictive ability of the SVR models identified as the top descriptor-kernel combinations in the aryl halide ranked test, considering a subset of the proposed reactions to compare the quantum chemical descriptors with the structure-based descriptors. They concluded that the structure-based models showed more consistency than the quantum chemical models when extrapolating to new chemical entities. In the end, Haywood et al. (2021) presented metrics related to each of the molecular descriptors (Figure 2.6). They concluded that the models built on structure-based descriptors (molecular fingerprints and graphs) demonstrated reliable prediction statistics and outperformed the quantum chemical models. Overall, the results showed the applicability of the structure-based SVR models to predicting reaction yields. 13 CHAPTER 2. STATE OF THE ART Figure 2.5: Mean performance statistics for the reaction yield prediction models using activity ranking on the train-test split. R2and RMSE reported in the format ”mean (standard deviation)”[Haywood et al. (2021)]. Figure 2.6: Comparison of the molecular descriptors. Speed and generalisability are ranked from poor (+) to good (++++) [Haywood et al. (2021)]. 14 Chapter 3 Graph Kernel Methods Data represents events and entities worldwide and have gained more importance in general, whether in research or business. Analysing and understanding data requires machine learning algorithms that can handle large-scale datasets, and the same holds for the specific case of graph data [Shervashidze et al. (2011)]. Graphs are mathematical structures used to represent pairwise relations between objects, e.g., molecules. In general, graph tasks are based on [Hamilton (2020)]: •node prediction, where our goal is to determine labelling of nodes learning from their neighbours; •link prediction, where we try to predict the existence of a relationship between two nodes; or •graph prediction, where our goal is to make predictions in one graph by learning from other graphs. To obtain information about the graph, we can explore it at node or graph level. Regarding node-level, it is possible to obtain: possible features associated with a node; degree of a node, in which the number of edges that affect the node is counted; node centrality, which measures the importance of a node in a graph, taking into account, for example, probability of a node being visited on a random walk; and the clustering coefficient, which measures the cluster size relative to the neighbours of a node. On the other side, graph-level features have a global view of the graph. For extracting graph-level features, graph kernel methods [Nikolentzos et al. (2019)] are widely used. In our reaction yield prediction problem, molecules are analysed globally because we have all the graph information, and we want to predict reaction yields of new molecules (products) generated from known molecules (reagents). Therefore, graph kernels are the main focus of this chapter. 15 CHAPTER 3. GRAPH KERNEL METHODS Table 3.1: Non-linear kernel equations applied in the obtained similarity matrix 𝑘of each type of molecule. Kernel Name Equation, 𝑘(𝑥,𝑦) Polynomial (𝛾𝑥𝑇𝑦+𝑐)𝑑 Sigmoid Logistic 1 1+𝑒𝑥𝑝(−𝛾𝑥𝑇𝑦) Sigmoid Hyperbolic Tangent 𝑡𝑎𝑛ℎ(𝛾𝑥𝑇𝑦+𝑐) Sigmoid Arctangent 𝑎𝑟𝑐𝑡𝑎𝑛(𝛾𝑥𝑇𝑦+𝑐) RBF (Gaussian) 𝑒𝑥𝑝(−𝛾&𝑥−𝑦&2) (RBF) Inverse Multiquadratic 1 "##𝑥−𝑦##2+𝑐 A polynomial function is a function such as a quadratic, a cubic, and so on, involving non-negative integer powers of 𝑥[Klamkin (1990)]. A sigmoid function (Figure 3.7) is a 0-1 bounded, differentiable, real function defined for all real values and has a non-negative derivative for every point and precisely one inflexion point [Han and Moraga (1995)]. The three types presented are popular sigmoid functions. A radial basis function (RBF) is a function on real numbers whose values depend only on the distance (usually, Euclidean) from the origin or, alternatively, on some other point 𝑐, called the center [Buhmann (2003)]. In Figure 3.8 we visualise the application of a RBF kernel, with the transformation performed on the data. Figure 3.7: A simple sigmoid function with two parameters [Leibovich-Raveh et al. (2018)]. 22 CHAPTER 3. GRAPH KERNEL METHODS Figure 3.8: Example of RBF kernel mapping data from non-linear separable space to a high-dimensional separable space [Pham (2010)]. 3.4.1 Distance Kernel Function As we can see in Table 3.1, there are some functions, e.g. polynomial and sigmoid, that directly use the similarity matrix in order to apply other mathematical operations. However, some other functions, e.g. RBF, are based on the distances between molecules. This concept is called kernel distance [Phillips and Venkatasubramanian (2011)], and it also provides a measure of comparison between molecules. Consider 𝑘:ℝ𝑑×ℝ𝑑→ℝas a similarity kernel matrix, where for any 𝑥,𝑘(𝑥,𝑥)=1. The decreasing of 𝑘(𝑥,𝑦)means that 𝑥and 𝑦are losing similarity. Inherently, the distance between 𝑥and 𝑦increases. Due to this relationship, we verify that the distance kernel matrix can be obtained from the primary similarity matrix 𝑘. As Phillips and Venkatasubramanian (2011) defined, given two objects 𝐴and 𝐵and a measure of similarity between them (𝑘(𝐴,𝐵)), the produced distance 𝐷between 𝐴and 𝐵can be determined as: 𝐷(𝐴,𝐵)=𝑘(𝐴,𝐴)+𝑘(𝐵,𝐵)−2𝑘(𝐴,𝐵).(3.5) At training time, the similarity matrix with the training data is sufficient to obtain the distance matrix with shape (n_samples_train,n_samples_train). However, taking into account that at the time of testing in 𝐷(𝐴,𝐵),𝐴represents an out-of-sample test object and 𝐵a training object, the following are necessary: the matrix similarity of the test values to themselves (usually not calculated) to obtain 𝑘(𝐴,𝐴); the training matrix to obtain 𝑘(𝐵,𝐵); and the test matrix that compares the training values to the test values 𝑘(𝐴,𝐵). Following Equation 3.5, we obtain the distance matrix 𝐷with shape (n_samples_test, n_samples_train). 23 CHAPTER 3. GRAPH KERNEL METHODS 3.5 Support Vector Regression Models After applying non-linearity to the kernel matrices, we are now able to use them in the execution of the SVR [Smola and Schölkopf (2004)]. In 𝜀-SVR, we aim to determine a function reasonably flat that, at the same time, deviates at most 𝜀from the observed variables 𝑦𝑖for all the training data. To prevent overfitting on the training data, we use a “soft margin” loss function where slack variables (𝜉) are included to concede errors larger than 𝜀. Only the points 𝑥𝑖that occur outside the 𝜀-insensitive limitation contribute to the objective function, with values of 𝜉𝑖or 𝜉∗ 𝑖. The positive hyperparameter 𝐶determines the toleration of data outside of 𝜀, thus influencing the trade-off between the function being as flat as possible and the number of tolerated deviations larger than 𝜀. Equation 3.6 describes the optimization problem that is solved during the training of the SVR. Figure 3.9 illustrates the margin selection process through a linear function, where the values are compared with the SVR margins in order to restrain the best possible function to represent the data. minimize 𝑤,𝜉,𝜉∗ 1 2&𝑤&2+𝐶 𝑛 $ 𝑖=1 (𝜉𝑖+𝜉∗ 𝑖) subject to 𝑦𝑖−𝑤𝑇𝑥𝑖≤𝜀+𝜉𝑖 𝑤𝑇𝑥𝑖−𝑦𝑖≤𝜀+𝜉∗ 𝑖 𝜉𝑖,𝜉∗ 𝑖≥0. (3.6) Figure 3.9: The soft margin loss setting for a linear SVM [Smola and Schölkopf (2004)]. 24 Chapter 4 Graph Neural Networks The availability of large-scale datasets benefits machine learning models, especially the ones based on deep learning. Deep learning has been effectively applied due to the advancement of computational resources and the high ability of models to extract latent representations from data [Wu et al. (2019)]. Chemistry is the application area of our problem, where data are molecules modelled in the form of graphs. Thus, for applying deep learning in graph-structured data, graph neural networks (GNNs) are the most known class of methods [Zhang et al. (2020)]. Using the graph structure and node information as inputs, GNNs can address different graph-related tasks, either at node, edge or graph-level. These tasks are the same as those presented for graph kernels methods (Chapter 3), only using different mechanisms we will cover below. Recall that, in our reaction yield prediction problem, molecules are analysed globally because we have all the graph information, and we want to predict reaction yields of new molecules (products) generated from known molecules (reagents). Given this, we seek a supervised-learning solution for graph-level regression. 4.1 Basics A graph neural network uses graph structure and node information to generate representations of graph data, also known as embeddings. A node hidden embedding is defined as: 𝒉(𝑘) 𝑢, where 𝑢∈𝑉is the chosen node and 𝑘is the number of iterations performed. The functioning of a GNN is based on neural message passing [Gilmer et al. (2017)], i.e. the exchange of message vectors between nodes followed by the updating of the neural network: • If iteration 𝑘=0, the embeddings are originated based on the input features of all nodes, i.e., 𝒉(0) 𝑢 =𝑙𝑢,∀𝑢∈𝑉. • If iteration 𝑘>0, 25 CHAPTER 4. GRAPH NEURAL NETWORKS 1. a node 𝑢∈𝑉aggregates the embeddings from the nodes in its neighbourhood N(𝑢); 2. then update its own hidden embedding 𝒉(𝑘) 𝑢by combining the aggregated neighbourhood embeddings (message 𝒎(𝑘) N(𝑢)) with the previous state of its embedding 𝒉(𝑘−1) 𝑢. As iterations pass, the information from the remaining graph reaches each node (Figure 4.1). After 𝑘 iterations, each node embedding contains information from its 𝑘-hop neighbourhood, which denotes the neighbourhood considered after performing 𝑘iterations. This message-passing update process can be formally defined as [Hamilton (2020)]: 𝒉(𝑘+1) 𝑢=UPDATE(𝑘)%𝒉(𝑘) 𝑢,AGGREGATE(𝑘)({𝒉(𝑘) 𝑣,∀𝑣∈N(𝑢)})& =UPDATE(𝑘)%𝒉(𝑘) 𝑢,𝒎(𝑘) N(𝑢)&, (4.1) where UPDATE and AGGREGATE are arbitrary differentiable functions. Figure 4.1: Illustration of the aggregation process on a single node (𝐴) [Hamilton (2020)]. After 𝐾iterations of the GNN message passing, for each node 𝑢∈𝑉, we can define the embeddings 𝒛𝑢(which we can see as points in a new embedded space) from the outputs of the final layer: 𝒛𝑢=𝒉(𝐾) 𝑢,∀𝑢∈𝑉.(4.2) 4.2 Primary GNN The above equations are written in a abstract way for an initial easier comprehension. To implement a GNN, we must use concrete functions on the update and aggregate operations. Hamilton (2020) defined a simplistic GNN message passing, based on the implementation of the first GNN models [Scarselli et al. (2009)], as 𝒉(𝑘+1) 𝑢=𝜎%𝑾(𝑘+1) 𝑠𝑒𝑙𝑓 𝒉(𝑘) 𝑢+𝑾(𝑘+1) 𝑛𝑒𝑖𝑔ℎ $ 𝑣∈N(𝑢) 𝒉(𝑘) 𝑣+𝒃(𝑘+1)&,(4.3) 26 CHAPTER 4. GRAPH NEURAL NETWORKS where 𝑾(𝑘) 𝑠𝑒𝑙𝑓 ,𝑾(𝑘) 𝑛𝑒𝑖𝑔ℎ ∈ℝ𝑑(𝑘)×𝑑(𝑘−1)are trainable weight matrices, 𝜎identifies an element-wise nonlinearity (e.g., sigmoid or ReLU), and 𝒃(𝑘)∈ℝ𝑑(𝑘)denotes the bias term, which is often omitted to simplify notation. We can discern both operations AGGREGATE and UPDATE in Equation 4.3. The AGGREGATE operation is the sum of the node embeddings provided from the neighbourhood, i.e., 𝒎N(𝑢)=$ 𝑣∈N(𝑢) 𝒉𝑣.(4.4) The UPDATE operation combines the aggregated neighbourhood information with the previous node embedding through a linear combination and then applies an element-wise non-linearity, i.e., 𝜎'𝑾𝑠𝑒𝑙𝑓 𝒉𝑢+𝑾𝑛𝑒𝑖𝑔ℎ𝒎N(𝑢)(.(4.5) In Equation 4.3 and related definitions, the message-passing operations are conceptualised in a nodewise formulation. However, there are many GNN models that can be defined in a graph-wise formulation. For the same implementation of the first GNN models [Scarselli et al. (2009)], we can define the model as [Hamilton (2020)]: 𝑯(𝑡)=𝜎%𝑯(𝑡−1)𝑾(𝑡) 𝑠𝑒𝑙𝑓 +𝑨𝑯 (𝑡−1)𝑾(𝑡) 𝑛𝑒𝑖𝑔ℎ&,(4.6) where 𝑯(𝑡)∈ℝ|𝑉|×𝑑denotes the matrix of activations at layer 𝑡in the GNN, with each matrix row matching a node of the graph; and 𝑨denotes the adjacency matrix that represents the graph. For a given molecule (Figure 4.2) and its respective graph (Figure 4.3), an illustration of a general GNN computation (Figure 4.4) is presented next, showing the production of node embeddings after two iterations (which results in two layers of the network). Figure 4.2: A given additive of the dataset: 5-methylisoxazole [Sigma-Aldrich (2021)]. 27 CHAPTER 4. GRAPH NEURAL NETWORKS Figure 4.3: Graph representing the given molecule. Figure 4.4: Two iterations of GNN computation for nodes 1:C and 2:O of the given molecule. Bottom-up direction. ℎ𝑥,𝑘represents a hidden embedding, where 𝑥is the node id and 𝑘is the iteration number. Final embeddings 𝑧1(for 1:C) and 𝑧2(for 2:O) obtained. 28 CHAPTER 4. GRAPH NEURAL NETWORKS 4.3 Graph Convolutional Layers The graph convolutional network (GCN), first introduced by Kipf and Welling (2016), is one of the most popular and effective [Zhang et al. (2019)] GNN models due to the applicability of graph convolutions, layers that extract high-level node representations and easily can connect with other neural networks [Wu et al. (2019)]. The main idea in graph convolutions layers is the generation of a node representation through the aggregation of its own and the neighbourhood features, using convolution and read-out operations to learn structural patterns [Wu et al. (2019)]. Compared to the above GNN models introduced by Scarselli et al. (2009), the GCN applies a more complex combination of aggregation and update methods [Kipf and Welling (2016)]. First, we explain both separately and, in the end, we connect them. Regarding the update operation, the self-loop approach simplifies the neural message passing approach (Equation 4.1) by attaching self-loops to the input graph and omitting the specific update step, as [Hamilton (2020)]: 𝒉(𝑘+1) 𝑢=AGGREGATE(𝑘)%{𝒉(𝑘) 𝑣,∀𝑣∈N(𝑢)∪{𝑢}})&,(4.7) where the aggregation also includes the node itself in the neighbourhood set. The update operation is now intrinsically defined in the aggregation operation. One of the advantages of this approach is the reduction of overfitting, as we balance the influence of the nodes. Inherently, one of the disadvantages is the difficulty of differentiating the information received from the neighbourhood from the node itself, limiting the GNN expressiveness. In the case of the primary GNN (Equation 4.6), attaching self-loops is equal to sharing parameters between the 𝑊𝑠𝑒𝑙𝑓 and 𝑊𝑛𝑒𝑖𝑔ℎ matrices, which produces the following graph-wise formulation update Hamilton (2020): 𝑯(𝑡)=𝜎%(𝑨+𝑰)𝑯(𝑡−1)𝑾(𝑡)&,(4.8) where 𝐼is the identity matrix, 𝐴+𝐼is the adjacency matrix of the considered graph with added selfconnections, and 𝑊is a trainable matrix resulting from joining 𝑊𝑠𝑒𝑙𝑓 and 𝑊𝑛𝑒𝑖𝑔ℎ. We use the identity matrix because a graph convolution based on 𝐴+𝐼is equal to aggregating features from the neighbourhood and combining them with features of the node itself. Regarding the aggregation operation, the approach is based on normalising the values received from the neighbourhood in order to not be highly sensitive to node degrees [Hamilton (2020)]. This is what happens in the primary aggregation method (Equation 4.4), where the neighbourhood embeddings are summed but not normalised. One simple approach is to perform the average instead of the sum, but Kipf and Welling (2016) went further and presented the symmetric normalisation approach, where we take into account both the number of neighbours of the chosen node and the number of neighbours of the neighbours themselves: 𝒎N(𝑢)=$ 𝑣∈N(𝑢) 𝒉𝑣 )|N(𝑢)||N(𝑣)|.(4.9) 29 CHAPTER 4. GRAPH NEURAL NETWORKS Combining both the self-loop update approach and the symmetric-normalized aggregation, Hamilton (2020) defined the message passing function of the GCN model [Kipf and Welling (2016)] as: 𝒉(𝑘+1) 𝑢=𝜎%$ 𝑣∈N(𝑢)∪{𝑢} 𝒉(𝑘) 𝑣 )|N(𝑢)||N(𝑣)| 𝑾(𝑘)&.(4.10) Equivalently, in a graph-wise formulation, Kipf and Welling (2016) defined the node representation matrix 𝑯(𝑡)in the 𝑙𝑡ℎ layer as: 𝑯(𝑡+1)=𝜎%1 )* 𝑫* 𝑨1 )* 𝑫 𝑯(𝑡)𝑾(𝑡)&,(4.11) where * 𝑨=𝑨+𝑰is the adjacency matrix of the considered graph with added self-connections, and * 𝑫𝑖𝑖 =!𝑗* 𝑨𝑖𝑗 is the degree matrix of the considered graph with added self-connections. Concisely, we can observe the notion of message passing as a simplistic form of graph convolutions connected with trainable weight matrices and non-linear functions. 4.4 Graph Read-out After creating the node embeddings based on the final layer outputs, we hold objects with a representation at the node level. Recall that, in our reaction yield prediction problem, we seek a solution at the graph level, since we want to predict reaction yields of new graphs (products) generated from known graphs (reagents). To be able to solve graph level tasks, we need to transform the obtained node embeddings into a global representation of the graph. This transformation is performed through read-out layers [Wu et al. (2019)]. As shown below, some assumptions for a graph embedding 𝒛𝐺may be based on a sum, a mean, or a maximum transformation function over the set of node embeddings {𝒛𝑢|∀𝑢∈𝑉}, where the batch-wise graph-level outputs are: • Sum: 𝒛𝐺=$ 𝑢∈𝑉 𝒛𝑢(4.12) • Mean: 𝒛𝐺=!𝑢∈𝑉𝒛𝑢 |𝑉|(4.13) • Maximum: 𝒛𝐺=max 𝑢∈𝑉 𝒛𝑢(4.14) 4.5 Network Learning A neural network represents a chain of function compositions that, during training, learn to extract patterns automatically from an input data sample [Rojas (1996)]. The learning problem involves finding the optimal combination of weights that approximates the network as close as possible to a given distribution. In the 30 CHAPTER 4. GRAPH NEURAL NETWORKS forward propagation, the representation of the data becomes gradually more similar to the actual values. More precisely, we aim to minimize the error of the network through a loss function, in order to be able to predict unseen values afterwards. Thus, we need a final trained value that can be compared to the actual value in a loss function. At this point, we keep a global graph representation for each molecule based on the read-out of the node embeddings. In our reaction yield prediction problem, the supervised data are reaction yields and the studied chemical reaction contains four types of reagents. Therefore, we need a combination that summarizes the four output reagents in order to compare the trained value (yield of the experiment) with the actual value, such as: 𝑌𝑖𝑒𝑙𝑑𝑒𝑥𝑝𝑒𝑟𝑖𝑚𝑒𝑛𝑡 =𝑂𝑎𝑑𝑑𝑖𝑡𝑖𝑣𝑒 ⊕𝑂𝑎𝑟𝑦𝑙_ℎ𝑎𝑙𝑖𝑑𝑒 ⊕𝑂𝑏𝑎𝑠𝑒 ⊕𝑂𝑙𝑖𝑔𝑎𝑛𝑑,(4.15) where 𝑥represents each reagent, 𝑂𝑥is the output produced from the GNN model for the input 𝑧𝐺𝑥, and ⊕is the operation to combine the GNN outputs. For the operation ⊕, we study three different options that we considered to be logical: • sum, where we add the outputs of four different molecules and then, comparing the value with the current target, calculate the error and perform the learning; • product, where we multiply the four values obtained in the outputs and, with the obtained value, we perform the learning; and • mean, where we calculate the average of the four outputs, compare this trained value with the target and perform the learning. The global process of combining the reagent outputs is presented in Figure 4.5. 4.5.1 Loss Function and Back-propagation The comparison between the reaction yield value obtained by the network and the actual value is performed in a previously determined loss function. In our regression problem, the loss function is the mean-squared- error (MSE). The MSE is sensitive to outliers and, given multiple inputs with the same feature values, the function returns the average target value as the optimal prediction. The MSE is the mean of the squared differences between predicted ˆ𝑦and actual 𝑦values: 𝐿(𝑦,ˆ𝑦)= 1 𝑁 𝑁 $ 𝑖=0 (𝑦−ˆ𝑦𝑖)2.(4.16) When inputs are inserted into a network, an output is produced. In the initial epochs, the output produced tends to be different from the actual target. We intend to create a learning algorithm that can produce outputs similar to the actual values and thus represent the data distribution. The comparison of these values is performed in the loss function, and, as we want them to be similar, we aim to reduce 31 CHAPTER 5. EXPERIMENTS AND RESULTS Table 5.1: Tested hyperparameters, where 𝑛≈2000 is the considered data points in each test (𝑛is not exact because it varies depending on the test performed; each test has a different number of data points because different distributions of molecules are involved in the ranked tests.). Kernel Name Hyperparameter Values Scale (𝛾) 1, 2, 5, 10 Polynomial Degree (𝑑) 2, 3, 4, 5 Sigmoid Logistic Scale (𝛾) 0.1, 1, 2, 5 Scale (𝛾) 1, 2, 5 Sigmoid Hyperbolic Tangent Bias (𝑐) 0, 0.1, 1 Scale (𝛾) 1, 2, 5 Sigmoid Arctangent Bias (𝑐) 0, 0.1, 1 RBF Scale (𝛾)1 𝑛,10 𝑛,100 𝑛,1000 𝑛,2000 𝑛,5000 𝑛,10000 𝑛,20000 𝑛 Inverse Multiquadratic Bias (𝑐) 0.1, 1, 2, 10 5.1.2 Support Vector Regression Hyperparameters After applying the non-linearity, we were then able to use the kernel matrices in the execution of the SVR [Smola and Schölkopf (2004)]. The implementation came from scikit-learn with the precomputed kernel mode, in order to use the kernel matrix generated in the previous phase. For the 𝜀hyperparameter, the following values were considered: 1, 5 and 10. The following values were considered for the positive hyperparameter 𝐶: 1, 10, 100 and 1000. These hyperparameters were optimised in scikit-learn by performing a grid-search over the above presented values, using five-fold cross-validation. The average performance statistics were compared to identify the best combination of hyperparameters from both non-linear kernel and SVR. We performed the tests for up to 6 iterations of the WL kernel, considering the aforementioned kernel functions and all hyperparameter combinations. We noticed that the correlation of values between R2and RMSE follow the same tendency; when the values are similar in R2, they are also in RMSE. Thus, we initially present the best R2for all kernel functions and the number of iterations, and, at the end, present the RMSE for the best combinations in order to confirm the reliability of the metrics. 38 CHAPTER 5. EXPERIMENTS AND RESULTS 5.1.3 Analysis of Kernels Hyperparameters The choice of hyperparameters took into account the results at the training time, but mainly at the test time. The values at the test time are the most important as these are the ones that show whether the models are generalising well to unseen values. Our goal was to enhance these values. In Figure 5.1, we show a study of the influence of the hyperparameter 𝛾on the R2evaluation metric for the RBF function, both in training and test moment. The training line shows us that we are learning more and more with the increase of the hyperparameter. However, from the 5000 𝑛value, it is possible to verify overfitting to the training data, as the evaluation metric in the test data starts to drop distinctly. Thus, the best hyperparameter to ensure the generalisation of the model based on the RBF function, in the additive split with a number of iterations equal to 5, is 5000 𝑛. Nevertheless, the range of values was maintained because there were different conditions on other tests. For example, there were more favourable combinations for another number of iterations, and these had to be included so as not to limit the search space. Figure 5.1: Coefficient of determination (R2) vs Scale (𝛾) on the RBF hyperparameter optimization (Additive split with number of iterations = 5). 5.1.4 Training Results Before we present the statistics based on the test data, we present the statistics on the training data. With this, we aim to analyse the fit of the models to the data depending on the kernel functions and the number of iterations. For each combination of kernel function with number of iterations, in training, we show the coefficient of determination (R2): Table 5.2 (Additive split) and Table 5.3 (Aryl halide split). 39 CHAPTER 5. EXPERIMENTS AND RESULTS We verify an improvement in R2with the increasing of iterations for all functions. This improvement is anticipated as, with increasing iterations in the WL kernel, we are aggregating more information about our neighbourhood and fitting more to the embedded training data. Thus, the shown results confirm the concept of neighbourhood in the WL kernel. At this training stage, some functions appear to be better than others due to higher values. However, this does not imply that we would have better results on the test data since, in such high values, the models are likely overfitting the training data. By increasing the overfitting to training data, we decrease the generalisation of the model to previously unseen data, which is the opposite of what we intended. To obtain models that better generalise the data, we must analyse the results based on the test data. Table 5.2: Additive split: Training Mean performance R2for the reaction yield prediction models using activity ranking on the train-test split. Kernel Function / Iterations 23456 Linear 0.856 0.954 0.975 0.988 0.994 Polynomial 0.989 0.999 0.999 0.999 0.999 Sigmoid Logistic 0.701 0.875 0.927 0.940 0.950 Sigmoid Hyperbolic Tangent 0.657 0.729 0.929 0.942 0.962 Sigmoid Arctangent 0.683 0.905 0.936 0.959 0.979 RBF 0.804 0.938 0.991 0.998 0.999 Inverse Multiquadratic 0.989 0.999 0.999 0.999 0.999 Table 5.3: Aryl halide split: Training Mean performance R2for the reaction yield prediction models using activity ranking on the train-test split. Kernel Function / Iterations 23456 Linear 0.869 0.933 0.956 0.965 0.989 Polynomial 0.980 0.999 0.999 0.999 0.999 Sigmoid Logistic 0.709 0.894 0.911 0.921 0.944 Sigmoid Hyperbolic Tangent 0.667 0.819 0.925 0.922 0.949 Sigmoid Arctangent 0.692 0.902 0.918 0.933 0.976 RBF 0.807 0.949 0.995 0.999 0.999 Inverse Multiquadratic 0.979 0.999 0.999 0.999 0.999 40 CHAPTER 5. EXPERIMENTS AND RESULTS 5.1.5 Test Results We aim to obtain the models that best generalise the data distribution. For this, we evaluate the models in previously unseen data (test data). The coefficient of determination R2for each combination of kernel function with the number of iterations is shown on Table 5.4 (Additive split) and Table 5.5 (Aryl halide split). In the presented results, there is no longer an evident improvement in R2with the increasing of iterations for all functions. For some functions, this tendency still exists, but it is no longer fully verifiable as in the training data results. In the training data, having more information about the neighbourhood was positive because it provided more data to fit the model. However, in test data, the increasing of iterations can be a detrimental factor because we may be overfitting in higher levels of the neighbourhood and, consecutively, losing generalisation on the model. Therefore, we select the number of WL graph kernel iterations as the principal study factor because this value means the number of hops made in the neighbourhood, which is an interesting measure to see how much data we require to achieve the best possible prediction. In the case of the additive split, the best values increased slightly with increasing iterations. The best result happened for the sigmoid arctangent function with five iterations, with a value of 0.676, slightly higher than the 0.67 presented in the baseline. The hyperparameters that produced the sigmoid arctangent result were: scale = 1; bias = 1. The obtained results are similar. Therefore, in the additive split case, the non-linear functions failed to make a notable improvement. In the tests presented earlier for the training data, the sigmoid arctangent was regularly one of the functions that gave lower results. The best result on the test data can be explained due to a suitable generalisation of the function for this specific data. Furthermore, remark a significant improvement when only two iterations were performed, in which the polynomial function managed to present a value of 0.653 against 0.589 of the linear function. This case shows the ability of a non-linear function to separate data more effectively than a linear separation. It can be an interesting solution for a situation where a faster execution is sought, as instead of performing five iterations, only two iterations are performed. In the case of the aryl halide split, the best values went down with increasing iterations. This may mean that aggregating more information from the neighbourhood (increasing iterations on the WL graph kernel) is not an advantage for the generalisation of the model. The evaluation in the training data showed improvement with increasing iterations, but the tendency on the test data was the opposite. The best result happened for the polynomial function with two iterations, with a value of 0.707, higher than the 0.659 presented by the linear function in the same conditions and considerably higher than the 0.61 presented in the baseline for five iterations. This result shows that the SVR performing a separation of the data using a polynomial function is more effective than performing a linear separation. This occurs because the considered data has a higher level of complexity, which a polynomial function can separate more effectively than a linear function due to its also higher complexity (hyperparameters: scale = 2; degree = 4; bias = 0). For five iterations, as in the baseline, we could also find better results, highlighting the inverse multiquadratic function with a value of 0.643, slightly higher than 0.61 from the baseline. Therefore, in the aryl halide split case, the non-linear functions achieved a significant improvement. 41 CHAPTER 5. EXPERIMENTS AND RESULTS Table 5.4: Additive split: Test Mean performance R2for the reaction yield prediction models using activity ranking on the train-test split. The best values for each number of iterations are shown in bold. Kernel Function / Iterations 2 3 4 5 6 Linear 0.589 0.652 0.669 0.670 0.672 Polynomial 0.653 0.665 0.663 0.659 0.652 Sigmoid Logistic 0.544 0.641 0.658 0.667 0.673 Sigmoid Hyperbolic Tangent 0.530 0.559 0.659 0.672 0.670 Sigmoid Arctangent 0.546 0.630 0.663 0.676 0.675 RBF 0.476 0.467 0.552 0.638 0.664 Inverse Multiquadratic 0.601 0.622 0.606 0.652 0.668 Table 5.5: Aryl halide split: Test Mean performance R2for the reaction yield prediction models using activity ranking on the train-test split. The best values for each number of iterations are shown in bold. Kernel Function / Iterations 2 3 4 5 6 Linear 0.659 0.657 0.650 0.623 0.598 Polynomial 0.707 0.673 0.615 0.563 0.518 Sigmoid Logistic 0.604 0.639 0.643 0.639 0.628 Sigmoid Hyperbolic Tangent 0.545 0.535 0.637 0.633 0.630 Sigmoid Arctangent 0.563 0.552 0.639 0.635 0.641 RBF 0.468 0.424 0.504 0.575 0.644 Inverse Multiquadratic 0.539 0.428 0.394 0.643 0.624 In order to have another method of comparison between the tested kernel functions and the number of iterations (𝑘) of the WL graph kernel performed (the 𝑘-hop neighbourhood considered), we present Table 5.6 and Table 5.7. In these tables, we organise the results from best to worst based on R2, for each number of iterations. We also present the RMSE to support the evaluation. In the case of the additive split, we notice a similarity between the values obtained regardless of the number of iterations performed. The linear separation for the WL graph kernel with a 4-hop neighbourhood shows similar values with the other cases that use non-linear kernels. This indicates that the additive molecular data is not complex at the level that non-linear kernels functions apply their abilities and outperform the linear kernel. 42 CHAPTER 5. EXPERIMENTS AND RESULTS In the case of aryl halide, we see a strong tendency for values to be better with the decrease in the number of iterations 𝑘performed, which means that low values of 𝑘-hop neighbourhoods are better for a suitable generalisation of the model. We can perceive the abilities of non-linear kernels in the aryl halide molecular data, as the values show a considerable improvement compared to the linear kernel. This happens because the data has a complexity that non-linear functions can adjust and inherently, a complexity that a linear function cannot effectively separate. Table 5.6: Additive split: Test Mean and Standard Deviation performance on R2and RMSE for the best reaction yield prediction models, for each number of iterations (sorted by best performance). Iterations Best Kernel Function R2RMSE (%) 5 Sigmoid Arctangent 0.676 (0.16) 15.23 (3.71) 6 Sigmoid Arctangent 0.675 (0.15) 15.26 (3.54) Baseline (5) Linear 0.67 (0.18) 15.3 (4.2) 4 Linear 0.669 (0.18) 15.30 (4.17) 3 Polynomial 0.665 (0.18) 15.39 (4.15) 2 Polynomial 0.653 (0.14) 15.83 (3.19) Table 5.7: Aryl halide split: Test Mean and Standard Deviation performance on R2and RMSE for the best reaction yield prediction models, for each number of iterations (sorted by best performance). Iterations Best Kernel Function R2RMSE (%) 2 Polynomial 0.707 (0.04) 14.05 (1.00) 3 Polynomial 0.673 (0.03) 14.86 (0.68) 4 Linear 0.650 (0.05) 15.35 (1.03) 6 RBF 0.644 (0.03) 15.50 (0.76) 5 Inverse Multiquadratic 0.643 (0.04) 15.52 (1.06) Baseline (5) Linear 0.61 (0.08) 16.2 (1.7) 43 CHAPTER 5. EXPERIMENTS AND RESULTS 5.2 Graph Neural Networks Before using the GNN models, it is important to note how the dataset is prepared to benefit from the deep learning techniques. Doyle et al. (2018)’s original dataset provided the reactions performed. These reactions include the four types of reagents. For each of these reagents, there is a SMILES representation [Weininger (1988)]. Since our solution is based on the structures of molecules, we transform these SMILES representations into Python graph objects. These objects are original from the NetworkX library, where we include a structural representation of the molecule, as well as features from the atoms and edges present in it. Each reaction is then a combination of reagents with its NetworkX representation and the corresponding yield. After obtaining these objects, we go one by one to transform them into tensors that GNN models can interpret. The library used to develop these deep learning techniques was PyTorch, with solid support from its extension PyTorch Geometric, a geometric deep learning library that focuses on the design of deep learning methods on graphs and other irregular structures. In graph kernel methods, we analysed each type of molecule among itself, obtained similarities, then combined this similarity measure developed for each of the four types and, finally, compared it with the target value of the reaction. In GNNs, the data is organised differently and we extract patterns from each combination of the four types together. Each record is directly analysed with the four reagents and the target value, without an individual analysis for each type. Therefore, in this environment, for each reagent, we use its NetworkX representation to define a node feature matrix and a collection of edges representing the graph connectivity in COO (Coordinate) format. Also, in the record of these four molecules, we add the target (yield) related to that particular experiment (reaction). The node features matrix is produced from a one-hot encoder algorithm, activating the existing features in each node (getting a shape [𝑛𝑢𝑚_𝑛𝑜𝑑𝑒𝑠,𝑛𝑢𝑚_𝑛𝑜𝑑𝑒_𝑓 𝑒𝑎𝑡𝑢𝑟𝑒𝑠]). The one-hot reference used was: [O, N, C, F, S, Cl, Br, I, P], these being the possible types of atoms (Oxygen, Nitrogen, Carbon, Fluorine, Sulfur, Chlorine, Bromine, Iodine, Phosphorus) to be present in each molecule. The collection of edges is an array with shape [2,𝑛𝑢𝑚_𝑒𝑑𝑔𝑒𝑠], and the target is a scalar that, in our problem, represent the reaction yield. The last processing before training the models is separating the training and testing data into batches to take advantage of parallelisation and thus enhance the training process. In the learning moment, the network needs to calculate the gradient of the loss function for each weight and thus perform back-propagation by the chain of functions present in the network (using the chain rule of differential calculus). In our project, we handled this process through autograd, the PyTorch’s automatic differentiation engine. In this environment, all operations performed in the feed-forward moment are tracked, which makes it possible to calculate the tensor gradients when we run the network backwards to minimize the error. 44 CHAPTER 5. EXPERIMENTS AND RESULTS 5.2.1 Hyperparameter Optimisation Hyperparameters are a crucial aspect to examine as they considerably impact the effectiveness of the GNN models. Depending on the data, we searched for the best hyperparameters that enhance the models to find the optimal fit. Based on some tests, we examined some hyperparameters that produced good results for the GNN models. The number of graph convolutional layers was set up to 5 so that up to 5-hop neighbourhood features were considered. Regarding the optimizer, the Adam algorithm was applied with learning rates equal to 0.1, 0.01, and 0.001. A study of learning rates on this problem is carried out in Section 5.2.2. Regarding the optimizer, the Adam algorithm was applied. The other two hyperparameters included in the tests are the graph read-out techniques and the operations of molecules combination, with the different hypotheses addressed in Section 4.4 and 4.5, respectively. The tested hyperparameters are shown in Table 5.8. Table 5.8: Tested hyperparameters. Hyperparameter Values Number of Graph Convolutional Layers 2, 3, 4, 5 Adam Learning Rate (0.1), 0.01, 0.001 Graph Read-out Sum, Mean, Maximum Molecules Combination Sum, Product, Mean 5.2.2 Training Given the presented learning rates, we tested their impact on the network learning. In mathematical terms, we examined which length of the learning step provides the best training in these data while moving towards the minimum of the loss function. We considered 100 epochs for the comparison term. For the learning rate 0.1, the best loss values were tremendous (around 100000000), a value that expressly shows that this learning rate is not suitable for our problem. The other two learning rates (0.01 and 0.001) proved to be efficient, both reaching loss values in the order of 200 and with a tendency to continue to decline. We were able to visualize an efficient loss decrease in these, thus proving a good training performance. Figure 5.2 shows the loss values presented for the learning rates 0.01 and 0.001. Values related to learning rate 0.1 were not included in the illustrations due to their enormous magnitude that would make the lines impossible to interpret. The values in the first epoch were large: 2449.745 for the learning rate 0.01, 1101.903 for the learning rate 0.001. These values were also not included in the illustration in order not to spoil its scale. In Figure 5.2, it is possible to visualise a higher instability of the learning rate 0.01, 45 CHAPTER 5. EXPERIMENTS AND RESULTS which was expected considering that it causes a bigger step in the search for the minimum of the function, which sometimes may not be the best descent. On the other hand, we can see a more cautious descent of the learning rate 0.001, supporting the idea of smaller steps while moving towards the minimum of the function. Consequently, Figure 5.3 shows the RMSE obtained for the same training. We can visualize a decrease in the error concerning the training data, which is expected considering the decrease in the loss. As expected, the training instability at the learning rate 0.01 around epoch 70 in the loss is also noticeable in the RMSE lines. The test data shows some instability. In this particular combination of hyperparameters, for both learning rates, the best RMSE is around epoch 40. The best result halfway through the training shows that the network might be overfitting from this number of epochs onwards. At the end of the training, the chosen model always refers to the epoch that presents the best result in the test data, as this represents the model that best generalises the data. We observed that both learning rates were successful. Therefore, both were included in the experiments and tested with the other possible combinations of hyperparameters. Figure 5.2: Loss vs Epochs on the GNN training process, for learning rate 0.01 and 0.001 (additive ranking test 1; layers = 2; graph read-out = mean; molecules combination = product). 5.2.3 Hyperparameters on the Test Set Before presenting the global results on the test data, we analyse the influence of each hyperparameter. The idea is to remark beneficial patterns for applying graph neural networks in our reaction yield prediction problem. These remarks would naturally be more accurate with more tests performed. Nevertheless, we carried out this study to provide knowledge on the best performance of the models. Initially, we analyse 46 CHAPTER 5. EXPERIMENTS AND RESULTS Figure 5.3: Train RMSE and Test RMSE vs Epochs on the GNN training process, for learning rate 0.01 and 0.001 (additive ranking test 1; layers = 2; graph read-out = mean; molecules combination = product). the additive split, and then we move on to the aryl halide split. Chart types vary according to which option we considered best for drawing conclusions from the data. Additive Split Following the order presented in Table 5.8, the first hyperparameter is the number of network graph convolutional layers. We created a box plot and noticed no strong trends in the test results (Figure 5.4). The best result occurred with three layers of graph convolution, but all other combinations had a similar results distribution with four or five layers. In the opposite sense, we note a poor performance of the models with only two layers of graph convolution. Recap that the number of layers 𝑘represents the neighbourhood considered in the network, i.e., the 𝑘-hop neighbourhood. Therefore, we conclude that a 2-hop neighbourhood does not seem to obtain enough information to provide a good result in the unseen test data. The best result then occurred with three layers, i.e., considering a 3-hop neighbourhood. The next hyperparameter is the learning rate, which was already analysed but at the training data level. Here we analyse its influence on the results in the test data. In this hyperparameter, there is an evident tendency for the learning rate 0.001 to obtain the best results (Figure 5.5). Eight of the best nine results showed a learning rate 0.001. This pattern means that slower learning, i.e., smaller steps in the search for the function minimum, on these data is advantageous. On the opposite side, although the learning rate 0.01 presents satisfactory results, it also presents the worst results, which shows some instability in the learning, meaning that the step length on the optimiser may be too big for this chemical data. 47 CHAPTER 5. EXPERIMENTS AND RESULTS Table 5.9: Additive split: Test Mean and Standard Deviation performance on RMSE for the reaction yield prediction models, sorted in ascending order by the RMSE Test. †denotes the experiments trained with 200 epochs. Learning Rate Layers Read-out Combination RMSE Train (%) RMSE Test (%) 10.001 3 Max Product 13.50 (0.42) 15.13 (3.24) 2†0.001 4 Max Product 12.72 (0.47) 15.23 (2.90) 3†0.001 5 Max Product 12.71 (0.49) 15.27 (3.20) Baseline 15.3 (4.2) 4†0.001 5 Sum Product 12.69 (0.46) 15.39 (2.34) 50.001 5 Max Product 12.81 (0.49) 15.54 (3.11) 6†0.001 3 Max Product 12.79 (0.45) 15.73 (3.27) 7†0.0001 4 Sum Product 13.74 (0.55) 15.84 (2.74) 80.001 4 Sum Product 12.98 (0.58) 15.87 (3.08) 90.001 5 Sum Product 12.99 (0.63) 15.88 (3.27) 10 †0.001 4 Sum Product 12.83 (0.54) 15.90 (2.80) carry out a more careful search for the minimum when having more training time. The most successful molecule combination operation was the 𝑠𝑢𝑚 as we had previously noted; however, operation 𝑚𝑒𝑎𝑛 and 𝑝𝑟𝑜𝑑𝑢𝑐𝑡 were also noted with some interesting results when performed for 200 epochs. The number of layers needed for a good prediction appears to be from four layers. In the case of aryl halide split, there was a greater improvement with the training of 200 epochs, meaning that the fit to training data was more effective. Following the same comparison presented for additive split, there are two combinations (1 with 9; 6 with 7) in which both the 100 epochs and the 200 epochs cases are present. There is an evident greater fit to training data in the first case (1 with 9) when 200 epochs are performed. In the second case (6 with 7), this is no longer the situation, meaning that the search for the minimum function has stabilised and performing another 100 epochs was not beneficial. Overall, the results were not better than the baseline, but the graph neural networks were therefore an algorithm with a different base that was not far from the baseline results. In both test-splits, the learning rate 0.0001 was less beneficial than 0.001. All the best results were tested with 0.0001, but almost all in the top ten were still 0.001. Possibly the 0.0001 needed more epochs to achieve better results through its even smaller step lengths of the function minimum search. 54 CHAPTER 5. EXPERIMENTS AND RESULTS Table 5.10: Aryl halide split: Test Mean and Standard Deviation performance on RMSE for the reaction yield prediction models, sorted in ascending order by the RMSE Test. †denotes the experiments trained with 200 epochs. Learning Rate Layers Read-out Combination RMSE Train (%) RMSE Test (%) Baseline 16.2 (1.7) 1†0.001 4 Max Sum 14.88 (0.75) 16.60 (0.87) 20.001 5 Mean Sum 15.03 (0.50) 16.73 (1.94) 3†0.001 4 Mean Mean 15.17 (0.72) 16.92 (0.49) 4†0.001 4 Max Product 12.60 (0.45) 16.93 (5.28) 5†0.001 3 Max Sum 15.15 (0.64) 17.31 (1.64) 60.01 4 Max Sum 14.92 (0.62) 17.38 (1.59) 7†0.01 4 Max Sum 14.91 (0.72) 17.40 (2.54) 8†0.01 5 Max Mean 15.19 (0.84) 17.44 (2.33) 90.001 4 Max Sum 15.30 (0.77) 17.49 (1.81) 10 0.01 5 Max Sum 14.91 (0.62) 17.51 (3.53) Until now, we have only presented the RMSE as a measure of comparison between results, however now we also include the R2for the five best results presented in each test. This way, we also analyse the effects of the problem presented at the beginning of this Chapter in our case study. The results are presented in Table 5.11 and Table 5.12. In the additive split, we distinctly notice that R2does not follow the RMSE tendency. We also notice the large discrepancy between the GNN models and the baseline (SVR) in the R2, which is not noticeable in the RMSE. In the aryl halide split, the discrepancy is not so perceptible, but we continue to notice a slight difference between the two measures in the error growth rate. For example, from the fourth to the fifth best result, the RMSE worsens substantially, while the R2 improves slightly, which is contradictory. Overall, we confirm a higher reliability of the RMSE in our case study. R2can be used, but complemented with other metrics. 55 CHAPTER 5. EXPERIMENTS AND RESULTS Table 5.11: Additive split: Test Mean and Standard Deviation performance on R2and RMSE for the reaction yield prediction models, sorted in ascending order by the RMSE Test. †denotes the experiments trained with 200 epochs. Learning Rate Layers Read-out Combination R2Test RMSE Test (%) 10.001 3 Max Product 0.31 (0.50) 15.13 (3.24) 2†0.001 4 Max Product 0.33 (0.41) 15.23 (2.90) 3†0.001 5 Max Product 0.26 (0.55) 15.27 (3.20) Baseline (SVR) 0.67 (0.18) 15.3 (4.2) 4†0.001 5 Sum Product 0.39 (0.29) 15.39 (2.34) 50.001 5 Max Product 0.33 (0.42) 15.54 (3.11) Table 5.12: Aryl halide split: Test Mean and Standard Deviation performance on R2and RMSE for the reaction yield prediction models, sorted in ascending order by the RMSE Test. †denotes the experiments trained with 200 epochs. Learning Rate Layers Read-out Combination R2Test RMSE Test (%) Baseline (SVR) 0.61 (0.08) 16.2 (1.7) 1†0.001 4 Max Sum 0.52 (0.03) 16.60 (0.87) 20.001 5 Mean Sum 0.50 (0.08) 16.73 (1.94) 3†0.001 4 Mean Mean 0.49 (0.01) 16.92 (0.49) 4†0.001 4 Max Product 0.47 (0.30) 16.93 (5.28) 5†0.001 3 Max Sum 0.48 (0.07) 17.31 (1.64) 56 CHAPTER 5. EXPERIMENTS AND RESULTS 5.3 Methods Comparison After obtaining the results for both methods, we now compare them to evaluate the best method for each test in these chemical data, thus describing the advantages and disadvantages present in each one. In theoretical terms, graph kernel methods employ a kernel function that measures the similarity between pairs of graphs so that kernel methods can be used to solve graph tasks. On another basis, GNNs directly perform the graph task based on the extracted graph representations. Both methods embed graphs or nodes in vector spaces through a mapping function; the difference is that the graph kernel mapping is fixed, as opposed to the GNN mapping that is learnable. This learning process is dependent on the heuristic that searches the function minimum and makes the results variable even when we present the same hyperparameters combination at the beginning of the problem. The strength of GNNs is the potential they have to be much more accurate when greater amounts of data and features are introduced, which is easy to perform due to the suitable way of introducing new features in the GNNs inputs. Like any deep learning algorithm, GNNs are heavily influenced by the amount of available data, and if a larger amount of data is provided, the algorithm handles this properly, managing to generalise better on test data. For the analysis in practical terms, we gathered the three best models of each of the methods and compared them also with the baseline in Table 5.13 and Table 5.14. We use the RMSE as a comparison term, given the conclusion of higher reliability reached in the previous section. In the case of the additive split, we obtained better results than the baseline in both algorithms, with the GNN models getting slightly better results. Something that stands out directly is that the results in the training data are very different, where the SVR fits the training data much better. Despite this, there is an apparent similarity of results in the test data. This phenomenon is supported by the above-mentioned mode of operation of the methods, where the graph kernel methods measure similarity between each graph to perform a separation of the data later, while GNNs learn to represent graphs globally through feature extraction. Lastly, we note that the GNN models did not need such a significant neighbourhood consideration as the SVR to generalise well in the additive split test data. Regarding the aryl halide split, the SVR with non-linearity application presented a significant improvement concerning the baseline. On the other hand, the GNN models failed to reach the baseline values but did not get very far. Also, in this test split, we notice a much better fitting of the SVR models. Regarding the considered neighbourhood, the methods benefit differently from the aryl halide split data, in which the SVR models obtained the best results with low neighbourhood hop, unlike the GNNs that needed more information. 57 CHAPTER 5. EXPERIMENTS AND RESULTS Table 5.13: Additive split: Test Mean and Standard Deviation performance on RMSE for the top 3 SVR and GNN models, sorted in ascending order by the RMSE Test. Model Neighbourhood RMSE Train (%) RMSE Test (%) GNN 3-hop 13.50 (0.42) 15.13 (3.24) GNN 4-hop 12.72 (0.47) 15.23 (2.90) SVR 5-hop 7.64 (1.56) 15.23 (3.71) SVR 5-hop 7.64 (1.56) 15.26 (3.54) SVR 6-hop 6.08 (0.14) 15.26 (3.87) GNN 5-hop 12.71 (0.49) 15.27 (3.20) Baseline 5-hop - 15.3 (4.2) Table 5.14: Aryl halide split: Test Mean and Standard Deviation performance on RMSE for the top 3 SVR and GNN models, sorted in ascending order by the RMSE Test. Model Neighbourhood RMSE Train (%) RMSE Test (%) SVR 2-hop 3.91 (0.09) 14.05 (1.00) SVR 3-hop 3.91 (0.08) 14.86 (0.68) SVR 2-hop 10.03 (0.37) 15.19 (0.51) Baseline 5-hop - 16.2 (1.7) GNN 4-hop 14.88 (0.75) 16.60 (0.87) GNN 5-hop 15.03 (0.50) 16.73 (1.94) GNN 4-hop 15.17 (0.72) 16.92 (0.49) 58 Chapter 6 Conclusion We proposed two approaches to solve the reaction yield prediction problem. These approaches had two different algorithms as the basis of the solution: graph kernel methods and graph neural networks. The established primary focus was to ensure that the models generalise to obtain good results on new unseen experiments. This requirement was fulfilled, as the applied test design followed the criteria described in the state-of-the-art. First, we evaluated the hypothesis that non-linear functions on top of WL graph kernel feature embeddings could improve the results of the reaction yield prediction problem. This hypothesis was based on the strong possibility that the data has more complexity than a linear separation. Therefore, we applied more powerful kernel functions and analysed the results. In the case of aryl halide split, the application of non-linear functions showed a good improvement compared to the presented baseline. Due to the higher complexity of aryl halide molecular data, non-linear kernels were better at separating data than linear kernels. This application was not so advantageous in the additive split, with only a slight improvement being noted. This result indicated a limitation of the non-linear kernel functions in additive molecular data. The fact that the linear kernel was one of the best solutions showed that non-linear kernel functions could not take advantage of its higher complexity in fitting the data. Therefore, when using graph kernels to solve the reaction yield prediction problem, the best solution is applying the sigmoid arctangent function with five iterations to the additive split and applying the polynomial function with two iterations to the aryl halide split. Following, we proposed a deep learning basis to solve the reaction yield prediction problem through graph neural networks. This hypothesis emerged as an alternative due to the different base of operation compared to the state-of-the-art models and the high capacity that deep learning models have shown to extract latent data representations. Thus, we designed the algorithm to solve our problem based on graph convolutional layers, a range of graph read-out methods, and a collection of different operations to combine molecules that consequently represent the chemical reaction. We then analysed the network and 59 CHAPTER 6. CONCLUSION the results obtained. In the additive split, we obtained better results than the baseline, concluding that the learning complexity of neural networks was favourable for a better prediction. Regarding the aryl halide split, the type-architecture we used did not present better results than the baseline. Therefore, it has been shown to be advantageous to create the deep learning basis to solve the reaction yield prediction problem, specifically, using graph neural networks in the additive split. As planned in the objectives, we performed a comparison between both algorithms. After an extensive exploration of hyperparameters in the experiments, the non-linearity in graph kernels proved to be the most advantageous approach, having surpassed all the state-of-the-art methods in one of the two global tests performed. The graph neural networks were not as effective, although they showed competitive results, which are important for further research in the connection of deep learning with drug discovery. Through the RMSE and R2metric values obtained in the results, we reached an unexpected problem related to the use of these metrics in non-linear regression problems, which we analysed to draw some conclusions. We demonstrated that, in our non-linear regression problem, RMSE is more reliable and that R2can be used, but never alone. When compared to the other methods of representing reaction components presented by Haywood et al. (2021) in Figure 2.5, the Morgan1 fingerprint with Tanimoto kernel in additive split continues to be the most favourable. However, in the aryl halide split, the application of non-linear functions on graphs has improved to the point of surpassing the best descriptor performed by Haywood et al. (2021), which was the Morgan1 fingerprint with RBF kernel. With this project, the best descriptor for the aryl halide split is now Graphs using the WL kernel in combination with the polynomial kernel. The better performance of graphs in the aryl halide split confirms Figure 2.6, where Haywood et al. (2021) denotes the better generalisability of the models on aryl halide data compared to additive data. Globally, we consider the analyses and improvements presented to be of significant importance, reflecting that, in drug design, small discoveries can have significant repercussions and impacts around the world. 6.1 Future Work In the graph kernel methods, there are several directions we can work to improve the performance of our solution. First, testing more kernel functions. In this project, we tested functions with different bases (Section 3.4). However, there are more kernel functions with different bases in which the investigation can continue, e.g., ANOVA [Hofmann et al. (2008)], Cauchy [Basak (2010)], and Bayesian [Alashwal et al. (2009)]. Another possible improvement is to cover more hyperparameters. The efficiency of non-linear kernels is highly dependent on the chosen hyperparameters, so testing a wider variety could produce better results. We may also increase the number of iterations. Although this increase does not prove advantageous in aryl halide split, a constant rise in the RBF is worth noting, which is the best function for six iterations. Therefore, perhaps there may be a possible improvement based on this aspect. 60 CHAPTER 6. CONCLUSION In the graph neural networks, a crucial direction for improving performance is, like any other deep learning based method, the acquisition of large volumes of data with more features. In the case of our graph neural networks implementation, the design for joining new features is straightforward, so that, in order to use the potential of neural networks, research in the area of high-throughput experimentation can significantly enhance the prediction accuracy. The established design also easily allows the addition of edge features, so adding data at this level can benefit the results. At an algorithmic level, there are other layers for data extraction that can be used, e.g. graph attention networks [Veličković et al. (2018)], where we use attention coefficients to determine how much of the neighbourhood nodes information we consider. If we hold to the graph convolutional layers, there are also other complex aggregation and update methods that can improve the neural message passing [Hamilton (2020)]. Concerning the other hyperparameters, we can increase the number of layers to verify the impact of a larger neighbourhood hop on the prediction. This increase will likely lead to the need for hardware with much more ability since neural networks present a high time-consuming computation. At the level of the graph read-out methods, other methods have been developed in the research world, such as the sort read-out method [Zhang et al. (2018)], where we sort node features in descending order based on their last feature channel. In general, the research world has been dedicated to the evolution of neural networks [Wu et al. (2019)]; therefore, new operations have emerged and can be employed in our reaction yield prediction problem. 61 Bibliography Alashwal, H., S. Deris, and R. Othman (2009). “A bayesian kernel for the prediction of protein-protein interactions.” In: World Academy of Science, Engineering and Technology, International Journal of Computer, Electrical, Automation, Control and Information Engineering 3, pp. 705–710. Babai, L. and L. Kucera (1979). “Canonical labelling of graphs in linear average time.” In: 20th Annual Symposium on Foundations of Computer Science (sfcs 1979), pp. 39–46. Basak, J. (Jan. 2010). “A Least Square Kernel Machine With Box Constraints.” In: Journal of Pattern Recogntion Research 5, pp. 38–51. Bess E. N., B. A. J. S. M. S. (2014). “Designer substrate library for quantitative, predictive modeling of reaction performance.” In: Proceedings of the National Academy of Sciences of the United States of America. Breiman, L. (Oct. 2001). “Random Forests.” In: Machine Learning 45, pp. 5–32. Buhmann, M. (July 2003). “Radial Basis Functions: Theory and Implementations.” In: Radial Basis Functions 12. Buitrago Santanilla, A., E. L. Regalado, T. Pereira, M. Shevlin, K. Bateman, L.-C. Campeau, J. Schneeweis, S. Berritt, Z.-C. Shi, P. Nantermet, Y. Liu, R. Helmy, C. J. Welch, P. Vachal, I. W. Davies, T. Cernak, and S. D. Dreher (2015). “Nanomole-scale high-throughput chemistry for the synthesis of complex molecules.” In: Science 347(6217), pp. 49–53. Cai, J.-Y., M. Fürer, and N. Immerman (1989). “An optimal lower bound on the number of variables for graph identification.” In: 30th Annual Symposium on Foundations of Computer Science, pp. 612–617. Chuang, K. V. and M. J. Keiser (2018). “Comment on “Predicting reaction performance in C–N crosscoupling using machine learning”.” In: Science 362(6416). Coley, C. W., R. Barzilay, T. S. Jaakkola, W. H. Green, and K. F. Jensen (2017). “Prediction of Organic Reaction Outcomes Using Machine Learning.” In: ACS Central Science 3(5), pp. 434–443. Coley, C., W. Jin, L. Rogers, T. F. Jamison, T. S. Jaakkola, W. H. Green, R. Barzilay, and K. F. Jensen (2019). “A graph-convolutional neural network model for the prediction of chemical reactivity.” In: Chem. Sci. 10 (2), pp. 370–377. Collins, K., T. Gensch, and F. Glorius (Sept. 2014). “ChemInform Abstract: Contemporary Screening Approaches to Reaction Discovery and Development.” In: Nature chemistry 6, pp. 859–871. 62 BIBLIOGRAPHY Cruz-Monteagudo, M., J. L. Medina-Franco, Y. Pérez-Castillo, O. Nicolotti, M. N. D. Cordeiro, and F. Borges (2014). “Activity cliffs in drug discovery: Dr Jekyll or Mr Hyde?” In: Drug Discovery Today 19(8), pp. 1069–1080. Daintith, J. (2008). A Dictionary of Chemistry. Oxford University Press. Doyle, A. G., D. T. Ahneman, J. G. Estrada, S. Lin, and S. D. Dreher (2018). “Predicting reaction performance in C–N cross-coupling using machine learning.” In: Science 360(6385), pp. 186–190. Draper, N. R. and H. Smith (1998). Applied Regression Analysis. Wiley. Durant, J. L., B. A. Leland, D. R. Henry, and J. G. Nourse (2002). “Reoptimization of MDL Keys for Use in Drug Discovery.” In: Journal of Chemical Information and Computer Sciences 42(6), pp. 1273–1280. Estrada, J. G., D. T. Ahneman, R. P. Sheridan, S. D. Dreher, and A. G. Doyle (2018). “Response to Comment on “Predicting reaction performance in C–N cross-coupling using machine learning”.” In: Science 362(6416). Gilmer, J., S. S. Schoenholz, P. F. Riley, O. Vinyals, and G. E. Dahl (2017). “Neural Message Passing for Quantum Chemistry.” In: ed. by D. Precup and Y. W. Teh. Proceedings of Machine Learning Research. PMLR: International Convention Centre. Gärtner, T. (2008). Kernels for Structured Data. World Scientific. Gärtner, T., P. Flach, and S. Wrobel (2003). “On Graph Kernels: Hardness Results and Efficient Alternatives.” In: Learning Theory and Kernel Machines. Ed. by B. Schölkopf and M. K. Warmuth. Springer Berlin Heidelberg: Berlin, Heidelberg, pp. 129–143. Hamilton, W. L. (2020). “Graph Representation Learning.” In: Synthesis Lectures on Artificial Intelligence and Machine Learning 14(3), pp. 1–159. Han, J. and C. Moraga (1995). “The influence of the sigmoid function parameters on the speed of backpropagation learning.” In: From Natural to Artificial Neural Computation. Ed. by J. Mira and F. Sandoval. Springer Berlin Heidelberg, pp. 195–201. Hastie, T., R. Tibshirani, and J. Friedman (2009). The elements of statistical learning: data mining, inference and prediction. 2nd ed. Springer. Haywood, A., J. Redshaw, M. Hanson-Heine, A. Taylor, A. Brown, A. Mason, T. Gaertner, and J. Hirst (2021). Kernel Methods for Predicting Yields of Chemical Reactions. Hofmann, T., B. Schölkopf, and A. J. Smola (2008). “Kernel methods in machine learning.” In: The Annals of Statistics 36(3). Hsieh, S.-M., C.-C. Hsu, and L.-F. Hsu (2006). “Efficient Method to Perform Isomorphism Testing of Labeled Graphs.” In: Computational Science and Its Applications - ICCSA 2006. Ed. by M. L. Gavrilova, O. Gervasi, V. Kumar, C. J. K. Tan, D. Taniar, A. Laganá, Y. Mun, and H. Choo. Springer Berlin Heidelberg, pp. 422–431. Ishida, S., K. Terayama, R. Kojima, K. Takasu, and Y. Okuno (2019). “Prediction and Interpretable Visualization of Retrosynthetic Reactions Using Graph Convolutional Networks.” In: Journal of Chemical Information and Modeling 59(12), pp. 5026–5033. 63