scieee AI-readable full text Open interactive document viewer

An automated and efficient Machine Learning framework for One-Class Classification tasks

Ferreira, Luís Fernando Faria

Abstract

The present era of Machine Learning (ML) is defined by the availability of copious amounts of data, powerful algorithms, and high-speed processing machines that enable accurate predictions. Two crucial features of modern ML applications are automation and efficiency. Automation is essential for streamlining the ML workflow, particularly for non-specialists. Because of this, the emergence of Automated Machine Learning (AutoML), which automates various components of the workflow, has gained significant attention in recent years. Efficiency plays a vital role in dealing with Big Data or hardware constraints and it is often achieved through distributed or parallel learning across multiple machines or processors. This thesis aims to contribute to the field of ML by designing and implementing an automated and efficient ML framework for One-Class Classification (OCC) tasks. A first set of initial experiments was performed to gain insights into the application of AutoML for supervised learning tasks, as well as to identify a robust and reliable evaluation method for the proposed AutoML framework. In these experiments, we defined an architecture to deal with the typical steps of the ML workflow and we performed a robust benchmark of existing AutoML frameworks. Afterwards, in a second set of experiments, we propose a novel AutoML framework (AutoOneClass) that applies a Grammatical Evolution (GE) to design and evolve different OCC ML algorithms by using both single and multi-objective optimization applied to a real-world Predictive Maintenance (PdM) dataset. Then, we proposed an improved version of the framework (AutoOC), that is exclusively focused on a multiobjective optimization. Several computational experiments were held to evaluate the effectiveness of the AutoOC framework, using eight public datasets from several domains and two distinct validation modes (unsupervised and supervised).

Full text

Universidade do Minho Escola de Engenharia Luís Fernando de Faria Ferreira An Automated and Efficient Machine Learning Framework for One-Class Classification Tasks September, 2023 UMinho | 2023 Luís Fernando de Faria Ferreira An Automated and Efficient Machine Learning Framework for One-Class Classification Tasks Universidade do Minho Escola de Engenharia Luís Fernando de Faria Ferreira An Automated and Efficient Machine Learning Framework for One-Class Classification Tasks Doctorate Thesis Doctoral Program in Information Systems and Technology Work developed under the supervision of: Professor Doctor Paulo Alexandre Ribeiro Cortez September, 2023 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 ii Acknowledgements I am deeply grateful for this opportunity of pursuing a doctoral degree and for the many individuals who have contributed to my success along the way. Through their guidance, support, and belief in my abilities, we have achieved significant milestones and made meaningful contributions to our field of study. I would like to express my sincere gratitude to Professor Paulo Cortez for his invaluable guidance, support, and encouragement throughout my PhD journey. His expertise, patience, and dedication to my academic success have been instrumental in shaping my research and professional development. This heartfelt appreciation is also extended to my dear colleagues at Centro de Computação Gráfica for their generous support, insightful discussions, and willingness to collaborate. Their contributions and expertise have been invaluable to my research, and I am grateful for the opportunities to learn and grow alongside such talented individuals. I feel fortunate to have worked with colleagues who not only possess exceptional skills and knowledge but are also outstanding individuals. I am also deeply grateful to my friends, who have been a constant source of support, laughter, and inspiration. While the pursuit of a PhD can be all-consuming, having good friends to share life’s joys and challenges with has been essential to my well-being and overall success. I would also like to express my heartfelt gratitude to my family, particularly my brother and mother, for their consistent love, support, and encouragement throughout my PhD journey. Their belief in my abilities, even during challenging times, has been an incredible source of motivation and inspiration for me, and I feel incredibly fortunate to have them in my life. Finally, I don’t have enough words (and probably never will) to thank my wife Águeda, who has been with me every step of the way throughout this journey. From boyfriend and girlfriend to now being husband and wife, she has been a constant source of love, encouragement, and support. Her understanding and her sacrifices have been instrumental and I am forever grateful for her presence in my life. I know that I could not have achieved this milestone without her by my side. I love you more than words can say and I will always cherish our journey together. ”To go wrong in one’s own way is better than to go right in someone else’s.” Fyodor Dostoevsky, Crime and Punishment iii 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. iv Abstract An Automated and Efficient Machine Learning Framework for One-Class Classification Tasks The present era of Machine Learning (ML) is defined by the availability of copious amounts of data, powerful algorithms, and high-speed processing machines that enable accurate predictions. Two crucial features of modern ML applications are automation and efficiency. Automation is essential for streamlining the ML workflow, particularly for non-specialists. Because of this, the emergence of Automated Machine Learning (AutoML), which automates various components of the workflow, has gained significant attention in recent years. Efficiency plays a vital role in dealing with Big Data or hardware constraints and it is often achieved through distributed or parallel learning across multiple machines or processors. This thesis aims to contribute to the field of ML by designing and implementing an automated and efficient ML framework for One-Class Classification (OCC) tasks. A first set of initial experiments was performed to gain insights into the application of AutoML for supervised learning tasks, as well as to identify a robust and reliable evaluation method for the proposed AutoML framework. In these experiments, we defined an architecture to deal with the typical steps of the ML workflow and we performed a robust benchmark of existing AutoML frameworks. Afterwards, in a second set of experiments, we propose a novel AutoML framework (AutoOneClass) that applies a Grammatical Evolution (GE) to design and evolve different OCC ML algorithms by using both single and multi-objective optimization applied to a real-world Predictive Maintenance (PdM) dataset. Then, we proposed an improved version of the framework (AutoOC), that is exclusively focused on a multiobjective optimization. Several computational experiments were held to evaluate the effectiveness of the AutoOC framework, using eight public datasets from several domains and two distinct validation modes (unsupervised and supervised). Keywords: Automated Machine Learning, Efficient Machine Learning, Multi-objective Optimization, One- Class Classification, Grammatical Evolution. v Resumo Um Framework de Machine Learning Automatizado e Eficiente Para Tarefas de One-Class Classification A era atual da área de Machine Learning (ML) é definida pela disponibilidade de uma vasta quantidade de dados, algoritmos poderosos, e máquinas com processamento de alta velocidade que permitem previsões precisas. Duas características cruciais nas aplicações de ML modernas são a automatização e a eficiência. A automatização é essencial para a simplificação do fluxo de trabalho de ML , particularmente para os não-especialistas. Devido a isto, o surgimento da área de Automated Machine Learning (AutoML) , que automatiza vários componentes do fluxo de trabalho, tem ganho uma atenção significativa nos últimos anos. A eficiência desempenha um papel vital para lidar com Big Data ou restrições de hardware e é frequentemente alcançada através de aprendizagem distribuída ou em paralelo, usando várias máquinas ou processadores. Esta tese visa contribuir para o campo de ML através da conceção e implementação de um framework de ML automatizado e eficiente para tarefas de One-Class Classification (OCC) . Um primeiro conjunto de experiências iniciais foi realizado para obter conhecimentos acerca da aplicação de AutoML para tarefas de aprendizagem supervisionada, bem como para identificar um método de avaliação robusto e fiável para o framework de AutoML a ser proposto. Nestas experiências, definiu-se uma arquitetura para lidar com as etapas tradicionais do fluxo de trabalho de ML e realizou-se um benchmark robusto de frameworks de AutoML existentes. Posteriormente, num segundo conjunto de experiências, propôs-se um novo framework de AutoML ( AutoOneClass ) que aplica Grammatical Evolution (GE) para criar e evoluir differentes algoritmos OCC de ML usando otimização uni e multiobjetivo aplicados a um dataset real de Manutenção Preventiva. Em seguida, propôs-se uma versão melhorada do framework ( AutoOC ), que se centra exclusivamente em otimização multiobjetivo. Várias experiências computacionais foram realizadas para avaliar a eficácia do framework AutoOC , usando oito datasets públicos de vários domínios de aplicação e dois modos de validação distintos (não supervisionado e supervisionado). Palavras-chave: Automated Machine Learning , Efficient Machine Learning , Otimização Multiobjetivo, One-Class Classification , Grammatical Evolution . vi Contents List of Figures xi List of Tables xiii Acronyms xv 1 Introduction 1 1.1 Motivation .................................... 1 1.2 Objectives .................................... 2 1.3 Research Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.4 Contributions................................... 5 1.5 ThesisOrganization................................ 7 2 Background 10 2.1 Bibliographic Search Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.2 RelevantConcepts ................................ 11 2.2.1 Machine Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.2.2 Automated Machine Learning . . . . . . . . . . . . . . . . . . . . . . . 14 2.2.3 One-Class Classification . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.2.4 Neuroevolution.............................. 19 2.2.5 Multi-objective Optimization . . . . . . . . . . . . . . . . . . . . . . . . 21 2.2.6 Evaluation Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.3 State-of-the-art Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.3.1 Distributed AutoML Applied to Risk Management . . . . . . . . . . . . . 24 2.3.2 Comparison of AutoML Tools . . . . . . . . . . . . . . . . . . . . . . . 24 2.3.3 Supervised and One-Class Classification AutoML Applied to Predictive Maintenance .................................. 25 2.3.4 Automated and Multi-objective One-Class Classification . . . . . . . . . . 27 3 Supervised Automated Machine Learning 30 vii 25 Comparison between the best AutoML results, AutoOneClass results, and human ML modeling results (expert and non-expert) for each target (best values in bold). ....... 72 26 Validation modes for AutoOC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 27 Characteristics of the base learners used by AutoOC. . . . . . . . . . . . . . . . . . 80 28 Description of the selected OpenML datasets. . . . . . . . . . . . . . . . . . . . . . 83 29 GE parameters used for the experiments. . . . . . . . . . . . . . . . . . . . . . . . 85 30 AutoOC experimental results (best values for each measure in bold)........... 86 31 Median number of individuals per base learner on the Pareto Front of the Credit Card dataset experiments. ..................................... 89 32 Comparison of AutoOC results for the Credit Card dataset using the sampling mechanism and the full dataset (best values for each measure in bold). .............. 90 33 Comparison of the best AutoOC results with a baseline IF and best OpenML public results. 91 34 Required data for each AutoOC validation mode. Adapted from Ferreira and Cortez (2023). 139 xiv Acronyms AE Autoencoder AI Artificial Intelligence ANN Artificial Neural Network API Application Programming Interface AUC Area Under the Curve AutoDL Automated Deep Learning AutoML Automated Machine Learning AutoOC Automated One-Class tool (version 2) AutoOneClass Automated One-Class tool (version 1) BIC Bayesian Information Criterion BNF Backus–Naur Form CASH Combined Algorithm Selection and Hyperparameter Optimization CCG Centro de Computação Gráfica CMMS Computerized Maintenance Management System CRISP-DM Cross-Industry Standard Process for Data Mining DL Deep Learning DSRM-IS Design Science Research Methodology for Information Systems DT Decision Tree EC Evolutionary Computation EPMQ IT Engineering - Process, Data, Maturity, and Quality GA Genetic Algorithm GBM Gradient Boosting Machine GBT Gradient-Boosted Tree GE Grammatical Evolution xv GLM Generalized Linear Model GML General Machine Learning IDF Inverse Document Frequency IF Isolation Forest IRMDA Intelligent Risk Management for the Digital Age IS Information Systems LOF Local Outlier Factor LSTM Long Short-Term Memory MAE Mean Absolute Error ML Machine Learning NAS Neural Architecture Search NE Neuroevolution NN Neural Network NSGA-II Non-dominated Sorting Genetic Algorithm II OC-SVM One-Class SVM OCC One-Class Classification PdM Predictive Maintenance pp Percentage Points RF Random Forest RMSE Root Mean Squared Error ROC Receiver Operating Characteristic SMOTE Synthetic Minority Oversampling Technique SVM Support Vector Machine VAE Variational Autoencoder XGB XGBoost xvi Chapter 1 Introduction This chapter starts by presenting the main motivation for this PhD work (Section 1.1) and the main objectives (Section 1.2). Then, it presents the adopted research methodology (Section 1.3), followed by a detailed description of the scientific contributions (Section 1.4) and the organization of this PhD thesis (Section 1.5). 1.1 Motivation Currently, there is growing success in the usage of Machine Learning (ML) algorithms in a wide range of real-world application domains. This success resulted from three important phenomena: the availability of Big Data, increase of computational power and more sophisticated learning techniques (Darwiche, 2018). When targeting a real-world application context, there are two important aspects that impact the effectiveness of the ML approach: automation and efficiency. Both these aspects are addressed in this PhD. Automation is an essential ML modeling aspect, allowing people with limited knowledge in the field to easily deal with tasks of the ML workflow. The development of a ML application includes typically several data processing steps, such as data preparation, feature engineering, algorithm selection, and hyperparameter tuning. Most of these steps require trial and error approaches, especially for non-ML experts. More experienced practitioners often use heuristics to exploit the vast dimensional space of parameters (Lin et al., 2018). With the increasing number of non-specialists working with ML (Thornton et al., 2013), in the last years there has been a focus on automating the components of the ML workflow, giving rise to the area of Automated Machine Learning (AutoML) (Guyon et al., 2019). Efficiency is another relevant aspect that is particularly useful for ML applications in the context of Big Data or when there are hardware constraints. Efficiency is often addressed by using distributed or parallel learning, making use of multiple machines or processors to process parts of the ML algorithm or the data. The fact that it is possible to adjust the number of processing units enables ML applications to surpass time and memory restrictions (Peteiro-Barral & Guijarro-Berdiñas, 2013). 1 CHAPTER 1. INTRODUCTION It is also important to mention that this PhD work was partially funded and developed within the contexts of two R&D projects, each involving a distinct real-world ML application domain: •Intelligent Risk Management for the Digital Age (IRMDA), initially approached, with a duration of 2 years and related with the telecommunications risk management domain; and •Computerized Maintenance Management System (CMMS), executed at a later stage, with a duration of around one year and related with the predictive maintenance domain. This research context naturally motivated and influenced the execution of this PhD, with several of the analyzed R&D ML requisites, datasets and tasks giving rise to research opportunities that were approached in this work. 1.2 Objectives This PhD thesis assumed an initial and more general goal that consisted in the design, development and evaluation of a novel ML framework that uses automated methods to search for computationally efficient ML models. As shown in Chapter 2, there are several recent research works that address AutoML or efficiency in ML by means of a distributed computing. However, there is scarce research that combines both automation and efficiency aspects within the scope of real-world ML applications. It should be noted that the ML field includes a diverse range of learning paradigms and tasks. Originally, this PhD was focused on a supervised learning, which is a popular learning paradigm that is highly targeted by AutoML proposals. During the execution of the PhD work, and motivated by the involvement in second R&D project (CMMS), the PhD goal was redefined towards a less studied and more specific task: One-Class Classification (OCC). Thus, the refined and more specific Research Question (RQ) of this PhD work is: How to design a framework that allows an automated and efficient development of OCC ML models? In order to answer this RQ, this PhD proposes a computationally efficient AutoML tool to automate the design of lightweight OCC ML models using a Grammatical Evolution (GE). To achieve the proposed GE framework, several intermediate objectives were addressed during the execution of this PhD, namely: • Search for state-of-the-art AutoML frameworks or open-source tools that allow an automated and efficient execution of ML algorithms (e.g., via distributed computing). • Perform a robust benchmark of existing AutoML frameworks. • Develop an initial version of a novel AutoML framework focused on OCC tasks. The main goal of the framework is to search for the best OCC ML algorithms and its associated hyperparameters, assuming a single or multi-objective search. 2 1.3. RESEARCH METHODOLOGY • Develop an improved version of the novel AutoML framework, focusing exclusively on multi-objective optimization to generate lightweight ML models. • Evaluate the proposed OCC framework, comparing the performance against existing AutoML tools, using metrics to evaluate the predictive performance and efficiency of the framework. 1.3 Research Methodology Given that this PhD results in the development of an artifact that addresses a specific problem, namely a ML framework, the adopted approach was a Design Research, namely Design Science Research Methodology for Information Systems (DSRM-IS). The DSRM-IS methodology consists of a set of principles, practices, and procedures for performing design science research in the area of Information Systems (IS). DSRM-IS (Fig. 1) includes six main activities: Problem Identification and Motivation, Define the Objectives for a Solution, Design and Development, Demonstration, Evaluation, and Communication (Peffers et al., 2008). This process is iterative, meaning that is possible to restart from a previous step until the artifact is finished. In this section, we summarize how each of these steps was applied in this PhD. Figure 1: DSRM-IS Process Model. Adapted from Peffers et al. (2008). In recent years, automation and efficiency have been increasingly considered important capabilities of real-world ML applications. With the increasing number of non-specialists working with ML (Thornton et al., 2013), automation is essential to allow people with limited knowledge in the field to easily deal with tasks of the ML workflow. AutoML aims to help solve this issue and it is particularly relevant when constant model updates are required. Efficiency is also necessary to scale ML problems when there are memory 3 CHAPTER 1. INTRODUCTION or time limitations. For example, by using multiple computers or multi-core processors in parallel, each processor can process a different portion of the data or ML algorithm. This solution allows overcoming memory and time constraints to growing data just by adding new machines or processors (Peteiro-Barral & Guijarro-Berdiñas, 2013). The first step of this PhD was the awareness of the critical importance of automation and efficiency in the field of ML. After analyzing the state-of-the-art, it became apparent that utilizing efficient AutoML algorithms could lead to significant improvements in the ML body of knowledge. This could lead to more effective decision-making and increased efficiency in various applications. Furthermore, exploring and implementing these algorithms could also contribute to the advancement of the field of ML. A solution was formulated, leading to the next step of the methodology. The main goal of the second activity of DSRM-IS is to infer the objectives of the solution from the defined problem, aiming to increase the existing body of knowledge. In this PhD, the suggested solution consisted of proposing a computationally efficient AutoML tool to automate the design of OCC ML models using a multi-objective optimization approach. Specifically, a GE algorithm was used to generate and train OCC predictive models, such as Autoencoder (AE),Isolation Forest (IF),Local Outlier Factor (LOF),One-Class SVM (OC-SVM), or Variational Autoencoder (VAE). This decision was taken based on a research gap identified in the state-of-the-art studies, showing that OCC is rarely approached by AutoML tools. The next activity consists of the development of the artifact, namely the automated and efficient OCC ML framework. In this PhD, the development was performed iteratively, by experimenting and applying different ML approaches, optimization techniques, or combinations of both. The fourth activity requires the demonstration of the use of the artifact to solve at least one of the instances of the problem. Since this PhD project had more than one task, we ensured that at least one of the tasks used real-world data involved in an R&D project, which was also used to evaluate the proposed framework. In other tasks, we focused on using open-source data from several industries and domains, to demonstrate the versatility of the proposed artifact. For the evaluation activity of DSRM-IS, different approaches were compared using several measures, such as computational effort and predictive performance. To ensure a robust and fair comparison, the best approaches were then selected and compared with relevant state-of-the-art baseline models, other AutoML tools, and also the best ML modeling as performed by humans (via the OpenML platform). A novel multi-objective AutoML method was developed, as further detailed in Chapters 4 and 5. The final activity of the DSRM-IS methodology is achieved when the evaluated artifact produces satisfactory results. In the context of this PhD project, satisfactory refers to the development of a framework that demonstrates better performance when compared to existing methods in a robust benchmark, while also meeting all established objectives. As identified by the methodology, several iterations were required until the desired level of success was achieved. Concluding remarks were then drawn, which resulted in scientific publications. Indeed, the findings of this PhD work were published in several international scientific conferences and journals, as summarized in Section 1.4. The scientific work associated with 4 1.4. CONTRIBUTIONS these articles is detailed in Sections 3.2 and 3.3 and Chapters 4 and 5. 1.4 Contributions The main goal of this thesis is to give a strong contribution to the body of knowledge in the area of ML with the design and implementation of an automated and efficient ML framework. Under this context, a collection of research papers were written during the execution of this PhD project with the goal of reaching the research objectives outlined in Section 1.2. This PhD work was partially developed under the IRMDA R&D project, with a duration of two years. The project was developed by a leading Portuguese company in the area of software and analytics. The purpose of the project was to develop a ML system to assist the company’s telecommunications clients. Both scalability and automation were central requirements of the ML system since the company had many clients with diverse amounts of data (both large or small) and that are typically non-ML experts. A ML technological architecture was proposed to identify and automate all typical tasks of a common supervised ML application, with minimum human input. Also, the architecture was developed to work within a computational cluster with several processing nodes. Nevertheless, during the project execution time, which approximately corresponded to this doctoral thesis first two years, it was not possible to execute more mature PhD tasks, such as proposing and evaluating a novel AutoML framework. Hence, we decided to start the PhD work with the exploration of existing AutoML frameworks, which is the main topic of this thesis, giving particular focus to automated and distributed ML and using three distinct datasets from a real-world domain, related to Telecom risk management. The purpose was to gain insights into the application of AutoML for supervised learning tasks, as well as to identify a robust and reliable evaluation method for the proposed AutoML framework. The PhD work developed under the IRMDA project is detailed in Chapter 3 and resulted in the following three publications, consisting of two conference papers and an invitation to an extended publication (book chapter): • Ferreira, L., Pilastri, A. L., Martins, C., Santos, P., & Cortez, P. (2020b). An Automated and Distributed Machine Learning Framework for Telecommunications Risk Management. In A. P. Rocha, L. Steels, & H. J. van den Herik (Eds.), Proceedings of the 12th International Conference on Agents and Artificial Intelligence, ICAART 2020, Volume 2, Valletta, Malta, February 22-24, 2020 (pp. 99– 107). SCITEPRESS. https://doi.org/10.5220/0008952800990107 (indexed at Scopus, Clarivate and DBLP scientific databases) • Ferreira, L., Pilastri, A. L., Martins, C., Santos, P., & Cortez, P. (2020a). A Scalable and Automated Machine Learning Framework to Support Risk Management. In A. P. Rocha, L. Steels, & H. J. van den Herik (Eds.), Agents and Artificial Intelligence, 12th International Conference, ICAART 2020, Valletta, Malta, February 22-24, 2020, Revised Selected Papers (pp. 291–307). Springer. https://doi.org/10.1007/978-3-030-71158-0_14 (indexed at Scopus) 5 CHAPTER 1. INTRODUCTION • Ferreira, L., Pilastri, A. L., Martins, C. M., Pires, P. M., & Cortez, P. (2021). A Comparison of AutoML Tools for Machine Learning, Deep Learning and XGBoost. International Joint Conference on Neural Networks, IJCNN 2021, Shenzhen, China, July 18-22, 2021 , 1–8. https://doi.org/10.1 109/IJCNN52387.2021.9534091 (indexed at Scopus, Clarivate, DBLP and IEEE Xplore; ranked CORE B 2021) The next contributions were developed under the CMMS R&D project, related to the application of ML for Predictive Maintenance (PdM). This project also had a short duration, approximately one year, which corresponded to the third year of this PhD project. Under the CMMS project, the first preliminary experiments related to a novel AutoML framework were conducted by applying a GE to design and evolve different OCC ML algorithms using both single and multi-objective searches. We first applied several state- of-the-art AutoML tools using a real-world PdM dataset. Then, we proposed Automated One-Class tool (version 1) (AutoOneClass), an AutoML framework that focuses on OCC using three algorithms: deep AEs, IF, and OC-SVM. The method used GE to optimize the search for the best OCC ML algorithm and its associated hyperparameters, assuming a single or multi-objective search. The single-objective approach only uses the predictive performance to select the best ML model, while the multi-objective variant considers two objectives simultaneously, predictive performance and training time. The proposed method also uses two validation setups: unsupervised - using unlabeled data during validation and anomaly scores to evaluate the ML models; and supervised validation - using a labeled validation set to assess model performance. This R&D project provided practical knowledge about the usage of OCC algorithms within AutoML and contributed to advancing the state-of-the-art regarding the implementation of AutoML approaches in the PdM industry. The work developed under the CMMS project is further described in Chapter 4 and resulted in two papers, consisting of one conference paper (winner of Best Paper Award) and one Q1 journal article: • Ferreira, L., Pilastri, A. L., Sousa, V., Romano, F., & Cortez, P. (2021). Prediction of Maintenance Equipment Failures Using Automated Machine Learning. Intelligent Data Engineering and Automated Learning - IDEAL 2021 - 22nd International Conference, IDEAL 2021, Manchester, UK, November 25-27, 2021, Proceedings , 13113 , 259–267. https://doi.org/10.1007/978-3-030-91 608-4_26 (indexed at Scopus and DBLP) • Ferreira, L., Pilastri, A., Romano, F., & Cortez, P. (2022). Using Supervised and One-Class Automated Machine Learning for Predictive Maintenance. Applied Soft Computing, Elsevier , 131 , 109820. https://doi.org/10.1016/j.asoc.2022.109820 (Clarivate Q1 in ”Computer Science, Artificial Intelligence”; Scimago Q1 in ”Software”) In the fourth and final year of this doctoral program, the focus was to further develop the initial version of the AutoML framework proposed in Chapter 5. This work resulted in Automated One-Class tool (version 2) (AutoOC), an improved version of the AutoOneClass method. This new contribution focused 6 1.5. THESIS ORGANIZATION exclusively on OCC ML algorithms, identified as a research gap in the previous research work since it was identified in the state-of-the-art that the vast majority of AutoML tools target a supervised learning (e.g., classification, regression) and do not handle an OCC. Moreover, this new contribution focused exclusively on a multi-objective optimization, using the Non-dominated Sorting Genetic Algorithm II (NSGAII) algorithm to maximize the predictive performance of the OCC learners while minimizing their training time. The goal was to address the efficiency part of the PhD objectives, by generating lightweight ML models, an important aspect when working with real-world Big Data. Furthermore, the proposed AutoOC adopts two computationally efficient mechanisms to speed up the overall execution time: a continuous sampling of training data and a parallel fitness evaluation by adopting multi-core processors. Several computational experiments were held to evaluate the effectiveness of AutoOC, using eight public datasets from several domains and two distinct validation modes (unsupervised and supervised). The results were compared with a baseline state-of-the-art OCC algorithm and also with public predictive results. This work is described in Chapter 5 and resulted in a paper publication in an international Q1 journal: • Ferreira, L., & Cortez, P. (2023). AutoOC: Automated Multi-objective Design of Deep Autoencoders and One-class Classifiers Using Grammatical Evolution. Applied Soft Computing , 144 , 110496. https://doi.org/10.1016/j.asoc.2023.110496 (Clarivate Q1 in ”Computer Science, Artificial Intelligence”; Scimago Q1 in ”Software”) Additionally, the work developed in Chapters 4 and 5 was adapted and released as a Python library named AutoOC, available both on GitHub1and on PyPi2. The AutoOC Python library is further described in Appendix B and resulted in a submission to an international journal: • Ferreira & Cortez, P. (2023). AutoOC: A Python Module for Automated Multi-objective One-Class Classification. Finally, it is also worth mentioning that during the PhD execution time there were some collaborative efforts with two Master of Science students and other R&D projects regarding the ML area of the IT Engineering - Process, Data, Maturity, and Quality (EPMQ)3domain of the Centro de Computação Gráfica (CCG) unit. These efforts resulted in the publication of one journal article and three conference papers that are not directly related with this PhD (e.g., involving a Federated ML) and thus are not included in this document. 1.5 Thesis Organization This thesis is divided into six chapters. Chapter 1 presents the motivation and objectives of this PhD. It also provides an overview of the adopted research strategy and details the research contributions and document 1https://pepy.tech/project/autooc 2https://pypi.org/project/autooc 3https://ccg.pt/domains/epmq-presentation/?lang=en 7 CHAPTER 2. BACKGROUND •Support Vector Machine (SVM): is a ML algorithm used for supervised learning that has a foundation in statistical learning theory (Cortes & Vapnik, 1995; Vapnik, 1998). The algorithm first transforms the data into a high-dimensional space using kernel functions (L. Wang, 2005). Then, it constructs a hyperplane that separates the support vectors of each class, in case of a classification task (Cristianini & Shawe-Taylor, 2000). Although Support Vector Machine (SVM) are mostly applied to supervised learning, there are modified versions of the algorithm to deal with unsupervised learning (e.g., Support Vector Clustering). •Neural Network (NN): also called Artificial Neural Network (ANN), is a family of ML algorithms inspired by biological neural networks that exist in the human brain (Y. Chen et al., 2019). Neural Network (NN)s can be applied to most types of learning, such as supervised learning (either classification or regression), unsupervised learning, and reinforcement learning. They are used for a variety of applications, such as image classification or speech recognition (Szegedy et al., 2014). When there is the availability of a vast amount of data and processing power, NNs can be a very effective type of algorithm (Aggarwal, 2018). In ML, a NN can be represented by groups of processing units (also called neurons) organized by layers. Each neuron is connected to other neurons of the adjacent layers and each connection carries a weight that is changed during training (B. Cheng & Titterington, 1994). The topology of a NN is related to the way the neurons are connected. In supervised learning one of the most common topologies is a fully connected NN. In these types of networks, each neuron is connected to all neurons of the next layer (Miikkulainen, 2010). Besides topology, NNs can be classified according to other characteristics, such as the direction of information flow, type of learning, and degree of supervision (Basheer & Hajmeer, 2000). After the 2010s, there was a growing rediscovery of NNs, given that several multi-layered NNs have obtained substantially better results in several world competitions (e.g., computer vision, Natural Language Processing tasks). The term DL become used to term these types of NNs, which are considered the current state-of-the-art ML methods in diverse supervised and unsupervised learning tasks (Goodfellow et al., 2016). Some common types of NNs are Multilayer Perceptrons, Radial Basis Neural Networks, Convolutional Neural Networks, AEs, and Long Short-Term Memory (LSTM) Networks. 2.2.2 Automated Machine Learning A typical ML application includes the phases of data preparation, feature engineering, feature selection, algorithm selection, and hyperparameter tuning. Most of these tasks when performed manually often become time-consuming processes. For beginners in ML, most of the phases of the typical workflow require the use of trial-and-error computer experiments to find the best configuration for a given problem. In the case of algorithm selection and hyperparameter tuning, the high number of available algorithms and hyperparameters makes the choice often based on intuition and often using pre-defined parameters. Also, most ML beginners use a trial-and-error approach to find the best configuration for a given problem. 14 2.2. RELEVANT CONCEPTS Sometimes the more experienced professionals use handmade heuristics to exploit the large space of options for algorithms and hyperparameters (Lin et al., 2018). In the last few years, there has been an attempt to automate some of the phases of the ML workflow. With the increasing number of non-specialists working with ML (Thornton et al., 2013), allowing people with more limited knowledge in the field to deal with these steps with ease is a current research interest in the ML field. To address the problem of automation in ML, the concept of AutoML arises. AutoML is a fairly recent term and therefore lacks a commonly accepted definition. Even though the concept is always related to the automation within the field of ML, different authors approach the concept in different ways. AutoML is almost always considered the automation of the modeling phase of Cross- Industry Standard Process for Data Mining (CRISP-DM), which includes algorithm selection and hyperparameter tuning. According to the definition of Feurer et al. (2015), AutoML is focused on the fundamental problems of ML of choosing the algorithm to be used in a given dataset, whether or not to preprocess its attributes and how to establish all hyperparameters. The authors define AutoML as the automatic search (without the need for human input) of a ML algorithm and respective hyperparameters, within a fixed computational effort, which includes memory usage and time limit. Other authors define AutoML as a Combined Algorithm Selection and Hyperparameter Optimization (CASH) problem (Thornton et al., 2013). Within the ChaLearn AutoML Challenge, AutoML is associated with the progressive automation of all phases of ML (Guyon et al., 2015; Guyon et al., 2016; Guyon et al., 2019). Besides algorithm selection and hyperparameter tuning, the authors include other tasks within the field of AutoML. These tasks include data loading and formatting, handling of missing data, feature extraction, matching between algorithm and problem, active learning, data splitting, selection of algorithms according to time restrictions, generating reusable workflows, meta-learning, and explanatory report generation. Other authors approach AutoML only within the domain of DL. For Jin et al. (2019), the goal of AutoML is to allow ML practitioners to automatically search for architectures and hyperparameters of DL models. The application of AutoML in the DL context is usually named Neural Architecture Search (NAS) (Elsken et al., 2019). There are few authors that use other terms for ML automation. For instance, Li and Moore (2007) use the term semi-automated ML in the context of an Internet traffic classification application. The application includes mechanisms to make the selection of the dataset features, as well as the algorithm to be used, which depends on factors such as latency and memory usage. Although there is no general definition of the term AutoML, all definitions or applications agree that AutoML is a process of automating the application of ML to real problems. All definitions set the goal of getting good and fast solutions to a problem without the need to spend time and human resources. Despite the lack of a general definition, in this PhD AutoML is addressed as the automation of one or more phases of the ML workflow. In recent years, many AutoML tools have been proposed. Here we provide a summary of the AutoML tools that have been studied and used in this PhD: 15 CHAPTER 2. BACKGROUND •Auto-Keras is an AutoML Python library based on Keras (Jin et al., 2019). It is designed to automate the construction on DL algorithms, commonly named AutoDL or Neural Architecture Search (NAS) (Elsken et al., 2019). Auto-Keras automatically tunes hyperparameters of NNs, such as the number of layers and neurons, activation functions, or dropout values. •Auto-PyTorch is another AutoDL tool, based on the PyTorch framework. Auto-PyTorch uses multifidelity optimization with portfolio construction to automate the construction of DL networks (Zimmer et al., 2021). •Auto-Sklearn is an AutoML library based on the popular Scikit-Learn framework (Pedregosa et al., 2011). It uses Bayesian optimization, meta-learning, and Ensemble Learning modules to automate algorithm selection and hyperparameter tuning (Feurer et al., 2019). •Auto-Weka is a module of WEKA, a ML tool that provides data preprocessing functions and ML algorithms that allow users to quickly compare ML models and create predictions using new data (Witten et al., 2016). Auto-Weka aims to solve the CASH problem, first established by Thornton et al. (2013). •H2O AutoML is one of the open-source modules of H2O, a ML analytics platform that uses inmemory data and implements a distributed and scalable architecture (Cook, 2016). H2O AutoML uses the H2O infrastructure to provide functions to automate algorithm selection and hyperparameter optimization. H2O AutoML runs several algorithms from H2O and several Stacked Ensembles, with subsets of the trained ML models (H2O.ai, 2021). •MLJar provides an AutoML framework that includes algorithm selection, hyperparameter tuning, feature engineering, feature selection, and Explainable AI (XAI) capabilities. From the three available modes of MLJar, in this PhD experiments we used the “Perform” mode9, since it is considered the most appropriate mode for a real-world usage (Płonska & Płonski, 2022). •PyCaret is an open-source ML Python library that automates ML workflows using low code functions. PyCaret provides an AutoML function (compare_models) to automate the choice algorithms by comparing the performance of all available algorithms (Ali, 2022). •rminer is a library for the R programming language, focused on facilitating the usage of ML algorithms (Cortez, 2010). Since version 1.4.4, rminer implements AutoML functions. In this PhD, we used the automl3 template10, which runs several ML algorithms and one Stacked Ensemble. 9https://supervised.mljar.com/features/modes/ 10https://CRAN.R-project.org/package=rminer 16 2.2. RELEVANT CONCEPTS •TPOT is a Python AutoML tool that uses Genetic Programming to automate several phases of the ML workflow, such as feature selection, feature engineering, algorithm selection, and hyperparameter tuning. It uses the Python Scikit-Learn framework to produce ML pipelines (Le et al., 2020). •TransmogrifAI is an end-to-end AutoML library that runs on top of Apache Spark. It was created to increase ML efficiency through automation and an Application Programming Interface (API) that ensures compile-time type safety, modularity, and reuse. It is written in Scala and focused on the automation of several phases of the ML workflow, such as algorithm selection, feature selection, and feature engineering (Salesforce, 2022). 2.2.3 One-Class Classification OCC can be viewed as a subclass of unsupervised learning, where the ML model only learns using training examples from a single class (Moya & Hush, 1996; Zola et al., 2021). The aim of OCC algorithms is to learn a representation of the examples from that class that allows the identification of other classes during the inference phase (Perera et al., 2021). This type of learning is valuable in diverse real-world scenarios where labeled data is non-existent, infeasible, or difficult (e.g., requiring a costly and slow manual class assignment), such as fraud detection (Seliya et al., 2021), cybersecurity (Arregoces et al., 2022), Predictive Maintenance (Ferreira et al., 2022), or industrial quality assessment (Ribeiro et al., 2022). The following five subsections describe popular OCC algorithms that have been used in this PhD. 2.2.3.1 Autoencoders Autoencoders are a type of ANN that is trained to reconstruct its input data. This is achieved by learning a compressed representation of the input data, which is then used to reconstruct the original data as closely as possible (Maleki et al., 2021). AEs are used for several applications, such as dimensionality reduction or removing noise from data. AEs can be applied to OCC scenarios, where the AE is trained with normal data and attempts to produce outputs similar to the inputs. For each input instance, there is an associated reconstruction error, where higher reconstruction errors represent a higher probability of being an anomaly (Ribeiro et al., 2022). Fig. 2 shows an example of an AE. 2.2.3.2 Isolation Forest Isolation Forest was proposed in 2008 (Liu et al., 2008) and it works by isolating “anomalies” instead of identifying “normal” instances. In order to isolate the instances, IF recursively generates partitions on the training data by randomly selecting an attribute and then selecting a split value for that attribute. This strategy is based on two main assumptions regarding anomalies: they are a minority of the data and very different from the normal instances. This way, since anomalies are few and different, they are easier to 17 CHAPTER 2. BACKGROUND Figure 2: Example of an AE. The input data is encoded into a compressed representation and then it is decoded. “isolate” compared to normal points. Fig. 3 exemplifies the IF partitioning on a dataset with two attributes. In the figure, 𝑥0is an anomaly (since it is easily isolated) and 𝑥𝑖is a normal point. Figure 3: IF partitioning: 𝑥0is an anomaly (easily isolated) and 𝑥𝑖is a normal point. Adapted from Liu et al. (2008). 2.2.3.3 Local Outlier Factor Local Outlier Factor is a density-based anomaly detection algorithm that is used to identify instances in a dataset that are significantly different from the majority of the instances. It works by calculating an anomaly score 𝑆𝑖for each instance 𝑖, which reflects the degree to which it is isolated from the rest of the examples in the dataset. LOF is particularly useful for detecting anomalies in high-dimensional datasets, as it is able to capture complex patterns in the data (Breunig et al., 2000). High LOF scores are considered to be outliers, as they are located in areas of the feature space that are less densely populated. Thus, in this work, we use the LOF 𝑆𝑖score as the anomaly degree measure. 18 2.2. RELEVANT CONCEPTS 2.2.3.4 One-Class Support Vector Machines One-Class SVM is an extension of the SVM algorithm for unlabeled data (Schölkopf et al., 2001; S. Wang et al., 2018). OC-SVM learns a decision function from the training data (composed only of normal instances) and can classify new data as similar or different than the training data. Instead of using a hyperplane to separate two classes (such as the traditional SVM), OC-SVM uses the hyperspace to include all training instances. 2.2.3.5 Variational Autoencoders Variational Autoencoders differ from traditional AEs in that they are trained to learn a distribution over the input data, rather than simply reconstructing the input data (Kingma & Welling, 2019). VAEs are composed of two parts: an encoder that maps the input data to a latent representation, and a decoder that maps the latent representation back to the original data space. The encoder and decoder are trained to optimize an objective function that encourages the generated data to be similar to the original data, while also encouraging the latent representation to be smooth and continuous. This allows VAEs to generate new data points that are similar to the original data, whereas traditional AEs are only able to reconstruct the input data. VAEs can be used for anomaly detection, since anomalies are expected to have different distributions when compared with normal training examples (Edun et al., 2022). 2.2.4 Neuroevolution Neuroevolution (NE) is a field of AI related to the generation of Artificial Neural Networks using evolutionary algorithms (Risi & Togelius, 2017). NE addresses the automation of the design of ANNs (e.g., hyperparameters, structure, weights), often finding good solutions in complex and high-dimensional neural modeling spaces while using a reasonable amount of computational resources. NE has been successfully applied to a variety of tasks, including (Baymurzina et al., 2022; Cortez et al., 2020; Floreano et al., 2008): reinforcement learning, unsupervised learning, optimization, time series forecasting, supervised learning, and DL NAS. A popular NE technique that is used in this PhD is Grammatical Evolution. GE is a biologically inspired evolutionary algorithm for generating computer programs. The algorithm was proposed by O’Neill and Ryan (2001) and has been widely used in both optimization and ML tasks. GE can handle complex optimization problems with a large number of objectives and constraints. It can also handle continuous and discrete optimization problems, as well as problems with mixed variables. Indeed, GE has been shown to be effective in finding high-quality solutions in a relatively short time, compared to other optimization methods (Nyathi & Pillay, 2018). In GE, a set of programs is represented as strings of characters, known as chromosomes. The chromosomes are encoded using a formal grammar, which defines the syntax and structure of the programs. The grammar is used to parse the chromosomes and generate the corresponding programs, which are then evaluated using a fitness function. The fitness function measures the 19 CHAPTER 2. BACKGROUND quality of the programs and is used to guide the evolution process toward better solutions. A GE execution starts by creating an initial population of solutions (usually randomly), where each solution (usually named individual) corresponds to an array of integers (or genome) that is used to generate the program (or phenotype). In the evolutionary process of GE, each generation consists of two main phases: evolution and evaluation. During the evolution phase, new solutions are generated using operations such as crossovers and mutations. Crossover involves selecting pairs of individuals as parents and swapping their genetic material to produce new individuals, known as children. Mutation, which is applied to the children individuals after crossover, consists of randomly altering their genome to maintain genetic diversity. In the evaluation phase, the population of individuals is evaluated using the fitness function. Fig. 4 represents the steps for the GE optimization process. Figure 4: Steps for the GE optimization. Adapted from Anjum and Ryan (2021). GE uses a mapping process to generate programs from a genome encoded using a formal grammar, typically in Backus–Naur Form (BNF) notation. This notation consists of terminals (items that can appear in language, such as the symbols +or −) and non-terminals (variables that include one or more terminals). An example of a BNF grammar is shown in Fig. 5. Figure 5: Example of a BNF grammar to generate strings. 20 2.2. RELEVANT CONCEPTS 2.2.5 Multi-objective Optimization Multi-objective optimization problems occur when two or more objectives are being optimized simultaneously. This is a common pattern in real-world domains, for example when a company intends to increase sales while reducing costs or maximizing the target audience while minimizing the budget. In these scenarios, typically the different objectives may conflict, where a gain in one objective might represent a loss in another one (Cortez, 2021). One of the most popular multi-objective optimization algorithms is Non-dominated Sorting Genetic Algorithm II, which is used in this PhD. The NSGA-II algorithm was proposed in 2002 (Deb et al., 2002) and is based on the concept of non-dominance, which means that a solution is considered superior to another solution if it is not worse than the other solution in any objective and strictly better in at least one objective. The goal of NSGA-II is to find a set of non-dominated solutions, known as the Pareto front, which represents the trade-off between the different objectives. One of the main features of NSGA-II is its ability to handle constraints. The algorithm handles constraints by assigning a penalty value to solutions that violate the constraints. The penalty value is then used as an additional objective, which is minimized during the optimization process. NSGA-II also includes a crowding distance measure, which is used to preserve diversity among the solutions and avoid premature convergence. The algorithm has been widely used in various fields, including engineering, economics, and biology, and has shown promising results in a variety of multi-objective optimization problems (Coello et al., 2007). Fig. 6 shows an example of a multi-objective problem with two minimizing objectives. The dark line shows the Pareto front that includes the non-dominated solutions. Figure 6: Example of a Pareto front in a multi-objective optimization problem with two minimizing objectives. 2.2.6 Evaluation Metrics When developing ML applications, one of the most important steps is the assessment of the ML models quality. Within the task of supervised learning this step is typically achieved by comparing the predictions 21 CHAPTER 2. BACKGROUND of the ML model with the ground truth, using some kind of validation setup (e.g., holdout split, k-fold cross validation) (Dalianis, 2018). To compare the predictions of the ML models and the ground truth, quantitative methods based on mathematical functions are commonly applied. These functions (also named evaluation metrics in the context of ML applications) can vary depending on the ML task (e.g., supervised or unsupervised learning) and also on the type of model (e.g., classification, regression, time series). In this PhD, most of the used evaluation metrics are based on popular supervised learning measures, which are further described in this section. For regression tasks, one of the most popular measures is Mean Absolute Error (MAE). It measures the average absolute difference between the predicted and actual values. A lower Mean Absolute Error (MAE) value indicates better model performance, as it represents the average magnitude of the errors (Hastie et al., 2009). The MAE is a common choice for regression models as it is easy to interpret (e.g., a MAE of 5 means that the average error of the model is 5 units). MAE is calculated using the following formula: 𝑀𝐴𝐸 =∑𝑛 𝑖=1|𝑦𝑖−𝑥𝑖| 𝑛 where 𝑦𝑖denotes the target values, 𝑥𝑖the predicted ones and 𝑛the number of predictions performed. Root Mean Squared Error (RMSE) is another widely used metric in ML for evaluating the performance of regression models, as it measures the square root of the average of squared differences between predicted and actual values. RMSE penalizes larger errors more heavily than smaller errors and it is commonly used when larger errors are more significant than smaller errors (Karunasingha, 2022). A lower value of RMSE indicates better model performance. It is more difficult to interpret than MAE since the errors are squared errors instead of absolute errors. However, it represents the average magnitude of the errors in the same units as the predicted and actual values. It is calculated as follows: 𝑅𝑀𝑆𝐸 =∑𝑛 𝑖=1(𝑦𝑖−𝑥𝑖)2 𝑛 The Normalized Mean Absolute Error (NMAE) is a scale independent version of MAE that shows the average error as a percentage of the response range. It is calculated using the following formula: 𝑁𝑀𝐴𝐸 =𝑀𝐴𝐸/(max(𝑦) − min(𝑦)) For binary classification tasks, one of the most used metrics is the Area Under the Curve (AUC) analysis of the Receiver Operating Characteristic (ROC) curve. The ROCcurve plots the False Positive Rate versus the True Positive Rate for all possible threshold values (𝑇ℎ ∈ [0,1]for predicted binary class probability (e.g., normalized anomaly score when assuming that a positive class is the anomaly). The predicted probability (𝑥𝑖, 𝑖 ∈ {1, ...,𝑛}) is considered a positive class if 𝑥𝑖>𝑇ℎ. The overall discrimination capability of the classifier is computed as (Fawcett, 2006): 𝐴𝑈𝐶 =∫1 0 ROC 𝑑𝑇ℎ 22 2.2. RELEVANT CONCEPTS AUC is a popular binary classification measure of performance, providing two main advantages (Coelho et al., 2022). Firstly, quality values are not influenced by the presence of unbalanced data, which occurs in OCC tasks. Secondly, the AUC values can be easily interpreted as follows: 50% – performance of a random classifier; 60% - reasonable; 70% - good; 80% - very good; 90% - excellent; and 100% - perfect. Other metrics widely used for binary classification are Accuracy, Precision, and Recall. The three metrics are based on the confusion matrix, a table that compares the actual values from each actual and predicted class (Witten et al., 2016). Accuracy measures the proportion of correctly classified instances among all instances, indicating the overall performance of the model. Precision measures the proportion of true positive predictions among all positive predictions, indicating the model ability to avoid false positives. Recall, on the other hand, measures the proportion of true positive predictions among all actual positive instances, indicating the model ability to identify all positive instances. All of these metrics are represented by a number between 0 and 1, where 1 represents a perfect classifier. These metrics can be calculate using the following formulas: 𝐴𝑐𝑐𝑢𝑟𝑎𝑐𝑦 = 𝑇𝑃 +𝑇 𝑁 𝑇𝑃 +𝐹𝑃 +𝑇 𝑁 +𝐹𝑁 𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 = 𝑇𝑃 𝑇𝑃 +𝐹𝑃 𝑅𝑒𝑐𝑎𝑙𝑙 = 𝑇𝑃 𝑇𝑃 +𝐹𝑁 where TP, FP, TN, and FN denote the number of True Positives, False Positives, True Positives, and False Negatives. The F1-score, also known as F-measure, is a harmonic mean of Precision and Recall, balancing both metrics and providing a single value that summarizes the overall performance of the model. F1-score can be used for both binary and multi-class classification and is particularly useful when the dataset is imbalanced, as it balances the contributions of Precision and Recall and penalizes extreme differences between both. A higher F1-score indicates better overall model performance, with the maximum score being 1, representing perfect precision and recall. F1-score is represented by the following formula: 𝐹1−𝑠𝑐𝑜𝑟𝑒 =2∗𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 ∗𝑅𝑒𝑐𝑎𝑙𝑙 𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 +𝑅𝑒𝑐𝑎𝑙𝑙 When multi-class classification tasks are addressed, there is possible to compute an individual F1- score for each class. To aggregate all these scores, a popular adopted measure is the Macro F1-score, which is computed as the average of all individual F1-scores. 23 Chapter 3 Supervised Automated Machine Learning This chapter presents the main methods, experiments, and results obtained related to our initial supervised AutoML experiments and is divided into four sections. First, Section 3.1 describes the research context of the experiments. Then, Section 3.2 and Section 3.3 present the experiments and results. Finally, Section 3.4 presents the main conclusions from these experiments. 3.1 Research Context This PhD thesis was partially conducted within the scope of the IRMDA R&D project. The project was undertaken by a leading Portuguese software and analytics company, spanning over a two-year period, also corresponding to the first two years of this PhD. The main objective of the project was to design a ML system to aid the company’s telecommunications customers. The system was required to be automated and scalable as the company dealt with a wide range of customers, who possessed varying data sizes (both large and small), and lacked expertise in ML. We proposed a ML technological architecture, aiming to automate all typical tasks of a standard supervised ML application, with minimal human input. Additionally, the architecture was developed to function within a computational cluster, comprising multiple processing nodes. However, given the project execution time, a novel AutoML framework that met the research objectives set for this PhD could not be proposed and evaluated within the scope of the project. As a result, we started the PhD work by exploring the existing AutoML frameworks, with a particular emphasis on automated and distributed ML, using three different datasets from the domain of Telecom risk management. The goal was to gain a deeper understanding of the application of AutoML for supervised learning tasks and to identify a robust evaluation method for the AutoML framework to be developed. The PhD work developed under the IRMDA project is detailed in this chapter and it is divided into two main research works. First, Section 3.2 describes a proposed technological architecture for telecommunications risk management that addresses the ML challenges of automation and scalability. Then, Section 3.3 presents a comparison study that considers eight recent open-source AutoML technologies (Auto-Keras, Auto-PyTorch, Auto-Sklearn, 30 3.2. A SCALABLE AND AUTOMATED MACHINE LEARNING FRAMEWORK TO SUPPORT RISK MANAGEMENT AutoGluon, H2O AutoML, rminer, TPOT, and TransmogrifAI). The work associated with this chapter resulted in three publications: two conference papers (Ferreira et al., 2020a; Ferreira, Pilastri, Martins, et al., 2021) and an invitation to an extended publication in a book chapter (Ferreira et al., 2020b). 3.2 A Scalable and Automated Machine Learning Framework to Support Risk Management 3.2.1 Introduction Nowadays, ML applications can make use of a great amount of data, complex algorithms, and machines with great processing power to produce effective predictions and forecasts (Darwiche, 2018). Currently, two of the most important features of real-world ML applications are distributed learning and AutoML. Distributed learning is particularly useful for ML applications in the context of Big Data or when there are hardware constraints. Distributed learning consists of using multiple machines or processors to process parts of the ML algorithm or parts of the data. The fact that it is possible to add new processing units enables ML applications to surpass time and memory restrictions (Peteiro-Barral & Guijarro-Berdiñas, 2013). AutoML intends to allow people that are not experts in ML to efficiently choose and apply ML algorithms. AutoML is particularly relevant since there is a growing number of non-specialists working with ML (Thornton et al., 2013). It is also important for real-world applications that require constant updates to ML models. In this work, we propose a technological architecture that addresses these two ML challenges. The architecture was adapted to the area of telecommunications risk management, which is a domain that mostly uses supervised learning algorithms (e.g., for churn prediction). Moreover, the ML models are constantly updated by people that are not experts in ML and may involve Big Data. Thus, the proposed architecture delineates a set of steps to automate the typical workflow of a ML application that uses supervised learning. The architecture includes modules for task detection, data preprocessing, feature selection, model training, and deployment. The focus of this work is the model training module of the architecture, which was designed to use a distributed AutoML tool. In order to select the ML tool for this module, we initially evaluated the characteristics of eight open-source AutoML tools (Auto-Keras, Auto-Sklearn, Auto-Weka, AutoGluon, H2O AutoML, Rminer, TPOT, and TransmogrifAI). We then performed a benchmark to compare the two tools that allowed a distributed execution (H2O AutoML and TransmogrifAI). The experiments used three real-world datasets from the domain of telecommunications. These datasets were related to churn (regression), event forecasting (time series), and fraud detection (binary classification). The section is organized as follows. In Section 3.2.2, we detail the proposed ML architecture. Next, Section 3.2.3 describes the analyzed AutoML technologies and the datasets used during the experimental 31 CHAPTER 3. SUPERVISED AUTOMATED MACHINE LEARNING tests. Then, Section 3.2.4 discusses the experimental results. Finally, Section 3.2.5 details the technological architecture. 3.2.2 Proposed Architecture This work is part of IRMDA, a R&D project developed by a leading Portuguese company in the area of software and analytics. The purpose of the project is to develop a ML system to assist the company’s telecommunications clients. Both scalability and automation are central requirements to the ML system since the company has many clients with diverse amounts of data (large or small) and that are typically non-ML experts. The ML technological architecture that is proposed by this work identifies and automates all typical tasks of a common supervised ML application, with minimum human input (only the dataset and the target column). Also, since the architecture was developed to work within a cluster with several processing nodes, the users can handle any size of datasets just by managing the number of cluster nodes. The architecture is illustrated in Fig. 7. Figure 7: The proposed automated and scalable ML architecture. 3.2.2.1 Phases The proposed architecture assumes two main phases (Fig. 7): a training phase and a testing phase. The training phase includes the creation of a pipeline instance and the definition of its stages. The only human input needed by the user is the selection of the training dataset and the identification of the target column. Depending on the dataset columns, each module defines a set of stages for the pipeline. Each stage either transforms data or also creates a model based on the training data that will be used on the test phase to transform the data. When all stages are defined, the pipeline is fitted to the training data, creating a pipeline model. Finally, the pipeline model is exported to a file. The execution of the testing pipeline assumes the same transformations that were applied to the training data. To execute the testing pipeline the user only needs to specify the test data and a pipeline model (and a forecasting horizon in the case of time series forecasting task). The last stage of the 32 3.2. A SCALABLE AND AUTOMATED MACHINE LEARNING FRAMEWORK TO SUPPORT RISK MANAGEMENT testing pipeline is the application of the best model obtained during training, generating the predictions. Performance metrics are also computed and presented to the user. 3.2.2.2 Components The proposed architecture includes five main components: task detection, data preprocessing, feature selection, model training (with the usage of AutoML), and pipeline deployment. •Machine Learning Task Detection: set to detect the ML task of the pipeline (e.g., classification, regression, time series). This detection is made by analyzing the number of levels of the target column and the existence (or not) of a time column. •Data Preprocessing: handles missing data, the encoding of categorical features, and the standardization of numerical features. The applied transformations depend on the data type of the columns, number of levels, and number of missing values. •Feature Selection: deletes features from the dataset that may decrease the predictive performance of the ML models, using filtering methods. Filtering methods are based on individual correlations between each feature and the target, removing several features that present the lowest correlations (Blum & Langley, 1997). •Model Training: automatically trains and tunes a set of ML models using a set of constraints (e.g., time limit, memory usage). The component also identifies the best model to be used on the test phase. •Pipeline Deployment: manages the saving and loading of the pipelines to and from files. This module saves the pipeline that will be used on a test set, ensuring that the new data will pass through the same transformations as the training data. Also, the component stores the best model obtained during the training to make predictions, discarding all other ML models. 3.2.3 Materials and Methods 3.2.3.1 Experimental Evaluation For the experimental evaluation, we first examined the characteristics of the open-source AutoML tools. Then, we used the tools that could be implemented in our architecture to perform a benchmark study. In order to be considered for the experimental evaluation, the tools have to implement distributed ML. 3.2.3.2 AutoML Tools We first analyzed eight recent open-source AutoML tools, to verify their compliance with the project requirements: Auto-Keras, Auto-Sklearn, Auto-Weka, AutoGluon, H2O AutoML, rminer, TPOT, and TransmogrifAI. 33 CHAPTER 3. SUPERVISED AUTOMATED MACHINE LEARNING Table 4 presents the characteristics of the analyzed AutoML related to interface language, associated platforms, current version and if it contains a Graphical User Interface and distributed ML mode. Additional information about the AutoML tools to is available in Section 2.2.2. Table 4: Main characteristics of the analyzed AutoML tools. Tool Interface Language Associated Platforms Current Version Graphical User Interface Distributed Mode Auto-Keras Python - 1.0.9 - - Auto-Sklearn Python - 0.10.0 - - Auto-Weka Python RWEKA 2.6.1 ✓- AutoGluon Python - 0.0.14 - - H2O AutoML Python R Scala AWS Azure Google Cloud Apache Spark 3.30.1.3 ✓ ✓ rminer R - 1.4.6 - - TPOT Python - 0.11.5 - - TransmogrifAI Scala Apache Spark 0.7.0 - ✓ For the experimental study, we selected H2O AutoML and TransmogrifAI, as these were the only tools from Table 4 that meet the distributed ML requirement. Table Table 5 presents the ML algorithms implemented by both tools. The last two rows are related to the stacking ensembles implemented by H2O AutoML: all, which combines all trained algorithms; and best, which only combines the best algorithm per family. 3.2.3.3 Data For the benchmark study, we used three real-world datasets from the domain of telecommunications, provided by the IRMDA project analytics company. The datasets are related to customer churn prediction (regression), event forecasting (univariate time series), and telecommunications fraud detection (binary classification). The churn dataset contains 189 rows and 21 attributes. The attributes of each row characterize a client and the probability for canceling the company’s analytics service (churn), as defined by the company. Table 6 describes each attribute of the churn dataset. The event forecasting dataset contains 1,418 rows that correspond to records about telecommunication events of a certain type (e.g., phone calls). The events occurred from February to April of 2019, aggregated on an hourly basis, ranged from 3,747 to 56,320. The only attributes are the timestamp and the number of events in that interval, as described in Table 7. The fraud detection dataset contains the identification of A (sender) and B (receiver), and the classification of the phone call (“fraud” or “normal”). The dataset contains more than 1 million examples, 34 3.2. A SCALABLE AND AUTOMATED MACHINE LEARNING FRAMEWORK TO SUPPORT RISK MANAGEMENT Table 5: Algorithms implemented by H2O AutoML and TransmogrifAI. Algorithm H2O AutoML TransmogrifAI Decision Tree -✓ Deep Learning ✓- Extremely Randomized Forest ✓- Gradient-Boosted Tree - ✓ Gradient Boosting Machine ✓- Generalized Linear Model ✓- Linear Regression - ✓ Linear SVM - ✓ Logistic Regression - ✓ Naive Bayes - ✓ Random Forest ✓ ✓ XGBoost ✓ (only fully supported in Linux) - Stacking All (SA) ✓- Stacking Best (SB) ✓- Table 6: Description of the attributes of the churn dataset. Attribute Description tenure Time passed since the beginning of the contract streaming_quality Contractualized display resolution ott_video If OTT video is contractualized or not contract Duration of the contract payment_method Contractualized method of payment product_name Identification of the product platform Type of connectivity present in the contract financial_status If the payment is late or regularized service_latency Latency of the service dropped_frames Number of dropped frames volume Information about volume duration Information about duration account_number Account identification number service_latency category Category of the service latency attribute dropped_frames category Category of the dropped frames attribute volume category Category of the volume attribute duration category Category of the duration attribute tenure category Category of the tenure attribute account_segment Age segment of the client equipment Equipment used by the client churn_probability Probability of canceling the service (∈ [0,1]) 35 CHAPTER 3. SUPERVISED AUTOMATED MACHINE LEARNING Table 7: Description of the attributes of the event forecasting. Attribute Description Time Timestamp (format: yyyy-mm-dd hh:mm) datapoints Number of events which correspond to one day of phone calls from one of the company clients. The dataset attributes are described in Table 8. Table 8: Description of the attributes of the fraud dataset. Attribute Description A Identification of the call sender B Identification of the call receiver Result Classification of the call (“fraud” or “normal”) 3.2.4 Results 3.2.4.1 Experimental Setup To benchmark the AutoML tools, we executed several computational experiments using the three real-world datasets. The tools were compared under the same experimental setup, which was run on a machine with an i7-8700 Intel processor with 6 cores. A holdout split was used to divide the datasets into training (with 3/4 of the data) and test (1/4) sets. For churn and fraud dataset, the split was randomly selected, while for the event forecasting data a time order division was used (since the data is ordered in time). Using the training data, each AutoML tool optimizes a single performance measure, which was set as the MAE for the regression tasks (churn and event forecasting) and the AUC for the classification data (fraud detection). An internal 10-fold cross-validation was used by both AutoML tools in order to get a validation set where the selected performance measure is computed. For comparison purposes, for the test data we also computed the Normalized MAE (NMAE, in %, which is equal to the MAE divided by the target range) and RMSE values for regression tasks, and the Precision and Recall measures for the binary classification. We tested all ML algorithms from Table 5, except for the DL, which was disabled from the H2O due to two main reasons. First, it required a huge computational effort, particularly for the large fraud detection dataset. Second, to achieve a more fair comparison, since TransmogrifAI does not include a DL algorithm. In order to allow the execution of all ML algorithms, no computational time execution limitation was used. 3.2.4.2 AutoML Results For the Churn dataset, two scenarios were designed to test the performance of the AutoML tools. The first scenario (1) assumes all the attributes of the dataset as input features of the ML models. The 36 3.2. A SCALABLE AND AUTOMATED MACHINE LEARNING FRAMEWORK TO SUPPORT RISK MANAGEMENT second scenario (2) uses an initial feature selection phase before training the models. The goal was to test the automatic feature selection option provided by TransmogrifAI. Under this scenario, and for H2O, we used the features that were considered more relevant by the best H2O performing ML model for the first scenario. The obtained results are presented in Table 9, where the computational execution time is presented in the minutes : seconds notation. Table 9: Results for the churn data (best values in bold). Tool Scenario Execution Time Best Algorithm Test Data MAE NMAE RMSE H2O AutoML 100:28 SA 0.112 11.2% 0.189 200:26 GLM 0.126 12.6% 0.186 TransmogrifAI 1 03:44 RF 0.210 21.0% 0.283 2 03:36 GBT 0.109 10.9% 0.136 For the Event Forecasting dataset, we performed a transformation on the dataset by using a set of time lags to create the regression inputs since both H2O AutoML and TransmogrifAI do not have native univariate time series forecasting algorithms (e.g., ARIMA, Holt-Winters), These lags were created using the CaseSeries function of the rminer R package (Cortez, 2010), under three input, lagged scenarios: 1 – with time lags 𝑡−1,𝑡−24 and 𝑡−25, where 𝑡is the current time (corresponding to the previous hour, day and hour before that day); 2 – with all time lags from the last 24 hours (from 𝑡−1to 𝑡−24); and 3 – with the time lags 𝑡−12,𝑡−24,𝑡−36 and 𝑡−48. The results for each scenario are presented in Table 10. Table 10: Results for the event forecasting data (best values in bold). Tool Scenario Execution Time Best Algorithm Test data MAE NMAE RMSE H2O AutoML 102:32 GBM 2673 5.08% 4032 202:53 GBM 2138 4.07% 3535 301:50 GBM 2589 4.92% 4079 TransmogrifAI 1 05:16 GBT 2725 5.18% 4332 2 05:00 RF 2101 4.00% 3441 3 03:47 RF 3468 6.60% 5212 Given that the Fraud dataset is highly unbalanced (with only around 0.01% of the calls being illegitimate), three scenarios were analyzed during the training phase to test the effect of balancing methods. The first scenario (1) used a simple oversampling which used “fraud” records and a random selection (with replacement) of “normal” cases. The second (2) and third (3) scenarios use the Synthetic Minority Oversampling Technique (SMOTE), which is a more sophisticated balancing method that generates synthetic examples for the minority class, such that the training data gets more balanced (Chawla et al., 2002). The SMOTE was used to generate 100% of new fraud cases in the second scenario and 200% of 37 CHAPTER 3. SUPERVISED AUTOMATED MACHINE LEARNING extra fraud examples in the third scenario. The test phase also considers three scenarios of unseen data, with different normal to fraud ratios: A – 50%/50%, thus balanced; B – 75%/24%; and C – 80%/20%. Table 11 shows the obtained results. Table 11: Results for the fraud detection data (best values in bold). Tool Train Scenario Execution Time Best Algorithm Test Scenario AUC Precision Recall H2O AutoML 1 05:20 GBM A 0.97 0.99 0.98 B0.95 0.99 0.97 C0.95 0.98 0.99 2 07:18 GBM A0.99 10.99 B0.97 0.99 0.98 C0.97 0.99 0.96 3 08:54 GBM A0.99 1 0.99 B0.99 0.99 0.98 C0.98 0.99 0.98 TransmogrifAI 101:19 RF A0.98 0.99 0.96 B 0.93 0.98 0.97 C 0.92 0.98 0.93 201:45 RF A 0.98 1 0.99 B 0.96 0.99 0.98 C 0.96 0.97 0.94 302:13 GBT A0.99 1 0.99 B 0.98 1 0.98 C 0.97 0.99 0.96 3.2.4.3 Discussion In terms of computational processing time, the results show that in general a small effort is needed by the AutoML tools. The highest execution time is related with the fraud detection data for the H2O tool and it corresponds to just around 9 minutes. This small computational effort is explained by several factors, including: usage of a distributed ML and multi-core machine; usage of benchmark telecommunications datasets that are either have a small number of examples (churn, event forecasting) or inputs (fraud detection); and the disabling of the DL algorithm in the H2O tool. Nevertheless, the execution time results confirm that the AutoML can perform an automatic ML selection in a reasonable time. And if larger datasets were analyzed, the computational effort could be reduced by adding more processing elements to the computational cluster. As for the tool comparison, H2O AutoML required less time to process the regression tasks (churn and event forecasting), while TransmogrifAI was faster for the classification task. In terms of the predictive performance, H2O AutoML obtained better results for three regression comparisons (for both MAE and RMSE: scenario 1 for churn and scenarios 1 and 3 for event forecasting), 38 3.2. A SCALABLE AND AUTOMATED MACHINE LEARNING FRAMEWORK TO SUPPORT RISK MANAGEMENT and seven classification comparisons (when using the AUC measure). TransmogrifAI obtained the best results in two regression scenarios and two classification ones. Overall, the AutoML predictive results are of high quality and the tools do not present substantial predictive differences. For example, all H2O AUC test results are equal to or higher than 95%, which corresponds to an excellent discrimination level. And the largest AUC classification difference when compared with TransmogrifAI is just 3 percentage points. Similarly, the best churn prediction models present a NMAE value that corresponds to an interesting value of around 10%. The tool NMAE differences are small for scenario 2 (1.7 percentage points) but larger for scenario 1 (9.8 percentage points). As for the event forecasting, the predictions are of high quality, with NMAE values ranging from 4.0% to 6.6%. The tool NMAE differences are very small for scenarios 1 and 2, with percentage point differences of 0.10 and 0.07, while the difference is larger for scenario 3 (1.68 percentage points). The predictive results confirm the potential of the distributed AutoML technologies, which are capable of achieving high-quality predictive results in a reasonable amount of time and with a minimum human intervention. The obtained results were shown to the risk management software and analytics company, which opted to select the H2O AutoML tool for several reasons. First, it provided better predictive results for the majority of the tested scenarios. In particular, when the AutoML tools presented the largest metric differences, the best results were achieved by H2O. Second, the company classified the tool as “more mature” software, since as shown in Table 4, it is available in different programming languages and it can be integrated with more platforms (other than Spark). Also, the H2O provided an easy to use Graphical User Interface. 3.2.5 Tecnological Architecture After the comparative ML experiments, the analytics company selected the H2O AutoML tool for the model training component. The remaining technological modules were then designed in cooperation with the company. Since one of the prerequisites of the architecture is that it is distributed, we tried to identify technologies with distributed capabilities. Given that H2O can be integrated with Apache Spark (using the Sparkling Water module) and that Spark provides functions for data processing, we relied on Spark’s API functions to implement the remaining components of the architecture. The updated architecture, with references to the technologies used, is illustrated in Fig. 8. 3.2.5.1 Components This subsection describes the current implementation of each module of the architecture. The updated technological architecture changed some of the modules initially described in Section 3.2.2. These changes were related to feedback received from the analytics company or due to technological restrictions. 39 CHAPTER 3. SUPERVISED AUTOMATED MACHINE LEARNING Table 13: Description of the selected OpenML datasets. Dataset Task Rows Cols. Classes/ Levels Target Values Cholesterol regression 303 14 152 [126, 564] Churn binary 5000 21 2 {0,1} Cloud regression 108 7 94 [0, 6] Cmc multi-class 1473 10 10 {0,1,...,9} Credit binary 1000 21 2 {0,1} Diabetes binary 768 9 2 {0,1} Dmft multi-class 797 5 6 {0,1,...,5} Liver Disorders regression 345 6 16 [0, 20] Mfeat multi-class 2000 7 10 {0,1,...,9} Plasma regression 315 14 257 [179, 1727] Qsar binary 1055 42 2 {0,1} Vehicle multi-class 846 19 4 {0,1,...,3} cross-validation. In order to create validation sets (to select the best ML algorithms and hyperparameters), we adopted an internal 5-fold validation. For instance, if the data contains 100 instances, then in the first external 10-fold iteration 90 examples are used by the tool for fitting purposes (model selection and training), with the remaining 10 instances being used for the external testing. The 90 fit examples are further divided into 5 folds. In the first internal fold, each ML is trained with 72 instances and 18 are used for validation purposes (allowing to select the best model). Since neither Auto-Keras nor Auto-PyTorch natively support cross-validation during the fitting phase, we used a simpler holdout train (75%) and test (25%) set split to select and fit the models. In all three scenarios the same measures are used to evaluate the performance of the external 10-fold test set predictions. Popular prediction measures were selected: regression - MAE (∈[0.0,∞[, where 0.0 denotes a perfect predictor); binary classification - Area Under the receiver operating characteristic Curve (AUC) (∈[0.0,1.0], where 1.0 denotes the ideal classifier); multi-class classification - Macro F1-score (∈ [0.0,1.0], where 1.0 denotes the perfect model). Whenever allowed by the AutoML tool, we adopted the same measures for the internal AutoML validation set model comparison. The exceptions were with multiclass datasets and the Auto-Keras and Auto-PyTorch tools, which did not allow to use a Macro F1-score validation, thus the default loss function was adopted for these tools. All experiments were executed using an Intel Xeon 1.70GHz server with 56 cores and 2TB of disk space. For each external fold, we also recorded the computational effort (in terms of time elapsed) for the AutoML fit (model selection and training). When the AutoML tool allowed to specify a time limit for training, the chosen time was one hour (3,600 s). Also, for the tools that implement an early stopping AutoML parameter, we fixed the value to three rounds. To aggregate the distinct external 10-fold results, we compute the average values. We also provide the 10-fold average 𝑡-distribution 95% confidence intervals, which can 46 3.3. A COMPARISON OF AUTOML TOOLS FOR MACHINE LEARNING, DEEP LEARNING AND XGBOOST be used to attest if the tool differences are statistically significant (e.g., by checking if two confidence intervals do not overlap). Nevertheless, given that there is a very large number of comparisons, to select the best tool for each task, we adopt a lexicographic approach (Freitas, 2004), which considers first the best average predictive performance (with a precision up to 1% or 0.01 points) and then the average computational effort (precision in s). To facilitate the lexicographic regression analysis, we compute the Normalized MAE (NMAE) score, which is a scale independent measure, where 𝑁𝑀𝐴𝐸 =𝑀𝐴𝐸/(max(𝑦)−min(𝑦)) and 𝑦denotes the output target (Oliveira et al., 2017). 3.3.4 Results Fig. 10 and Fig. 11 summarize the main scenario (GML) results. In total, there were 12 (dataset) ×6 (tools) ×10 (folds) = 720 AutoML executions. Fig. 10 presents the average computational effort (in s) for each external 10-fold iteration. Fig. 11 shows the average external test scores (grouped in terms of the binary, multi-class and regression tasks). To facilitate the visualization of the regression scores, in the right of Figure 11 we use the NMAE score in the 𝑦-axis. Figure 10: Execution time (𝑦-axis) for the GML scenario (bars denote external 10-fold average values with 95% confidence intervals; the Auto-Sklearn values were omitted from the graph because they are always constant and equal to 3,600 s). For GML, Auto-Sklearn always requires the maximum allowed computational effort (3,600 s), followed by TPOT (average of 858 s per external fold and dataset). The other tools are much faster: AutoGluon – lowest average value (70 s), best in 5 datasets; H2O – second average value (158 s), best in 5 datasets; TransmogrifAI – third best average (317 s); rminer – fourth best average (408 s), best in 2 datasets. Regarding the prediction performances, there is a high overall correlation between the validation and 47 CHAPTER 3. SUPERVISED AUTOMATED MACHINE LEARNING Figure 11: Predictive results for the GML scenario (bars denote external 10-fold average values with 95% confidence intervals). test scores (not shown in Fig. 11, although the same effect is present in Table 14 and Table 15), when considering all tool execution values: 0.75 – binary; 0.90 – multi-class; and 0.92 – regression. For the binary classification, and when considering the test set results, the AutoML differences are smaller for churn (maximum difference of 3 percentage points - pp ) and higher for the other datasets (10 pp for diabetes, 15 pp for credit and 16 pp for qsar). TransmogrifAI is the best tool in 3 of the datasets (churn, credit and qsar), also obtaining the best average AUC per dataset (88%). An almost identical average (87%) is achieved by H2O (best in churn and credit), rminer (best in diabetes) and TPOT (best in churn). AutoGluon and Auto-Sklearn produced the worst overall results (average AUCs per dataset of 78% and 80%). Turning to multi-class tasks, the AutoML differences (best tool test result minus the worst one) are smaller when compared with the binary task: 4 pp – Cmc; 5 pp – Dmft; 6 pp – Mfeat; and 8 pp – Vehicle. The best test dataset average is obtained by AutoGluon (Macro F1-Score 58%), followed by Auto- Sklearn, H2O and TPOT (Macro F1-Score of 57%), then TransmogrifAI (56%) and finally rminer (53%). In terms of datasets, the best results were: Cmc – Auto-Sklearn (54%); Dmft – TransmogrifAI (24%); Mfeat – AutoGluon, Auto-Sklearn and TPOT (74%); and vehicle - AutoGluon and Auto-Sklearn (82%). As for the regression tasks, the AutoML tool differences for each dataset are very small, corresponding to 1 pp in terms of NMAE for all three datasets. In effect, all tools obtain the same average NMAE per dataset (9%). Using the lexicographic selection (Section 3.3.3), the GML tool recommendation is: binary - TransmogrifAI; multi-class - AutoGluon; regression – rminer. The DL benchmark consisted of 12 (dataset) ×4 (tools) × 10 (folds) = 480 AutoML executions. Table 14 shows the average DL 10-fold results (±the 95% confidence intervals) in terms of the external computational effort (Time), internal validation (Val.) and test scores 48 3.3. A COMPARISON OF AUTOML TOOLS FOR MACHINE LEARNING, DEEP LEARNING AND XGBOOST (Test). The Auto-Keras and Auto-PyTorch validation scores are omitted, since they are not disclosed by the tools. Regarding execution time, AutoGluon is much faster than the other tools, requiring an average fit time of just 24 s. The second fastest DL tool is Auto-Keras (average of 984 s), followed by H2O (3,458 s) and then Auto-PyTorch (3,600 s). As for the prediction performances, the average test values per dataset are: binary (AUC) - H2O (85%), Auto-PyTorch (77%); AutoGluon (72%) and Auto-Keras (69%); multi-class (Macro F1-score) - AutoGluon (57%), Auto-PyTorch (56%); H2O (50%) and Auto-Keras (43%); regression (NMAE) - H2O (10%); Auto-PyTorch and AutoGluon (11%); Auto-Keras (13%). While only four tools are compared, larger differences among the tools were obtained for the DL scenario when compared with GML: binary - ranging from 11 pp (Qsar) to 24 pp (credit); multi-class - from 4 pp to 30 pp ; and regression – from 2 pp to 10 pp . The lexicographic recommendation for DL is: binary - H2O; multi-class - AutoGluon; regression – H2O. However, when considering both GML and DL scenarios, the lexicographic selection favors GML tools. Table 15 presents the XGB scenario results (total of 240 AutoML executions). Both tools require a low computational effort, with rminer presenting the faster fit times (average of 5 s), while H2O requires around 16 times more computation (average of 80 s). Both tools also present similar predictive performances, with the tool differences ranging from 0 to 2 pp . The lexicographic selection for XGB favors: binary - rminer (average AUC of 86%); multi-class - H2O (average Macro F1-score of 55%); regression - rminer (average NMAE of 9%). When considering both DL and XGB scenarios, the lexicographic choice favors rminer XGB for the binary classification and regression tasks, while AutoGluon DL is the selected tool for multi-class. When analyzing all three scenarios, the overall lexicographic selection is: binary – TransmogrifAI GML; multi-class – AutoGluon GML; regression - rminer XGB. Finally, we contrast the best main GML scenario results (which consider more ML algorithms and AutoML tools) with the best public OpenML results (Table 16). For each dataset, we show in rounded brackets the best GML AutoML tool and the type of OpenML modeling (the algorithm name or “Pipeline”, with the latter denoting a ML workflow that includes a data preparation step). While the best OpenML result includes predictions for all external 10-fold instances, we do not know the exact validation and testing procedures that were adopted. Thus, rather than assuming a “correct” comparison, we use here the best OpenML results as a “gold standard”, denoting a proxy to the best results that can be achieved when using a human expert ML modeling. The column Attempts from Table 16 denotes the number of human ML attempts, termed as a “run” in OpenML. The higher the number of attempts, the stronger is our assumption that the gold standard was reached. While all 12 datasets have high download numbers, the attempts distribution is highly unbalanced towards the classification tasks, particularly the binary ones (e.g., Credit has more than 419,000 attempts). The results from Table 16 confirm the quality of the AutoML. In effect, the tools obtained prediction scores that are close to the best OpenML results in seven datasets (e.g., the maximum difference is 2 and 5 pp for the binary and multi-task classification tasks). More importantly, the AutoML outperformed the best OpenML for three regression tasks and for two highly modeled binary datasets. 49 CHAPTER 3. SUPERVISED AUTOMATED MACHINE LEARNING Table 14: Results for the DL scenario (best values in bold). Dataset Tool Time Measure Val. Test Churn Auto-Keras 2294±309 - 0.74±0.04 Auto-PyTorch 3600±000 - 0.81±0.08 AutoGluon 0041±003 AUC 0.90±0.00 0.80±0.02 H2O AutoML 3600±000 0.92±0.00 0.92±0.02 Credit Auto-Keras 1498±333 - 0.52±0.02 Auto-PyTorch 3600±000 - 0.68±0.04 AutoGluon 0021±002 0.77±0.01 0.57±0.03 H2O AutoML 3600±000 0.78±0.00 0.76±0.04 Diabetes Auto-Keras 0828±179 - 0.70±0.04 Auto-PyTorch 3600±000 - 0.73±0.03 AutoGluon 0022±001 0.79±0.01 0.65±0.05 H2O AutoML 3600±000 0.84±0.01 0.82±0.03 Qsar Auto-Keras 1154±336 - 0.82±0.03 Auto-PyTorch 3600±000 - 0.87±0.02 AutoGluon 0026±003 0.91±0.00 0.84±0.03 H2O AutoML 3600±000 0.92±0.00 0.92±0.02 Cmc Auto-Keras 0884±139 - 0.45±0.04 Auto-PyTorch 3600±000 - 0.51±0.04 AutoGluon 0027±003 Macro F1 0.55±0.00 0.53±0.02 H2O AutoML 3600±000 0.55±0.00 0.48±0.06 Dmft Auto-Keras 0478±045 - 0.16±0.04 Auto-PyTorch 3600±000 - 0.18±0.04 AutoGluon 0018±002 0.21±0.01 0.17±0.02 H2O AutoML 3600±000 0.23±0.01 0.14±0.04 Mfeat Auto-Keras 0713±095 - 0.44±0.04 Auto-PyTorch 3600±000 - 0.73±0.02 AutoGluon 0032±002 0.76±0.00 0.74±0.01 H2O AutoML 3600±000 0.69±0.01 0.58±0.06 Vehicle Auto-Keras 0708±053 - 0.65±0.05 Auto-PyTorch 3600±000 - 0.85±0.02 AutoGluon 0038±003 0.85±0.01 0.82±0.03 H2O AutoML 3600±000 0.82±0.01 0.78±0.03 Cholesterol Auto-Keras 0665±059 38.4±3.2 57.7±29.3 Auto-PyTorch 3600±000 59.5±3.9 60.5±24.8 AutoGluon 0013±002 MAE 39.0±0.5 39.4±4.0 H2O AutoML 2509±279 37.3±0.4 39.9±4.1 Cloud Auto-Keras 0549±572 0.00±0.00 0.88±0.36 Auto-PyTorch 3600±000 0.20±0.04 0.30±0.10 AutoGluon 0013±001 0.39±0.03 0.43±0.12 H2O AutoML 3256±437 0.25±0.01 0.32±0.11 Liver Disorders Auto-Keras 0879±797 2.67±0.29 2.60±0.37 Auto-PyTorch 3600±000 2.54±0.14 2.41±0.35 AutoGluon 0018±003 3.39±0.20 3.44±0.33 H2O AutoML 3326±546 2.23±0.04 2.68±0.33 Plasma Auto-Keras 1156±111 127±006 170±020 Auto-PyTorch 3600±000 175±091 191±097 AutoGluon 0014±002 156±004 155±022 H2O AutoML 3600±000 151±003 160±017 50 3.4. CONCLUSIONS Table 15: Results for the XGB scenario (best values in bold). Dataset Tool Time Measure Val.Test Churn H2O AutoML 356±182 AUC 0.93±0.00 0.92±0.01 rminer 006±000 0.92±0.00 0.92±0.01 Credit H2O AutoML 021±002 0.79±0.01 0.79±0.02 rminer 004±000 0.77±0.01 0.79±0.02 Diabetes H2O AutoML 013±002 0.83±0.01 0.82±0.05 rminer 003±001 0.81±0.01 0.82±0.04 Qsar H2O AutoML 037±004 0.93±0.00 0.93±0.01 rminer 004±000 0.93±0.00 0.93±0.02 Cmc H2O AutoML 035±002 Macro F1 0.53±0.01 0.53±0.02 rminer 006±000 0.53±0.01 0.52±0.03 Dmft H2O AutoML 034±002 0.23±0.01 0.21±0.04 rminer 009±000 0.20±0.01 0.19±0.02 Mfeat H2O AutoML 121±009 0.72±0.06 0.71±0.02 rminer 015±001 0.72±0.01 0.71±0.02 Vehicle H2O AutoML 088±012 0.77±0.00 0.77±0.04 rminer 007±000 0.76±0.01 0.75±0.03 Cholesterol H2O AutoML 025±005 MAE 39.1±0.5 39.2±4.2 rminer 002±000 42.7±1.0 42.4±5.1 Cloud H2O AutoML 167±120 0.28±0.02 0.30±0.08 rminer 002±000 0.31±0.01 0.30±0.08 Liver Disorders H2O AutoML 020±004 2.29±0.04 2.35±0.32 rminer 002±000 2.49±0.05 2.45±0.30 Plasma H2O AutoML 042±008 154±003 154±022 rminer 003±001 171±004 170±021 3.4 Conclusions Applying ML to real-world business problems can be time-consuming, resource-intensive, and challenging. AutoML facilitates this process by running systematic search processes with minimum input from the user. Another important ML aspect is scalability, which can be achieved by using a divide-and-conquer approach, in which smaller datasets are analyzed by different processing elements. However, automation and scalability are two of the main current challenges of ML. On one hand, there is a need for applications that are capable of distribution in order to add computation scalability to their processes. On the other hand, ML applications must be capable of automating their typical steps (e.g., feature selection, model training) to allow non-expert users to develop ML models and use them to make predictions. 51 CHAPTER 3. SUPERVISED AUTOMATED MACHINE LEARNING Table 16: Comparison between best GML scenario and best OpenML results (best values in bold). Dataset Measure Best OpenML AutoML OpenML Attempts Churn AUC 0.919 (H2O AutoML) 0.930 (Pipeline) 5,132 Credit 0.803 (H2O AutoML) 0.800 (Ranger) 419,021 Diabetes 0.825 (rminer) 0.842 (XGB) 132,164 Qsar 1.000 (TransmogrifAI) 0.938 (XGB) 147,659 Cmc Macro F1 0.545 (Auto-Sklearn) 0.572 (Pipeline) 21,446 Dmft 0.236 (TransmogrifAI) 0.262 (Pipeline) 19,445 Mfeat 0.745 (AutoGluon) 0.772 (Pipeline) 22,136 Vehicle 0.820 (AutoGluon) 0.870 (Pipeline) 23,532 Cholesterol MAE 38.59 (TransmogrifAI) 38.60 (Cforest) 160 Cloud 0.256 (TransmogrifAI) 0.268 (Pipeline) 5 Liver Disorders 2.329 (Auto-Sklearn) 2.309 (Pipeline) 77 Plasma 152.3 (AutoGluon) 152.6 (Pipeline) 15 In this study, we address these challenges by demonstrating the initial supervised AutoML experiments, aiming to gain insights into the application of AutoML for supervised learning tasks, as well as to identify a robust and reliable evaluation method for the proposed AutoML framework. For the first experiment (Section 3.2), we propose a ML framework to automate the typical workflow of supervised ML applications without the need for human input. The framework includes the modules of task detection, data preprocessing, feature selection, model training, and pipeline deployment. The framework was developed within project IRMDA, a R&D project developed by a leading Portuguese software and analytics company that provides services for the domain of telecommunications risk management. The company clients work with datasets of variable sizes (large or small) and are mostly non-ML experts. Thus, the proposed framework uses distributed ML to add computational scalability to the process and AutoML to 52 3.4. CONCLUSIONS automate the search for the best algorithm and hyperparameters. In order to assess the most appropriate AutoML tools for this model training module, we initially conducted a benchmark experiment. First, we analyzed the features of eight open-source AutoML tools (Auto-Gluon, Auto-Keras, Auto-Sklearn, Auto-Weka, H2O AutoML, Rminer, TPOT, and TransmogrifAI). Then, we selected the tools that allowed a distributed execution for the experiments (H2O AutoML and TransmogrifAI). The benchmark study used three real-world datasets provided by the software company from the domain of telecommunications risk management. The proposed framework was positively evaluated by the analytics company, which selected H2O AutoML as the best tool for the model training module. After the selection of H2O AutoML for the model training module, we developed the technological architecture. We selected technologies with distributed capabilities for the remaining modules of the initially proposed framework. Most of the remaining modules were implemented using Apache Spark’s API functions. Then, we describe the current implementation of each module of the architecture. Finally, we describe the REST API that was created to facilitate communication between the end-users (the company clients) and the implemented pipelines. In the second study (Section 3.3), we benchmark eight recent open-source supervised learning AutoML tools: Auto-Keras, Auto-PyTorch, Auto-Sklearn, AutoGluon, H2O AutoML, rminer, TPOT and TransmogrifAI. A large set of computational experiments was held by considering an external 10-fold cross-validation, twelve datasets and three tool comparison scenarios. Each tool was benchmarked by measuring its computational effort and predictive scores. We retrieved popular datasets from the OpenML platform, which were equally grouped into regression, binary, and multi-class classification tasks. The three comparison scenarios were: General Machine Learning (GML) - with a large range of classical ML algorithms; Deep Learning (DL) - focusing on tools with DL Neural Architecture Search (NAS) capabilities; and XGBoost (XGB) - considering a single XGB algorithm hyperparameter tuning. To select the best tools for each scenario, we adopted a lexicographic approach, which considers first, for each task, the best average predictive score and then the lowest computational effort. For GML, the lexicographic selection favors TransmogrifAI for binary classification, AutoGluon for multi-class classification and rminer for regression. For DL, the selection is H2O for the binary and regression tasks and AutoGluon for regression. As for the XGB scenario, rminer is the best overall option for binary and regression tasks, while H2O is recommended for multi-class tasks. A global overall analysis, considering all three scenarios, favors the GML approach, which produced the best predictive scores. This result should be taken with some caution since GML explored more ML algorithms and AutoML tools. Nevertheless, the slightly lower AutoML DL predictive performances might be explained by two factors. Firstly, the analyzed datasets are relatively “small”, with the largest dataset containing only 5,000 instances. And it is known that DL tends to produce better results (when compared with shallow methods) when modeling big data Ng, 2020. Secondly, the AutoML tools with DL capabilities are more recent and thus might be still immature when compared with GML tools. For instance, the tested Auto-PyTorch and AutoGluon versions are still in their zero dot something versions (e.g., 0.0.2). To further measure the quality of the GML AutoML modeling, we compared the best GML results with the best 53 CHAPTER 3. SUPERVISED AUTOMATED MACHINE LEARNING predictions publicly available on the OpenML platform. The OpenML comparison confirmed that current GML AutoML tools provide competitive results, producing close predictions in seven datasets and even outperforming the human ML modeling in five datasets. 54 Chapter 4 Using Supervised and One-Class Automated Machine Learning for Predictive Maintenance 4.1 Research Context This chapter summarizes the PhD work carried out under the CMMS R&D project, which explored the application of ML for Predictive Maintenance, following the contributions highlighted in Chapter 3. Similar to the IRMDA project, CMMS also had a relatively short execution time (approximately one year), corresponding to the third year of this PhD project. As part of the CMMS project, we conducted preliminary experiments to develop a novel AutoML framework by employing a GE to evolve OCC ML algorithms using single and multi-objective optimization. First, we applied state-of-the-art AutoML tools using a real-world PdM dataset. Then, we proposed AutoOneClass, an AutoML framework that focuses on three OCC algorithms: deep AE, IF, and OC-SVM. The GE was employed to optimize the search for the best OCC ML algorithm and its hyperparameters, assuming a single or multi-objective optimization search. The framework also allows for unsupervised or supervised validation setups. The unsupervised setup used unlabeled data during validation and anomaly scores to evaluate the ML models, while the supervised setup employed a labeled validation set to assess model performance. This R&D project contributed to advancing the state-of-the- art regarding the application of AutoML in the PdM industry and provided valuable practical knowledge about the usage of OCC algorithms within AutoML. Further details about the work conducted under the CMMS project are presented in this chapter, which resulted in two published papers: a Best Paper Award conference paper (Ferreira, Pilastri, Sousa, et al., 2021) and a Q1 journal paper (Ferreira et al., 2022). 55 CHAPTER 4. USING SUPERVISED AND ONE-CLASS AUTOMATED MACHINE LEARNING FOR PREDICTIVE MAINTENANCE Table 18: Description of the equipment maintenance dataset attributes. Attribute Description Type Levels Domain Example RecordType Type of record String 5 - Failure Brand Brand of the equipment String 2 - Rossi WOType Type of work order String 4 - Corrective PriorityLevel Priority Level of the work order String 4 - Urgent Responsible Responsible for the work order String 3 - R4 Employee Employee that performed the action String 12 - E100 TotalTime Duration of the action (in hours) Float 17 [0, 8] 8 Quantity Consumption quantity Float 32 [0, 300] 90 Part Part that was consumed String 161 - T-1073 Meter Meter associated to meter reading String 11 - L-0002 MeterCumulative Cumulative reading of meter Float 1477 [0, 73636] 22767 Reading IncrementValue Increment compared to last reading Float 475 [0, 54570] 168 MaintenancePlan Maintenance Plan associated to task String 5 - P-000011 Task Executed task String 5 - T-0001 AssetWithFailure Identification of the equipment String 15 - A577 ParentAsset Parent equipment of String 11 - LINHA2 AssetWithFailure Day Day of the month of the record Integer 31 [1, 31] 4 DayOfWeek Day of the week of the record Integer 7 [1, 7] 6 Month Month of the record Integer 12 [1, 12] 2 Year Year of the record Integer 6 [2015, 2019] 2019 DaysAfterPurchase Age of the equipment (in days) Integer 852 [0, 6309] 4479 DaysToNext Number of Days until the Integer 1015 [0, 1550] 3 Failure next failure of the equipment FailOn3Days Indication whether the equipment Integer 2 {0,1} 1 will fail in the next 3 days FailOn5Days Indication whether the equipment Integer 2 {0,1} 1 will fail in the next 5 days FailOn7Days Indication whether the equipment Integer 2 {0,1} 1 will fail in the next 7 days FailOn10Days Indication whether the equipment Integer 2 {0,1} 1 will fail in the next 10 days 3 and 10 days, depending on the target). The most imbalanced target column is FailOn3Days, with only 2.53% of records that will present failures in 3 days. As expected, the larger the interval being considered, the larger the percentage of the “failure” class. However, even the least unbalanced target column (FailOn10Days) presents 7.82% of records that will have failures. As other studies show (e.g., (Dangut et al., 2022)), imbalanced datasets are very prevalent in the PdM domain since failures are frequently sporadic compared to health situations. 62 4.3. MATERIALS AND METHODS Figure 14: Balancing of the binary classification targets and histogram of the regression target. 4.3.4 Data Preprocessing Since several data attributes are of the type String (as shown in Table 18), which is not accepted by some AutoML tools, we opted to encode all String attributes into numerical types. To decide the most appropriate techniques to transform the textual attributes into numerical, we first analyzed the number of records and 63 CHAPTER 4. USING SUPERVISED AND ONE-CLASS AUTOMATED MACHINE LEARNING FOR PREDICTIVE MAINTENANCE corresponding percentage for missing and unique values, which are presented in Table 19. Table 19: Missing values and unique values of the datasets. Attribute Missing Values Unique Values No. % No. % RecordType 0 0 5 <1 Brand 203 8 2 <1 WOType 1801 69 4 <1 PriorityLevel 1801 69 4 <1 Employee 2228 85 12 <1 TotalTime 0 0 - - Quantity 32 1 - - Part 2338 90 161 6 Meter 0 0 11 <1 MeterCumulative 0 0 - - IncrementValue 0 0 - - MaintenancePlan 2228 85 5 <1 Task 2228 85 5 <1 AssetWithFailure 0 0 15 <1 ParentAsset 0 0 11 <1 Day 0 0 31 1 DayOfWeek 0 0 7 <1 Month 0 0 12 <1 Year 0 0 6 <1 DaysAfterPurchase 0 0 - - DaysToNextFailure 0 0 - - FailOn3Days 0 0 2 <1 FailOn5Days 0 0 2 <1 FailOn7Days 0 0 2 <1 FailOn10Days 0 0 2 <1 For the String attributes that presented a low cardinality (five levels or less), we applied the known One-Hot encoding. For the columns that had missing values, we replaced the missing value with zero, which is assumed as a numeric code value for the “unknown” level. Since the One-Hot encoding method creates one binary column for each level of the original attribute, we applied a different transformation for the columns with a higher cardinality. Indeed, for the categorical variables with more than five levels, we used the Inverse Document Frequency (IDF) technique, available on the Python CANE module (Matos et al., 2022). This method converts a categorical column into a numerical column of positive values based on the frequency of each attribute level. IDF uses the function 𝑓(𝑥)=𝑙𝑜𝑔(𝑛/𝑓 𝑥), where 𝑛is the length of 𝑥and 𝑓 𝑥 is the frequency of 𝑥. The benefit of IDF, compared with One-Hot Encoding, is that the IDF technique does not generate new columns, which is useful for attributes with high cardinality (e.g., the attribute Part has 161 levels). 64 4.4. RESULTS The remaining attributes (of Integer and Float types) were not altered because most AutoML tools already apply preprocessing techniques to the numerical columns (e.g., normalization, standardization). Furthermore, we did not replace the missing values for the only numerical column that presented missing values (Quantity), since the AutoML tools usually perform an imputation task before running the algorithms. After applying the transformations, the final dataset had 42 inputs and five target columns. 4.3.5 Evaluation In order to evaluate the results from the AutoML tools and AutoOneClass, we adopted a similar approach to the benchmark developed by Ferreira, Pilastri, Martins, et al. (2021). For every predictive experiment, we divided the dataset into 10 folds for an external cross-validation and adopted an internal 5-fold cross-validation (i.e., over the training data) for the AutoML tools, to select the best algorithm and hyperparameters (executed automatically by the AutoML tools). To evaluate the test set (from external 10-fold validation) predictions we used the MAE (∈[0.0,∞[, where 0.0 represents a perfect model) for the regression task and the AUC analysis (∈[0.0,1.0], where 1.0 indicates an ideal classifier) for the binary classification targets. We also used MAE and AUC for the internal validation, responsible for choosing the best ML model. For all ten AutoML tools, we defined a maximum training time of one hour (3,600 seconds) and an early stopping of three rounds, when available. The maximum time of one hour was chosen since it is the default value for most of the AutoML tools. We computed the average of the evaluation measures on the test sets of the 10 external folds to provide an aggregated value. Additionally, we use confidence intervals based on the 𝑡-distribution with 95% confidence to verify the statistical significance of the experiments. In order to identify the best results for each target, we chose the AutoML tool with the best average predictive performance (with maximum precision of 0.01). All experiments were executed using an Intel Xeon 1.70GHz server with 56 cores and 64GB of RAM, without a GPU. 4.4 Results 4.4.1 AutoML Results The first comparison focused on the supervised AutoML tools detailed in Section 4.3.1. For each AutoML tool, we executed five experiments, one for each target variable (DaysToNextFailure and FailOn𝑥Days). Table 20 shows the average external test scores for all 10 folds and the respective confidence intervals (near the ±symbol). For the best models of each target, we also apply the nonparametric Wilcoxon test for measuring statistical significance (Hollander et al., 2013). The best tool for the regression task (DaysToNextFailure) was AutoGluon, which produced the lowest average MAE. Besides AutoGluon, the two best tools were H2O AutoML and Auto-Sklearn. For this task, the maximum predictive difference among all tools was 79.07 points (days). On the other hand, the worst 65 CHAPTER 4. USING SUPERVISED AND ONE-CLASS AUTOMATED MACHINE LEARNING FOR PREDICTIVE MAINTENANCE Table 20: Average predictive results obtained by the AutoML tools (best values for each target in bold). Targets Days Until Next Failure Fail In 3 Days Fail In 5 Days Fail In 7 Days Fail In 10 Days MAE AUC AUC AUC AUC AutoDL Tools Auto-Keras 84.02±37.55 0.72±0.12 0.74±0.05 0.79±0.05 0.79±0.03 Auto-PyTorch 12.75±6.45 0.76±0.10 0.74±0.07 0.78±0.13 0.79±0.13 AutoML Tools Auto-Sklearn 6.20±0.50 0.82±0.10 0.84±0.08 0.90±0.05 0.91±0.04 AutoGluon 4.95a±0.57 0.98b±0.02 0.97c±0.02 0.98c±0.01 0.99c±0.01 H2O AutoML 5.53±0.62 0.98b±0.01 0.96±0.03 0.98c±0.01 0.98±0.01 MLJar 8.32±0.62 0.77±0.12 0.82±0.06 0.85±0.07 0.89±0.05 PyCaret 7.91±1.20 0.77±0.11 0.80±0.07 0.86±0.05 0.89±0.04 rminer 8.89±0.75 0.95±0.05 0.93±0.04 0.97±0.03 0.98±0.02 TPOT 7.05±0.57 0.97±0.03 0.96±0.02 0.98c±0.01 0.99c±0.01 TransmogrifAI 17.34±1.23 0.92±0.04 0.94±0.03 0.96±0.02 0.98±0.01 aStatistically significant (p-value <0.05) under a pairwise comparison when compared with the tools: Auto-Keras, Auto- PyTorch, Auto-Sklearn, MLJar, PyCaret, rminer, TPOT, and TransmogrifAI. bStatistically significant (p-value <0.05) under a pairwise comparison when compared with the tools: Auto-Keras, Auto- PyTorch, MLJar, PyCaret, and TransmogrifAI. cStatistically significant (p-value <0.05) under a pairwise comparison when compared with the tools: Auto-Keras, Auto- PyTorch, MLJar, and PyCaret. tool was Auto-Keras, which produced an average MAE of 84.02 days, a significantly higher value when compared to the remaining AutoML and AutoDL tools. As for the binary classification, AutoGluon was the best tool for all four binary classification targets, followed by H2O AutoML and TPOT (best in two targets each). The binary classification results show that the AutoDL tools (Auto-Keras and Auto-PyTorch) performed significantly worse than the AutoML tools, obtaining lower AUC results than all these tools. Nonetheless, the predictive test set results also present significant discrepancies between tools: maximum difference of 26 percentage points (pp) for FailOn3Days, 23 pp for FailOn5Days, 20 pp for FailOn7Days, and 20 pp for FailOn10Days. However, when excluding the AutoDL tools, these differences are smaller: maximum difference of 21 pp for FailOn3Days, 17 pp for FailOn5Days, 13 pp for FailOn7Days, and 10 pp for FailOn10Days. Even though the AutoDL tools show, in general, worse results, they obtained similar results between each other, with the maximum predictive difference of 4 pp (for the target FailOn3Days) between Auto-Keras and Auto-PyTorch. Additionally, we analyzed the training times (average of the external 10 folds) and respective confidence intervals of the AutoML tools, shown in Table 21. The slowest tool was Auto-Sklearn, which always required the maximum allowed training time (3,600 s), followed by Auto-Keras (average of 2,550 s per external fold and dataset) and MLJar (average of 2,015 s). On the other hand, PyCaret presented the lowest average value (206 s), best in two datasets; AutoGluon - second best average value (396 s), best in three datasets; rminer - third best average (440 s). 66 4.4. RESULTS Table 21: Average training times (in seconds) obtained by the AutoML tools (best values for each target in bold). Targets Days Unitl Next Failure Fail In 3 Days Fail In 5 Days Fail In 7 Days Fail In 10 Days AutoDL Tools Auto-Keras 2532±1137 2579±516 3374±2135 3209±1233 1055±291 Auto-PyTorch 1514±116 1450±161 1262±107 1524±111 1334±155 AutoML Tools Auto-Sklearn 3600±0 3600±0 3600±0 3600±0 3600±0 AutoGluon 130±9143±12 146±17 264±243 1296±291 H2O AutoML 643±573 495±180 635±310 831±596 2764±613 MLJar 1519±57 1607±42 1653±46 2066±413 3232±770 PyCaret 178±9 193±4 200±5208±19 253±41 rminer 329±10 355±4 361±6 378±22 776±721 TPOT 1552±770 1936±1020 2032±774 1839±804 1903±1206 TransmogrifAI 656±10 688±6 710±16 739±7 777±3 The overall results suggest that AutoML tools that focus on classical ML algorithms (e.g., DTs, RF) are best suited to help the Portuguese company to predict failures for their equipments. Nonetheless, the AutoDL predictive results might be justified by the small size of the analyzed dataset (which contains only 2,608 records) since it is generally accepted that DL tends to produce better results with large datasets (Ng, 2020). Also, since the experiments did not use GPU, the maximum training time of one hour might have not allowed the AutoDL tools to perform enough computation to achieve competitive results. 4.4.2 AutoOneClass Results The second predictive comparison considers the AutoOneClass method, proposed and described in Section 4.3.2. Given that the method only works for binary classification tasks, the regression task was not considered in these predictive tests. Instead, we performed several experiments with different parameters, such as the type of validation, the used algorithms, and the type of optimization (single or multi-objective). We executed all the AutoOneClass experiments with an initial population of 10 individuals and 10 generations (GE parameters). The summary of the different parameters used in the experimental evaluation is shown in Table 22. We note that we adopted the default PonyGE2 values for crossover and mutation, namely: Variable Onepoint crossover (selection of a different point on each parent genome for crossover to occur) with a crossover probability of 75%; and Int Flip Per Codon mutation (random mutation of every individual codon in the genome) with a mutation probability of 100%. Table 23 shows the average test results of the 10 folds and the respective confidence intervals. The table also shows the type of validation (Validation) that was used, which algorithms were considered (Alg.), and which of the two available optimization modes (single-objective or multi-objective) was chosen (Opt.). For comparison reasons, the table also shows, for each binary classification target, the best AutoDL 67 CHAPTER 4. USING SUPERVISED AND ONE-CLASS AUTOMATED MACHINE LEARNING FOR PREDICTIVE MAINTENANCE Table 22: Parameters used for the AutoOneClass experiments and respective values. Parameter Used Values Population Size 10 Number of Generations 10 Crossover Variable Onepoint with 75% crossover probability (PonyGE2 default) Mutation Int Flip Per Codon with 100% mutation probability (PonyGE2 default) Validation Type Supervised Unsupervised Algorithm Autoencoder Isolation Forest One-Class SVM All (the three algorithms simultaneously) Optimization Type Single-objective Multi-objective Predictive Objective Maximize Validation AUC (for supervised validation) Minimize Reconstruction Error (for AE unsupervised validation) Minimize Anomaly Score (for IF and OC-SVM unsupervised validation) Effiency Objective None (for single-objective) Training Time (for multi-objective) Targets FailOn3Days FailOn5Days FailOn7Days FailOn10Days and AutoML results (from Table 20). For the best models of each target, we apply the nonparametric Wilcoxon test for measuring statistical significance. It is worth mentioning that, for the single-objective executions, the average test results shown on the table represent the average of the best models (one model per fold) since this type of optimization only considers the predictive performance of the ML models and is able to identify one “leader” model. On the other hand, for the multi-objective optimization, the average results include several models per fold (all that belong to the Pareto front), since it considers two objectives (predictive performance and training time). Therefore it generates more than one optimal model per fold. The results show that, on average, the executions that used a supervised validation (using a labeled validation set) achieved better results than those with unsupervised validation sets (using unlabeled validation data). While the supervised validation achieved an average 0.73 of AUC (across all algorithms and optimization types), the unsupervised validation obtained 0.66 points, on average. Regarding the previously discussed topic related to the usage of the anomaly scores as a proxy for the AUC for the unsupervised validation (mentioned in Section 4.3.2), we note that these experimental results have shown that the improvement of the supervised validation is relatively small (average of 7 percentage points), thus backing the usage of the anomaly score minimization criterion for the unsupervised validation scenario. When comparing the types of algorithms considered in these experiments (AEs, IF, OC-SVM, or the 68 4.4. RESULTS Table 23: Average predictive results (AUC) obtained by the proposed AutoOneClass method (best values obtained by AutoOneClass for each target in bold). Targets xValidation Alg. Opt.∗Fail In 3 Days Fail In 5 Days Fail In 7 Days Fail In 10 Days AutoOneClass Supervised AE SO 0.73±0.01 0.67±0.00 0.72±0.01 0.71±0.01 Supervised AE MO 0.67±0.05 0.64±0.01 0.71±0.01 0.69±0.01 Supervised IF SO 0.79±0.01 0.80b±0.02 0.80b±0.01 0.80c±0.02 Supervised IF MO 0.77±0.02 0.77±0.02 0.79±0.01 0.77±0.01 Supervised OC-SVM SO 0.70±0.01 0.67±0.01 0.70±0.01 0.67±0.01 Supervised OC-SVM MO 0.68±0.02 0.66±0.01 0.67±0.02 0.67±0.02 Supervised All SO 0.80a±0.05 0.76±0.06 0.77±0.04 0.77±0.03 Supervised All MO 0.76±0.06 0.77±0.06 0.77±0.05 0.75±0.03 Unsupervised AE SO 0.71±0.02 0.64±0.01 0.71±0.01 0.69±0.01 Unsupervised AE MO 0.67±0.05 0.63±0.02 0.71±0.01 0.69±0.01 Unsupervised IF SO 0.70±0.05 0.68±0.04 0.71±0.03 0.69±0.02 Unsupervised IF MO 0.66±0.06 0.69±0.04 0.71±0.04 0.67±0.07 Unsupervised OC-SVM SO 0.62±0.06 0.60±0.07 0.55±0.06 0.65±0.06 Unsupervised OC-SVM MO 0.60±0.08 0.57±0.06 0.55±0.06 0.63±0.08 Best NAS/AutoDL result 0.76±0.10 0.74±0.07 0.79±0.05 0.79±0.03 Best AutoML result 0.98±0.01 0.97±0.02 0.98±0.01 0.99±0.01 ∗SO - Single-objective; MO - Multi-objective. aStatistically significant (p-value <0.05) under a pairwise comparison when compared with all the other setups except: Supervised/IF/SO and Supervised/IF/MO. bStatistically significant (p-value <0.05) under a pairwise comparison when compared with all the other setups except: Supervised/All/MO. cStatistically significant (p-value <0.05) under a pairwise comparison when compared with all the other setups except: Supervised/All/SO. three simultaneously), the mode with all three algorithms simultaneously generated the best results, with an average AUC of 0.77. Next, the second best algorithm was IF (average of 0.74 AUC), followed by AE (average of 0.69 AUC), and the OC-SVM algorithm obtained the worst results, with 0.64 of average AUC. Another interesting result was that the single-objective executions only achieved slightly better predictive results than the multi-objective ones. Indeed, grouping the results by type of validation and algorithm, the average difference between the single-objective and multi-objective results was 0.02 pp . These differences can be further analyzed in Fig. 15. Similar to the previous experiment, we also analyze the average training times for the AutoOneClass results, shown in Table 24. The results show that the average training times of AutoOneClass when using AEs were much higher than the other algorithms (average training time of 2,732 s across all folds and datasets). On the other hand, OC-SVM presented the lowest average training time (85 s), followed by IF (194 s) and lastly the setup which uses all algorithms (538 s). A comparison between the predictive results achieved by the proposed AutoOneClass method (shown in Table 23) and the AutoML results (shown in Table 20) shows that none of the AutoOneClass executions 69 CHAPTER 4. USING SUPERVISED AND ONE-CLASS AUTOMATED MACHINE LEARNING FOR PREDICTIVE MAINTENANCE Figure 15: AutoOneClass results aggregated by validation type, algorithm, and optimization type, both globally (left) and per target (right). outperformed the best AutoML tools on all four binary classification targets. However, when comparing the AutoOneClass results only with AutoDL tools, AutoOneClass generated at least one result better than all of the AutoDL tools (Auto-Keras and Auto-PyTorch). It should be stressed that the AutoOneClass method requires much less labeled data to train the ML models (only uses labeled data for the supervised validation), when compared with the supervised AutoML tools, which typically require a labeled dataset with a balanced ratio of normal and abnormal records. In 70 4.4. RESULTS Table 24: Average training times (in seconds) obtained by the proposed AutoOneClass method (best values obtained by AutoOneClass for each target in bold). Targets Validation Alg. Opt.∗Fail In 3 Days Fail In 5 Days Fail In 7 Days Fail In 10 Days AutoOneClass Supervised AE SO 2349±945 3151±1250 3215±1566 2352±928 Supervised AE MO 4747±2265 3053±1186 2242±888 3109±1220 Supervised IF SO 157±49 177±71 191±86 255±100 Supervised IF MO 123±45 213±75 87±32 159±64 Supervised OC-SVM SO 136±53 115±45 106±42 93±37 Supervised OC-SVM MO 108±43 116±45 96±39 84±33 Supervised All SO 571±209 464±188 598±239 609±238 Supervised All MO 729±243 491±189 416±161 422±151 Unsupervised AE SO 2700±1073 2563±1005 2352±918 2430±921 Unsupervised AE MO 2418±931 2396±965 2282±874 2348±911 Unsupervised IF SO 468±207 365±153 229±104 146±56 Unsupervised IF MO 94±42 168±62 198±75 71±30 Unsupervised OC-SVM SO 74±28 67±26 59±22 66±26 Unsupervised OC-SVM MO 63±24 63±23 48±21 64±25 Best NAS/AutoDL result 1514±116 1450±161 1262±107 1334±155 Best AutoML result 130±9 143±12 146±17 208±19 ∗SO - Single-objective; MO - Multi-objective. many real-world PdM scenarios, there is a huge number of normal records and anomaly records might not always be available. Thus, AutoOneClass could be valuable in PdM use cases, when most of the data is comprised by normal data and where anomaly records are costly to be collected and labeled (e.g., equipment condition monitoring, failure detection). We note that these experiments had some limitations that might present disadvantages for the AutoOneClass method. First, the training time of one hour might have been insufficient for tools that rely on DL algorithms (e.g., AEs, AutoDL tools), in particular since no GPU is used. Second, the usage of a larger dataset could have improved both AutoOneClass and AutoDL predictive results. Third, GE optimization used fixed values (PonyGE2 default) for some of the parameters, such as the crossover and mutation operators. 4.4.3 Comparison With a Human ML Modeling Finally, we compare the best AutoML results for each target with the best result achieved by two examples of a human ML modeling, as performed by a non-ML expert belonging to the analyzed Portuguese software company and an external ML expert. Table 25 compares the prediction results achieved using the manual ML design and best AutoML tools. For each AutoML tool, Table 25 includes the algorithm (Alg.) that was most often the leader across the external folds (in rounded brackets). For the human modeling, Table 25 71 CHAPTER 5. AUTOOC: AUTOMATED MULTI-OBJECTIVE DESIGN OF DEEP AUTOENCODERS AND ONE-CLASS CLASSIFIERS USING GRAMMATICAL EVOLUTION associated with a slightly lower performance. Indeed, reducing the computational training time is particularly valuable within the OCC domain, since most of the analyzed datasets are unlabeled and thus often rather large. 5.4.1 Acceleration Mechanisms and Objective Functions As explained in Section 5.3, the training data Dtrain is composed only of data from one class (“normal”data). OCC typically involves a large set of unlabeled data, thus performing an evolutionary optimization in this domain is a computationally demanding task. In order to speed up the GE execution time, AutoOC adopts two recently proposed computationally efficient mechanisms (Pereira et al., 2021). Firstly, AutoOC uses a periodic sampling mechanism, where each 𝑔generation of the GE optimization uses the random sample D𝑔 𝑡𝑟𝑎𝑖𝑛 that includes 𝑠<𝑛examples from the entire training dataset. For an example dataset with 𝑛=10,000 records and a sample size of 𝑠=2,500, each generation of the GE optimization will use𝑠=2,500 randomly sampled records to train the OCC models. The sampling is applied to the entire dataset at the beginning of each generation and it is performed with replacement (similarly to the bagging ML ensemble method), meaning that a specific record can be chosen more than once. The reason for this approach is related to an acceleration of the total optimization time, since training the models on a small sample of a dataset will be faster than training all the individuals on an entire dataset, especially if the dataset has a huge number of records (e.g., millions of records). On the other hand, the fact that each generation uses a different set of examples will allow the optimization to avoid overfitting the training set since the training data is always different. Secondly, each 𝐴𝑖 𝜆solution is trained in a parallel manner, where a M𝑖 𝜆model is obtained by applying the 𝐴𝑖 𝜆algorithm to the D𝑔 𝑡𝑟𝑎𝑖𝑛 dataset. This means that, for each generation, more than one individual can be trained at the same time using different cores (processors). In practice, when the used machine has more cores than the population size, it is possible to train all the individuals at the same time. For each trained M𝑖 𝜆model, AutoOC stores the value of L2(𝐴𝑖 𝜆,D𝑔 𝑡𝑟𝑎𝑖𝑛), which corresponds to the time elapsed to obtain M𝑖 𝜆when using a single core, in seconds. This L2value corresponds to the second objective function, which guides the Osearch in terms of minimizing the OCC training computational effort. AutoOC is primarily designed for anomaly detection tasks, where most examples are “normal”records. While the training only uses normal examples, the OCC predictive performance validation can be performed using two distinct setups (Ferreira et al., 2022): unsupervised validation, where the model performance is evaluated using only Dvalid𝑈unlabeled data (e.g., through an anomaly score), or supervised validation, where there is access to a (often smaller) Dvalid𝑆labeled validation set to assess the model performance by using supervised learning metrics, such as the popular AUC of the ROC curve classification measure (Fawcett, 2006). All OCC models produce an anomaly score (𝑆𝑗) for a particular x𝑗data example. The M𝑖 𝜆validation or test anomaly scores are first normalized within the 𝑆𝑖∈ [0,1]range by applying a min-max normalization using the training data. Two relevant performance measures adopted in this work are the average anomaly 78 5.4. PROPOSED METHOD: AUTOOC score (𝑆) and AUC: 𝑆=1 𝑙∑𝑙𝑗=1𝑆𝑗 𝐴𝑈𝐶 =∫1 0 ROC 𝑑𝑇ℎ (5.2) where 𝑙denotes the length of the predicted data (e.g., 𝑙=𝑚for a validation set) and 𝑇ℎ ∈ [0,1]is a threshold decision value, allowing to interpret the predicted anomaly class as positive if 𝑆𝑖>𝑇ℎ. The ROC curve plots the False Positive Rate (FPR) versus the True Positive Rate (TPR) for all threshold values. AUC is a popular binary classification measure of performance, providing two main advantages (Coelho et al., 2022). Firstly, quality values are not influenced by the presence of unbalanced data, which occurs in OCC tasks. Secondly, the AUC values can be easily interpreted as follows: 50% – performance of a random classifier; 60% - reasonable; 70% - good; 80% - very good; 90% - excellent; and 100% - perfect. In this study, we explore the two OCC validation modes (supervised and unsupervised), which lead to two distinct fitness functions that measure OCC generalization error performance (L1, the first objective function). For the supervised validation, the generalization error performance (to be minimized), is defined as L1(𝐴𝑖 𝜆,Dvalid𝑆)=1−AUC. The lower the L1value, the better will be the OCCAUC predictive performance. Under the unsupervised validation mode, labeled data (i.e., abnormal examples) is not available, making the computation of the AUC infeasible. Therefore, to select the best MLmodels, the average anomaly score (𝑆) is used as a proxy for the 1-AUC computation: L1(𝐴𝑖 𝜆,Dvalid𝑈)=𝑆. The idea is that if a model produces a low anomaly score when trained on a large set of normal data, it should be capable of generating high anomaly scores for abnormal data, resulting in a satisfactory ROC curve. Nevertheless, it is important to note that to accurately benchmark the unsupervised validation scenario, labeled data was used in the test set, allowing the computation of ROC curves and AUC measures, which were then compared to those obtained using the supervised validation scenario. Table 26 summarizes the type of data used for each validation setup. Table 26: Validation modes for AutoOC. Validation Mode Training Set Validation Set Test Set Supervised Unlabeled Data Labeled Data Labeled Data Unsupervised Unlabeled Data Unlabeled Data Labeled Data 5.4.2 Pseudo-code The pseudo-code for our proposed AutoOC is illustrated in Algorithm 1. There are four main inputs, the training and validation sets (Dtrain and Dvalid, the sampling size (𝑠), the maximum number of generations (𝐺) and the population size (𝑁𝑃). The search algorithm (O) combines a GE with a multi-objective NSGAII optimization. The GE elements are used to generate the initial population and breed new individuals (through crossover and mutation operators). As for the NSGA-II procedures, they enforce a simultaneous multi-objective search in terms of selecting interesting new population individuals and the best set of Pareto 79 CHAPTER 5. AUTOOC: AUTOMATED MULTI-OBJECTIVE DESIGN OF DEEP AUTOENCODERS AND ONE-CLASS CLASSIFIERS USING GRAMMATICAL EVOLUTION solutions. Moreover, the two AutoOC acceleration mechanisms are implemented in lines 6 (periodic random sampling) and 7 (parallel execution of the training algorithm and computation of its validation measures). After 𝐺generations (the termination criteria), the search returns the best searched Pareto front of solutions (B). Algorithm 1 AutoOC pseudo-code. 1: Inputs: Dtrain,Dvalid,S,𝑠,𝐺, 𝑁𝑃⊲Training and validation sets, search space, training sample size, maximum number of generations and population size 2: B ← ∅ ⊲Initialize B 3: P0←𝑐𝑟𝑒𝑎𝑡𝑒(S, 𝑁𝑃)⊲Initial GE population with {𝐴1 𝜆, ..., 𝐴𝑁𝑃 𝜆}solutions 4: 𝑔←0 5: while 𝑔<𝐺do ⊲Cycle up to 𝐺generations 6: D𝑔 train ←𝑠𝑎𝑚𝑝𝑙𝑒(Dtrain, 𝑠)⊲Random sample of size 𝑠 7: 𝐹𝑔←𝑒𝑣𝑎𝑙𝑢𝑎𝑡𝑒(P𝑔,D𝑔 train,Dvalid)⊲Fitness values (L1and L2) for P𝑔 8: P𝑔← P𝑔∪ B ⊲Add Bto current population 9: B ← ∅ ⊲Reinitialize B 10: if 𝐴𝑖 𝜆∈ P𝑔is a NSGA-II interesting (e.g., non-dominated) solution then ⊲Apply NSGA-II 11: B ← B ∪ 𝐴𝑖 𝜆⊲Add 𝐴𝑖 𝜆to the set of best Pareto solutions 12: end if 13: P𝑔+1←evolve(P𝑔)⊲Apply GE crossover and mutation operators and NSGA-II selection 14: 𝑔←𝑔+1⊲Increment 𝑔 15: end while 16: 17: return B⊲Return best solutions (Pareto front of OCC models) 5.4.3 Base Learners AutoOC uses up to five popular OCC algorithms: AEs, IF, LOF, OC-SVM, and VAEs. The AEs and VAEs were implemented through the Keras module of TensorFlow library (Martín Abadi et al., 2015), while IF, LOF, and OC-SVM used the Scikit-Learn framework (Pedregosa et al., 2011). Table 27 summarizes the five adopted base learners in terms of: the name of the (Algorithm), the base (Framework), used (Version), and (API) documentation reference. Additional details about the base learners are provided in Section 2.2.3. Table 27: Characteristics of the base learners used by AutoOC. Algorithm Framework Version API Isolation Forest (IF) Scikit-Learn 1.2.0 (Scikit-Learn, 2022a) Local Outlier Factor (LOF) Scikit-Learn 1.2.0 (Scikit-Learn, 2022b) One-Class SVM (OC-SVM) Scikit-Learn 1.2.0 (Scikit-Learn, 2022c) Autoencoder (AE) TensorFlow 2.6.0 (TensorFlow, 2022a) Variational Autoencoder (VAE) TensorFlow 2.6.0 (TensorFlow, 2022b) 80 5.4. PROPOSED METHOD: AUTOOC 5.4.4 AutoOC Grammar In this study, we used an open-source implementation of GE in Python (PonyGE2) to develop AutoOC. PonyGE2 (Fenton et al., 2017) allows for the use of Python BNF (PyBNF), which enables the inclusion of Python code in the production rules. To build AutoOC, a PyBNF grammar was developed to tune the hyperparameters of the OCC algorithms described in Section 5.4.3. The use of PyBNF allowed for the generation of Python code snippets that enabled GE to produce various types of ML models. For example, the IF, LOF, and OC-SVM grammars were implemented by creating the corresponding Scikit-Learn class and adding the hyperparameters as terminals and non-terminals. We note that the proposed grammar includes all IF, LOF, and OC-SVM hyperparameters that were available in the consulted Scikit-Learn documentation (see Table 27). The process was different for the AEs and VAEs, as the TensorFlow API requires the definition of a variable number of layers. To address this, the grammar was designed to generate only the encoder: first, an input layer with the same number of nodes as the number of attributes in the dataset is generated, followed by a variable number of hidden layers. Given that in a typical AE or VAE the subsequent encoder layers have fewer nodes than the previous layer, the layer nodes were defined as a percentage (between 0% and 100%) of nodes in the previous layer rather than a fixed number. Two auxiliary functions, (get_ae_from_encoder and get_vae_from_encoder), were also defined to translate the generated phenotype into functional TensorFlow AEs and VAEs. The decoder, which is symmetrical to the encoder, was not included in the grammar. Besides the ANN structure, DL architectures include a large number of additional hyperparameters. In order to reduce the search space, using modeling knowledge from previous OCC works (e.g., (Coelho et al., 2022; Ribeiro et al., 2022)) we fixed some choices, such as the usage of the MAE measure as the loss function for both AE and VAE and usage of Batch Normalization layers for AE. We also restricted the search space for some hyperparameters. For instance, only two optimizers are explored to adjust the AE weights (RMSprop and Adam). Moreover, while the analyzed TensorFlow version provides up to 16 activation functions, the proposed grammar only searches for the best of eight of these functions (e.g., ReLU). Nevertheless, in future works and if needed, the grammar can be easily adapted to include other DL hyperparameter choices. The proposed grammar of AutoOC defines the OCC search space (S) and is flexible enough to allow the usage of any combination of the five base learners (Section 5.4.3) or even include other OCC algorithms. In this work, we empirically study the effect of two AutoOC variants: NE – assuming only the deep AE and VAE base learners (thus 𝑘=2), working as a pure NAS optimization; ALL – where all 𝑘=5five base learners are used during the optimization, working as a more general AutoML OCC search. The developed PyBNF grammar for the “ALL” mode is shown in Fig. 16. The grammar for the “NE” mode follows a similar logic, using only the AEs and VAEs entries. 81 CHAPTER 5. AUTOOC: AUTOMATED MULTI-OBJECTIVE DESIGN OF DEEP AUTOENCODERS AND ONE-CLASS CLASSIFIERS USING GRAMMATICAL EVOLUTION Figure 16: The adopted PyBNF grammar (for the full “ALL” search space representation mode). 82 5.5. EXPERIMENTAL RESULTS 5.5 Experimental Results 5.5.1 Datasets A total of eight public domain datasets (Table 28) were retrieved from OpenML (Vanschoren et al., 2013), an open platform for sharing datasets and ML experiments. As selection criteria, we opted to select binary classification tasks from distinct application domains (e.g., banking, telecommunications) and reflecting different numbers of instances (Rows), categorical (Categorical Columns) and numerical attributes (Numerical Columns), and output target class balancing (Class Balancing). We particularly selected datasets with a clear distinction between the two classes, where the majority class could be considered as “normal” and the minority class as an “anomaly” state. Table 28 also details the name of the dateset (Dataset) and the unique OpenML identifier (OpenML ID). Table 28: Description of the selected OpenML datasets. Dataset OpenML ID∗Rows Categorical Columns Numerical Columns Class Balancing (“normal”/“anomaly”) Bank Marketing 1461 45,211 16 9 88%/12% Churn 40701 5,000 4 16 86%/14% Credit Card 44235 284,807 0 30 99%/1% EEG 1471 14,980 0 14 55%/45% Mushroom 24 8,124 23 0 52%/48% Nomao 1486 34,465 30 89 71%/29% Phoneme 1489 5,404 0 5 70%/30% Spambase 44 4,601 0 57 60%/40% ∗The datasets can be retrieved by entering their OpenML unique identifier (ID) at the following URL: http://www.openml.org/ search?type=data&id=ID. Since AutoOC focuses on algorithm selection and hyperparameters, the datasets need to be preprocessed before feeding them into the OCCbase learners. In order to achieve a fair comparison, the same fixed data preprocessing is applied to all datasets. Since none of the base learners deals with data attributes of type String, we encoded all String attributes into numerical types. For categorical attributes with low cardinality (ten levels or fewer), we applied the popular one-hot encoding. For categorical columns with missing values, we replaced the missing values with zero, which is treated as a numeric code value for the “unknown” level. As for high cardinality categorical attributes, the one-hot transform produces a large number of binary inputs, which highly affects the computational performance (in terms of both memory and processing time). Thus, for these attributes, we employed instead the IDF technique, available in the Python CANE module (Matos et al., 2022), which converts a categorical column into a numerical column of positive values based on the frequency of each attribute level. IDF uses the function 𝑓(𝑥)=𝑙𝑜𝑔(𝑛/𝑓 𝑥), where 𝑛is the length of 𝑥 and 𝑓(𝑥)is the frequency of 𝑥. This technique has the advantage of generating just one numeric column 83 CHAPTER 5. AUTOOC: AUTOMATED MULTI-OBJECTIVE DESIGN OF DEEP AUTOENCODERS AND ONE-CLASS CLASSIFIERS USING GRAMMATICAL EVOLUTION for each attribute, thus reducing the ML computational effort. For the remaining attributes of Integer and Float types, we applied a z-score standardization (Hastie et al., 2009), which results in a new scale with a mean of zero and standard deviation of one. The missing values in numerical columns were also replaced with the mean value for that column (mean imputation). 5.5.2 Experimental Setup All experiments were run on an Intel Xeon 1.70 GHz server with 56 cores and 64 GB of RAM, without a GPU. When running AutoOC, we stored two types of time elapsed times (in seconds), the overall GE execution time and the training time required by the OCC algorithms. To assess the performance of AutoOC, we followed an approach based on the benchmark in (Ferreira, Pilastri, Martins, et al., 2021). We divided the datasets into 10 folds to obtain an external cross-validation, which is used to get test (unseen) data that allows measuring the predictive generalization performance of the selected OCC model. As for the training data, it is further split by applying an internal and random holdout split, where 75% of the data is used for fitting purposes (D𝑔 train) and the remaining 25% is used for validation purposes (Dvalid). To evaluate the predictions on the test set from the external 10-fold validation, we employed the AUC analysis of the ROC curve (Fawcett, 2006). The obtained results are aggregated by computing the median of the evaluation measures across the 10 external folds and their respective 95% confidence intervals based on the nonparametric Wilcoxon test (Hollander et al., 2013), to determine the statistical significance of the experiments. 5.5.3 AutoOC Results For each dataset, we executed four AutoOC experiments, with two base learner configurations (NE and ALL) and both validation modes (supervised and unsupervised). Since it is unfeasible to evaluate every possible combination of the GE optimization parameters, we fixed some of these values using reasonable assumptions and some preliminary experiments performed using other OCC datasets. The summary of the different parameters used in the experimental evaluation is shown in Table 29. All experiments were executed with an initial random generated population of 20 individuals and 100 generations. Also, for the GE parameters of crossover and mutation, we adopted the default PonyGE2 values: Variable One-point crossover (selection of a different point on each parent genome for crossover to occur) with a crossover probability of 75%; and Int Flip Per Codon mutation (random mutation of every individual codon in the genome) with a mutation probability of 100%. Additionally, we applied both acceleration mechanisms described in Section 5.4.1, using a periodic random sampling, performed in each generation and applied to all the population individuals, of 𝑛=2,500 records and parallel training. Table 30 presents the results obtained by AutoOC on the eight open-source datasets described in Section 5.5.1. The table shows the median test set results of the external 10 folds and the respective confidence intervals for the predictions (Median AUC) and the efficiency (Median Training Time, in 84 5.5. EXPERIMENTAL RESULTS Table 29: GE parameters used for the experiments. Parameter Used Values Population Size (𝑁𝑃) 20 Number of Generations (𝐺) 100 Crossover Variable One-point with 75% crossover probability (PonyGE2 default) Mutation Int Flip Per Codon with 100% mutation probability (PonyGE2 default) Base Learners Setup ALL (used algorithms: AE, IF, LOF, OC-SVM, VAE) NE (used algorithms: AE, VAE) Optimization Type Multi-objective (NSGA-II) Predictive Objective Minimize validation 1-AUC (L1for supervised validation) Minimize validation average anomaly score 𝑆(L1for unsupervised validation) Efficiency Objective Minimize training time (L2) Validation Type Supervised Unsupervised Sampling size 𝑠=2,500 Parallel Training True seconds). It is worth noting that, since these experiments apply a multi-objective approach, each external fold generates more than one optimal model per fold (all that belong to the Pareto front). Thus, we divided the AUC and training time median results into three columns each. The predictions (Pred.) column only considers the individuals from the Pareto front with the best predictive objective score; the Speed column considers the Pareto front individuals with the least training time (efficiency objective, in seconds); the column Pareto considers all the individuals belonging to the Pareto front. Table 30 also shows the median time needed for the GE optimization (Median GE Time) with confidence intervals, the type of validation (V) that was used, and which base learner setup was considered (BL). For the best results of each dataset (AUC, training time, and GE time; values highlighted using a boldface font), we apply the nonparametric Wilcoxon test for measuring statistical significance. Regarding the predictive performance, the ALL mode with supervised validation achieved the best median AUC on the test set for: seven of the eight datasets when considering predictive power; three datasets when considering the training speed; and six datasets when considering the entire Pareto front. In these scenarios, the supervised ALL achieved a median of 11.0 AUC Percentage Points (pp) higher than the respective second-best configuration for predictive mode, 2.0 pp for speed mode, and 5.5 pp for the Pareto mode. An interesting result was obtained by the Credit Card dataset, achieving the best predictive results exclusively with NE approaches, namely with the supervised validation mode. This setup obtained, on median, 1.0 AUC pp higher than the second-best setup for predictive mode, 9.0 pp for speed mode, and 6.0 pp for the Pareto mode. When considering the total GE execution time, the unsupervised ALL approach required a median value of 702 s across all datasets, followed by supervised ALL (716 s), supervised NE (2,009 s), and unsupervised NE (2,025 s). These results can be explained by the training time required by the deep ANNs 85 CHAPTER 5. AUTOOC: AUTOMATED MULTI-OBJECTIVE DESIGN OF DEEP AUTOENCODERS AND ONE-CLASS CLASSIFIERS USING GRAMMATICAL EVOLUTION Table 30: AutoOC experimental results (best values for each measure in bold). Dataset BL V∗Median AUC Median Training Time Median GE Time Pred. Speed Pareto Pred. Speed Pareto Bank ALL S 0.72a±0.01 0.52±0.02 0.63a±0.01 0.29c±0.20 0.01c±0.00 0.05a±0.03 740c±57 Bank ALL U 0.62±0.03 0.55±0.04 0.58±0.01 0.41±0.02 0.01±0.00 0.11±0.03 758±34 Bank NE S 0.62±0.01 0.56±0.00 0.59±0.00 8.48±1.59 1.55±0.09 3.98±0.74 2,002±102 Bank NE U 0.65±0.02 0.58b±0.03 0.60±0.02 9.46±0.86 3.27±0.65 6.14±0.43 1,505±44 Churn ALL S 0.75a±0.01 0.56b±0.02 0.65a±0.01 0.01a±0.02 0.01c±0.00 0.01a±0.00 691±81 Churn ALL U 0.62±0.03 0.55±0.01 0.59±0.01 0.27±0.02 0.01±0.00 0.08±0.01 645c±38 Churn NE S 0.63±0.01 0.55±0.00 0.60±0.01 7.13±1.24 1.33±0.10 3.47±0.25 1,657±29 Churn NE U 0.53±0.01 0.52±0.02 0.53±0.00 7.50±0.82 2.12±0.39 3.92±0.22 1,389±24 Credit ALL S 0.92±0.00 0.80±0.08 0.88±0.01 0.13a±0.04 0.01c±0.00 0.04a±0.02 949c±125 Credit ALL U 0.97±0.09 0.84±0.01 0.89±0.04 0.48±0.04 0.01±0.00 0.15±0.02 1,191±448 Credit NE S 0.98e±0.00 0.93a±0.00 0.95a±0.00 7.25±0.81 1.19±0.08 3.56±0.54 2,211±202 Credit NE U 0.91±0.10 0.89±0.01 0.90±0.02 10.79±1.28 2.54±0.58 5.31±0.47 4,208±1430 EEG ALL S 0.68a±0.03 0.51±0.01 0.59a±0.02 0.22c±0.43 0.01±0.00 0.05c±0.15 617c±230 EEG ALL U 0.56±0.01 0.52b±0.02 0.53±0.03 0.27±0.12 0.01c±0.00 0.06±0.02 645±41 EEG NE S 0.52±0.02 0.49±0.02 0.51±0.01 5.53±2.45 1.36±0.12 2.82±0.81 3,798±965 EEG NE U 0.51±0.00 0.51±0.00 0.51±0.01 7.99±1.32 1.88±0.13 3.95±0.21 1,985±56 Mushroom ALL S 1.00d±0.00 0.62±0.13 0.81±0.05 0.27±0.06 0.01c±0.00 0.06±0.02 1,057±113 Mushroom ALL U 0.58±0.06 0.50±0.10 0.58±0.02 0.24c±0.04 0.01±0.00 0.03a±0.01 998c±90 Mushroom NE S 0.99±0.04 0.82±0.20 0.87±0.02 9.22±1.46 2.08±0.15 3.99±0.23 2,016±1508 Mushroom NE U 0.99±0.04 0.83f±0.02 0.91a±0.02 9.46±1.35 2.62±0.19 5.31±0.49 2,041±31 Nomao ALL S 0.83a±0.02 0.62±0.06 0.73a±0.02 0.01a±0.00 0.01c±0.00 0.01a±0.00 885c±115 Nomao ALL U 0.63±0.05 0.59±0.02 0.62±0.09 0.46±0.09 0.01±0.00 0.07±0.02 905±58 Nomao NE S 0.70±0.01 0.50±0.01 0.63±0.01 5.62±1.58 1.89±0.14 3.08±0.63 1,901±67 Nomao NE U 0.68±0.02 0.67a±0.02 0.68±0.03 7.48±0.48 3.07±0.37 5.29±0.27 2,370±266 Phoneme ALL S 0.74a±0.01 0.57b±0.06 0.68a±0.01 0.01a±0.01 0.01c±0.00 0.01a±0.00 654±84 Phoneme ALL U 0.63±0.02 0.53±0.03 0.60±0.02 0.22±0.05 0.01±0.00 0.07±0.02 634c±81 Phoneme NE S 0.62±0.01 0.52±0.01 0.58±0.01 13.98±5.47 1.27±0.02 4.24±0.78 2212±88 Phoneme NE U 0.56±0.01 0.51±0.02 0.53±0.02 6.73±1.63 1.38±0.11 3.26±0.39 2192±134 Spambase ALL S 0.81a±0.01 0.62b±0.07 0.73a±0.01 0.12a±0.13 0.01±0.00 0.03a±0.03 608c±111 Spambase ALL U 0.68±0.04 0.59±0.00 0.63±0.04 0.29±0.02 0.01c±0.00 0.07±0.01 618±51 Spambase NE S 0.62±0.01 0.50±0.01 0.57±0.00 9.76±0.92 1.49±0.06 4.47±0.28 1,979±40 Spambase NE U 0.73±0.01 0.60±0.04 0.65±0.01 13.15±1.43 3.29±0.57 7.28±0.55 2,009±51 ∗Validation mode: S - Supervised; U - Unsupervised. aStatistically significant (p-value <0.05) under a pairwise comparison when compared with all the other setups. bStatistically significant (p-value <0.05) under a pairwise comparison when compared with none of the other setups. cStatistically significant (p-value <0.05) under a pairwise comparison when compared with the setups: Supervised NE and Unsupervised NE. dStatistically significant (p-value <0.05) under a pairwise comparison when compared with the setups: Unsupervised ALL. eStatistically significant (p-value <0.05) under a pairwise comparison when compared with the setups: Supervised ALL. fStatistically significant (p-value <0.05) under a pairwise comparison when compared with the setups: Supervised ALL and Unsupervised ALL. (either a traditional AE or a VAE), which is higher when compared with the other base learners. In effect, both ALL setups (supervised and unsupervised) tend to produce lightweight OCC models, presenting median training time values always lower than one second, and most of the times being only 0.01 s. In contrast, the setups with the NE variant present median training times ranging from 1.19 s and 13.98 s, 86 5.5. EXPERIMENTAL RESULTS with a median value of 3.99 s. Nevertheless, the total GE execution time results back the proposed AutoOC as a computationally efficient tool to model large OCC datasets. For instance, for the largest dataset (Credit Card, with around 285,000 examples), and when adopting the supervised validation mode, the ALL and NE variants only require a median GE optimization time of 949 s (around 16 minutes) and 2,211 s (around 37 minutes). In Section 5.5.4, we further compare these Credit execution time results (using the sampling mechanism) with a GE that uses all training data (no sampling). To further compare the obtained AutoOC results, we analyzed the Pareto fronts from the test set results. Given that each experiment is composed of ten test sets (one for each external fold), we aggregate the distinct Pareto fronts from each experiment. Inspired by the ROC curve vertical aggregation (Fawcett, 2006), we aggregate the results vertically. To facilitate the visual analysis, in all Pareto front graphs shown in this study, we assume the -AUC minimization objective on the 𝑥-axis and the training time minimization objective on the𝑦-axis. Thus, the ideal point corresponds to the bottom left corner of the Pareto graphs. For different values of -AUC, we estimate the Wilcoxon median training time and the respective 95% confidence intervals. The obtained median curves are presented in Fig. 17. The figure shows that for the ALL setups, the results are usually close in terms of training time, presenting differences that depend on the dataset but that tend to be small. As for the predictive performance, the supervised ALL tends to produce better AUC scores (e.g., Churn, EEG, Mushroom, Nomao, Phoneme, Spambase). As for the NE setups, the results usually present higher training times than the ALL setups. Moreover, the 95% confidence intervals usually do not overlap with the ALL setups, showing statistically significant differences. 5.5.4 Credit Card Dataset Results For more detailed results, we present in this section additional analyses of one of the datasets used in the experiments. We chose the Credit Card dataset to perform these analyses for two main reasons. Firstly, this dataset is a very accurate representation of a typical OCC learning scenario, since it has a large number of examples (284,807) and presents a huge unbalance between classes (with more than 99% of examples belonging to the “normal” class). Second, it is among the datasets that obtained the best experimental predictive results in Table 30. The first Credit Card analysis is related to the hypervolume, assuming a reference point of (AUC=0; maximum training time = 15 s). As a demonstration, we selected the first fold for each of the four experiments performed on the Credit Card dataset to evaluate the hypervolume evolution across the GE generations. For each generation, we computed the median hypervolume value of the current Paretooptimal front. Fig. 18 presents the evolution of the hypervolume measure (in percentage, 𝑦-axis) through the 100 generations of the GE optimization (𝑥-axis). The figure includes two plots, one for each validation mode, for a better comparison since different predictive objectives are being considered in each validation mode (AUC for supervised mode and anomaly score for unsupervised mode). The figure shows a fast hypervolume growth in the first 10 generations, even though it continues to increase until the end of the optimization, but at a lower rate. Three of the four curves present a period without significant improvements 87 Chapter 6 Conclusions This chapter presents the conclusion of this PhD thesis. First, Section 6.1 presents a summary of the overall PhD work. Then, Section 6.2 discusses the obtained results and identifies the limitations. Lastly, Section 6.3 presents future research directions. 6.1 Overview The current availability of an enormous amount of data, algorithms and powerful computing hardware, allows companies and ML practitioners to develop ML applications that can produce fast and accurate predictions (Darwiche, 2018). Currently, automation and efficiency are highlighted as two of the most important features of real-world ML applications. Automation is crucial to enable ML practitioners to manage tasks of the ML workflow effectively. The rise of non-specialists working with ML has increased the focus on automating ML tasks, leading to the emergence of AutoML. Efficiency is particularly beneficial for ML applications in the context of Big Data or when there are hardware limitations. Distributed or parallel learning, which involve using multiple machines or processors to process portions of the ML algorithm or the data, are often used to address these efficiency concerns. The main objective of this thesis is to contribute to the body of knowledge in the area of ML by designing and implementing an automated and efficient ML framework. Specifically, the PhD proposes a computationally efficient AutoML tool that uses a GE to automate the design of lightweight OCC ML models. The initial part of this PhD work was carried out under the IRMDA R&D project (Chapter 3). This project had an execution time of two years and it was aimed at developing a ML application for a Portuguese analytics company, in order to assist the company telecommunications clients. The main requirements of the ML system were automation and scalability. The proposed ML technological architecture was developed to be used by non-ML experts, by automating all typical tasks of a common supervised ML application and was designed to work within a computational cluster with several processing nodes. The training module of the proposed framework was developed using the H2O AutoML tool, given that it was the best performing tool that also allowed an distributed exectuion. The remaining modules were developed 94 6.1. OVERVIEW using Apache Spark distributed data processing capabilities. The AutoML benchmark also showed that the analyzed AutoML frameworks produced close results. These results can even outperform human ML modeling, in particular when considering GML AutoML tools. These first experiments aimed to explore existing AutoML frameworks, with particular focus on automated and distributed ML, and aimed to gain insights into the application of AutoML for supervised learning tasks. Furthermore, we sought to identify a reliable and robust evaluation method for the proposed AutoML framework. Following the initial experiments, the next part of this PhD was developed under the CMMS project (Chapter 4). CMMS focused on the application of ML algorithms for PdM, in particular to predict equipment failures. This project an execution time of approximately one year, which corresponded to the third year of this PhD project. Within this scope, we conducted the first preliminary experiments related to a novel AutoML framework by applying a GE to design and evolve different OCC ML algorithms using both single and multi-objective optimization. The first step was to apply state-of-the-art AutoML tools using a real-world PdM dataset related to maintenance equipment failures. Based on our findings, we developed and proposed AutoOneClass, a novel AutoML framework that specializes in OCC and employs three algorithms: deep AE, IF, and OC-SVM. The AutoOneClass framework uses a GE to optimize the search for the best OCC ML algorithm and its hyperparameters, allowing for single or multi-objective search. We also designed two validation setups for the framework: unsupervised validation, which employs unlabeled data during validation and anomaly scores to evaluate the ML models; and supervised validation, which uses a labeled validation set to assess model performance. The computational experiments assumed five predictive tasks: one regression and four binary classifications. Among the existing AutoML tools, AutoGluon presented the best average results. The AutoOneClass results were also good, surpassing the AutoML tools focused on DL. In general, the results favored the AutoML tools when compared with AutoOneClass and with human ML designs. Nevertheless, our proposed approach surpassed the expert human modeling in two predictive targets, showing that OCC can be valuable for the PdM domain since industrial data can arise with a high velocity. Our research on this project provided valuable insights into the use of OCC algorithms within AutoML and contributed to advancing the state-of-the-art regarding AutoML approaches for the PdM industry. In the final part of this PhD thesis (Chapter 5), we describe the work developed during the fourth and final year of this doctoral program. In this final contribution, we aimed to further develop the initial version of the AutoML framework proposed in Chapter 4. This led to the creation of AutoOC, an enhanced version of the AutoOneClass method. The new contribution focused entirely on OCC ML algorithms, which were identified as a research gap in the previous work. State-of-the-art research showed that the vast majority of AutoML tools focused on supervised learning (e.g., classification, regression) and did not handle an OCC. In addition, AutoOC focused solely on multi-objective optimization, using the NSGA-II algorithm to maximize the predictive performance of the OCC learners while minimizing their training time. The goal was to address the efficiency aspect of the PhD objectives by generating lightweight ML models, which is crucial when working with real-world Big Data. Moreover, the proposed AutoOC adopts two computationally efficient mechanisms to speed up the overall execution time: continuous 95 CHAPTER 6. CONCLUSIONS sampling of training data and parallel fitness evaluation by adopting multi-core processors. To evaluate the effectiveness of AutoOC, we conducted several computational experiments using eight public datasets from various domains and two distinct validation modes (unsupervised and supervised). Overall, the experiments showed that AutoOC achieved competitive results, even when considering large datasets (e.g., with more than 285,000 examples). By using the two acceleration mechanisms, AutoOC is able to perform the GE search in less than 40 minutes for the larger datasets. Additionally, the optimized OCC models require a reduced training time, in most cases lower than 1 s. The AutoOC outperformed a baseline IF in all datasets and even surpassed the best public human modeling approaches for two datasets (Credit and Mushroom). 6.2 Discussion Overall, the final version of the proposed automated and efficient Machine Learning framework (AutoOC, described in Chapter 5) provides a novel approach to the field of AutoML, offering a range of capabilities that were rarely addressed in previous research works on the topic. First, this framework addresses an OCC task, in contrast to most AutoML frameworks. While there is currently a large availability of AutoML works, these solutions typically only focus on supervised learning. Identified as a current research challenge for AutoML, we apply AutoML techniques outside the supervised learning domain, using five OCC algorithms, namely Autoencoder, Isolation Forest, Local Outlier Factor, One-Class SVM, and Variational Autoencoder. The proposed framework is able to optimize the search for the OCC ML algorithm and its associated hyperparameters for a given dataset using Grammatical Evolution. Second, we address efficiency of the AutoML search by adopting an evolutionary multi-objective optimization approach, aiming to maximize the predictive performance of the OCC learners while minimizing their training time. Most existing AutoML solutions only focus on a single-objective search, typically predictive performance. This often results in solutions that take too long to obtain useful ML models (e.g., in the Section 3.3 study, one of the tools always takes the maximum allowed training time) or in very complex models (e.g., the best models of H2O AutoML are usually Stacked Ensembles with dozens of models). By considering the training time in our proposed framework, we intend to generate lightweight OCC Machine Learning models, an important aspect when working with real-world Big Data. Additionally, to speed up the training time we also use a periodic sampling of the training data and a fitness evaluation parallelization by using a multi-core processing. Third, we adopt a flexible and extensible approach in which more learners can be easily added to the framework. In most AutoML tools, the set of ML algorithms and range of hyperparameters are mostly rigid, where the user can only limit the AutoML execution to a subset of the available learners. Since we use Grammatical Evolution, it assumes a variable-length solution representation (allowing to cope with different learners) and easy customization of the search space by means of an explicit grammar (allowing 96 6.3. FUTURE WORK to adjust more or fewer base learners and their respective hyperparameters, if needed). Despite the positive results obtained by the distinct experiments, it is possible to identify limitations to this PhD project as a whole. One of the main difficulties was the fact that this PhD was developed under more than one R&D project (e.g., project IRMDA, project CMMS), all with short-term duration (no more than two years). This meant that the experiments had to address a reduced scope, given the time restrictions. The availability of real-world data to use in the experiments was also smaller since the process of making the real data available usually takes several months (e.g., for bureaucratic reasons). We addressed this limitation by dividing the PhD work into two phases: a first phase (described in Chapter 3), where the focus was to explore existing AutoML frameworks within the domain of supervised learning tasks and identify research gaps; and a second phase (described in Chapter 4 and Chapter 5), where we focused on developing a novel automated and efficient ML framework for OCC. An additional challenge we faced was the fact that AutoML is currently a very hot research topic, with hundreds of research works being published and dozens of new frameworks being proposed every month. This was a challenge that had implications in the earlier stages of this PhD, since initially the plan was to address a novel AutoML framework within supervised learning. After the work described in Chapter 3 and by regularly revisiting the AutoML state-of-the-art, it was identified that the was a heavy focus on supervised learning AutoML and a research gap in other ML tasks (e.g., One-Class Classification). Finally, another limitation of this PhD work was the fact that the last stage was not associated with any R&D project, thus it was not possible to use real-world data from a specific application domain and that involved at least a research collaboration with one business client for the last experiment (Chapter 5). We addressed this limitation by considering a large number of public domain datasets (eight datasets retrieved from OpenML). We selected popular datasets from distinct application domains that reflected different numbers of instances, attributes, and output target class balancing, in order to have a varied set of datasets to evaluate our proposed AutoML framework. Also, the fact that the datasets were retrieved from OpenML, allowed us to compare our obtained results with the best public OpenML results. This allowed us to use these OpenML results as a “gold standard”, denoting a proxy to the best empirical predictive results that can be achieved when using an human expert modeling. 6.3 Future Work Regarding this PhD work, there are several research directions that could be addressed in future work. For instance, we wish to test the proposed framework on a wider range of datasets and add more OCC algorithms to the grammar to further validate its effectiveness. We plan to develop a benchmark with a more significant number of OCC algorithms, such as Gaussian Mixture Model or recently proposed OCC algorithms (Blázquez-Garcia et al., 2021; Golan & El-Yaniv, 2018; Hayashi et al., 2021; Lenz et al., 2021; Mauceri et al., 2020). We aim to experiment different values for crossover, mutation and training time to assess their impact on the GE optimization. Another interesting future experimentation is to study 97 CHAPTER 6. CONCLUSIONS the usage of other multi-objective algorithms, such as R-NSGA-II (Abouhawwash & Deb, 2021). Also, we intend to analyze in more depth the correlation between the AUC and the anomaly scores when using a supervised validation. We wish to test the proposed framework with more real-world datasets, to verify further consistency with the obtained results and verify if the proposed method could be implemented in real-world scenarios. Furthermore, it could be valuable to check the possibility of further enhancing the efficiency of the framework, adding other elements besides the already implemented acceleration mechanisms (random sampling and parallel training). This could be achieved by using a Selective Sampling (Afonso et al., 2023), a distributed computation engine for data processing (e.g., Apache Spark), or by using algorithms that can be run on GPUs. Additionally, we aim to add more functionalities to the proposed framework. These could include the possibility of using other efficiency objectives apart from training time, such as inference time, model complexity (e.g., number of parameters), or even the model size. Other new features could include an early stopping to the GE optimization via a monitoring of the evolution of the hypervolume measure or a maximum optimization time. We also intend to experiment with AutoML technologies that can automatically perform other ML phases apart from modeling, such as feature engineering and selection. Finally, we intend to study the possibility of extending the current framework by adding Federated Learning capabilities. This could be implemented in a decentralized manner, where the different models do not share data (e.g., for confidentiality reasons). At the end of each generation, these “local” models could be unified into a “global” model using distinct aggregation techniques, such as Federated Averaging (Ferreira et al., 2023). 98 Bibliography Abouhawwash, M., & Deb, K. (2021). Reference Point Based Evolutionary Multi-objective Optimization Algorithms with Convergence Properties Using KKTPM and ASF Netrics. Journal of Heuristics , 27 (4), 575–614. https://doi.org/10.1007/s10732-021-09470-4 (cit. on p. 98) Afonso, C., Matta, A., Matos, L. M., Gomes, M. B., Santos, A., Pilastri, A. L., & Cortez, P. (2023). Machine Learning for Predicting Production Disruptions in the Wood-Based Panels Industry: A Demonstration Case. Artificial Intelligence Applications and Innovations - 19th IFIP WG 12.5 International Conference, AIAI 2023, Hersonissos, Léon, Spain, June 14-17, 2023 (cit. on p. 98). Aggarwal, C. C. (2018). Neural Networks and Deep Learning - A Textbook . Springer. https://doi.org/10 .1007/978-3-319-94463-0. (Cit. on p. 14) Ali, M. (2022). PyCaret: An Open Source, Low-code Machine Learning Library in Python [PyCaret version 2.3.10]. https://www.pycaret.org. (Cit. on p. 16) Amruthnath, N., & Gupta, T. (2018a). A Research Study on Unsupervised Machine Learning Algorithms for Early Fault Detection in Predictive maintenance. 2018 5th International Conference on Industrial Engineering and Applications (ICIEA) , 355–361. https://doi.org/10.1109/IEA.2018.8387124 (cit. on pp. 26, 27) Amruthnath, N., & Gupta, T. (2018b). Fault Class Prediction in Unsupervised Learning Using Model-based Clustering Approach. 2018 International Conference on Information and Computer Technologies (ICICT) , 5–12. https://doi.org/10.1109/INFOCT.2018.8356831 (cit. on p. 57) Anjum, M. S., & Ryan, C. (2021). Seeding Grammars in Grammatical Evolution to Improve Search-Based Software Testing. SN Computer Science , 2 (4), 280. https://doi.org/10.1007/s42979-021-006 31-7 (cit. on pp. xi, 20) Apache Spark. (2020a). Extracting, Transforming and Selecting Features - Spark 2.4.5 Documentation. https://spark.apache.org/docs/latest/ml-features. (Cit. on p. 40) Apache Spark. (2020b). ML Pipelines - Spark 2.4.5 Documentation. https://spark.apache.org/docs/ latest/ml-pipeline.html. (Cit. on p. 41) Arena, S., Florian, E., Zennaro, I., Orrù, P., & Sgarbossa, F. (2022). A Novel Decision Support System for Managing Predictive Maintenance Strategies Based on Machine Learning Approaches. Safety Science , 146 , 105529. https://doi.org/10.1016/j.ssci.2021.105529 (cit. on pp. 26, 27) 99 BIBLIOGRAPHY Arregoces, P., Vergara, J., Gutierrez, S. A., & Botero, J. F. (2022). Network-based Intrusion Detection: A Oneclass Classification Approach. 2022 IEEE/IFIP Network Operations and Management Symposium, NOMS 2022, Budapest, Hungary, April 25-29, 2022 , 1–6. https://doi.org/10.1109/NOMS542 07.2022.9789927 (cit. on pp. 17, 75) Assunção, F., Lourenço, N., Ribeiro, B., & Machado, P. (2020). Evolution of Scikit-Learn Pipelines with Dynamic Structured Grammatical Evolution. In P. A. Castillo, J. L. J. Laredo, & F. F. de Vega (Eds.), Applications of Evolutionary Computation - 23rd European Conference, EvoApplications 2020, Held as Part of EvoStar 2020, Seville, Spain, April 15-17, 2020, Proceedings (pp. 530– 545). Springer. https://doi.org/10.1007/978-3-030-43722-0_34. (Cit. on p. 28) AutoGluon. (2021). AutoGluon: AutoML Toolkit for Deep Learning — AutoGluon Documentation 0.2.0 documentation. https://auto.gluon.ai/. (Cit. on pp. 24, 44) Ayvaz, S., & Alpay, K. (2021). Predictive Maintenance System for Production Lines in Manufacturing: A Machine Learning Approach Using IoT Data in Real-time. Expert Systems with Applications , 173 , 114598. https://doi.org/10.1016/j.eswa.2021.114598 (cit. on pp. 27, 56) Bahri, M., Salutari, F., Putina, A., & Sozio, M. (2022). AutoML: State of the Art with a Focus on Anomaly Detection, Challenges, and Research Directions. International Journal of Data Science and Analytics , 1–14. https://doi.org/10.1007/s41060-022-00309-0 (cit. on p. 58) Balaprakash, P., Tiwari, A., Wild, S. M., Carrington, L., & Hovland, P. D. (2016). AutoMOMML: Automatic Multi-objective Modeling with Machine Learning. In J. M. Kunkel, P. Balaji, & J. J. Dongarra (Eds.), High Performance Computing - 31st International Conference, ISC High Performance 2016, Frankfurt, Germany, June 19-23, 2016, Proceedings (pp. 219–239). Springer. https://doi.org/10.10 07/978-3-319-41321-1_12. (Cit. on p. 28) Basheer, I. A., & Hajmeer, M. (2000). Artificial Neural Networks: Fundamentals, Computing, Design, and Application. Journal of Microbiological Methods , 43 (1), 3–31. https://doi.org/10.1016/S0167- 7012(00)00201-3 (cit. on p. 14) Baymurzina, D., Golikov, E. A., & Burtsev, M. S. (2022). A Review of Neural Architecture Search. Neurocomputing , 474 , 82–93. https://doi.org/10.1016/j.neucom.2021.12.014 (cit. on pp. 19, 75) Benedetti, M. D., Leonardi, F., Messina, F., Santoro, C., & Vasilakos, A. V. (2018). Anomaly Detection and Predictive Maintenance for Photovoltaic Systems. Neurocomputing , 310 , 59–68. https://doi.org/ 10.1016/j.neucom.2018.05.017 (cit. on p. 56) Biau, G. (2012). Analysis of a Random Forests Model. Journal of Machine Learning Research , 13 , 1063– 1095. http://dl.acm.org/citation.cfm?id=2343682 (cit. on p. 13) Bishop, C. M. (2007). Pattern Recognition and Machine Learning, 5th Edition . Springer. https://www. worldcat.org/oclc/71008143. (Cit. on p. 13) Blázquez-Garcia, A., Conde, A., Mori, U., & Lozano, J. A. (2021). Water Leak Detection Using Self-supervised Time Series Classification. Information Sciences , 574 , 528–541. https://doi.org/10.1016/j.ins.2 021.06.015 (cit. on p. 97) 100 BIBLIOGRAPHY Blum, A. L., & Langley, P. (1997). Selection of Relevant Features and Examples in Machine Learning. Artificial Intelligence , 97 (1-2), 245–271. https://doi.org/10.1016/s0004-3702(97)00063-5 (cit. on p. 33) Breiman, L. (2001). Random Forests. Machine Learning , 45 (1), 5–32. https://doi.org/10.1023/A:101 0933404324 (cit. on p. 13) Breunig, M. M., Kriegel, H., Ng, R. T., & Sander, J. (2000). LOF: Identifying Density-Based Local Outliers. In W. Chen, J. F. Naughton, & P. A. Bernstein (Eds.), Proceedings of the 2000 ACM SIGMOD International Conference on Management of Data, May 16-18, 2000, Dallas, Texas, USA (pp. 93– 104). ACM. https://doi.org/10.1145/342009.335388. (Cit. on p. 18) Brockwell, P. J., & Davis, R. A. (2016). Introduction to Time Series and Forecasting . Springer. https : //doi.org/https://doi.org/10.1007/b97391. (Cit. on p. 12) Butte, S., Prashanth, A., & Patil, S. (2018). Machine Learning Based Predictive Maintenance Strategy: a Super Learning Approach with Deep Neural Networks. 2018 IEEE Workshop on Microelectronics and Electron Devices (WMED) , 1–5. https://doi.org/10.1109/WMED.2018.8360836 (cit. on pp. 27, 56) Çakir, M., Güvenç, M. A., & Mistikoglu, S. (2021). The Experimental Application of Popular Machine Learning Algorithms on Predictive Maintenance and the Design of IIoT Based Condition Monitoring System. Computers & Industrial Engineering , 151 , 106948. https://doi.org/10.1016/j.cie.2020.1 06948 (cit. on p. 27) Calabrese, M., Cimmino, M., Fiume, F., Manfrin, M., Romeo, L., Ceccacci, S., Paolanti, M., Toscano, G., Ciandrini, G., Carrotta, A., Mengoni, M., Frontoni, E., & Kapetis, D. (2020). SOPHIA: An Event- Based IoT and Machine Learning Architecture for Predictive Maintenance in Industry 4.0. Information , 11 (4), 202. https://doi.org/10.3390/info11040202 (cit. on p. 27) Carvalho, T. P., Soares, F. A. A. M. N., Vita, R., da Piedade Francisco, R., Basto, J. P. T. V., & Alcalá, S. G. S. (2019). A Systematic Literature Review of Machine Learning Methods Applied to Predictive Maintenance. Computers & Industrial Engineering , 137 . https://doi.org/10.1016/j.cie.2019.1 06024 (cit. on p. 56) Cetto, T., Byrne, J., Xu, X., & Moloney, D. (2019). Size/Accuracy Trade-Off in Convolutional Neural Networks: An Evolutionary Approach. In L. Oneto, N. Navarin, A. Sperduti, & D. Anguita (Eds.), Recent Advances in Big Data and Deep Learning, Proceedings of the INNS Big Data and Deep Learning Conference INNSBDDL 2019, Genova, Italy 16-18 April 2019 (pp. 17–26). Springer. https://doi.org/10.1007/978-3-030-16841-4_3. (Cit. on pp. 28, 75) Chawla, N. V., Bowyer, K. W., Hall, L. O., & Kegelmeyer, W. P. (2002). SMOTE: Synthetic Minority Oversampling Technique. Journal of Artificial Intelligence Research , 16 , 321–357. https://doi.org/10 .1613/jair.953 (cit. on p. 37) Chen, Y., Song, Q., & Hu, X. (2020). Techniques for Automated Machine Learning. SIGKDD Explorations , 22 (2), 35–50. https://doi.org/10.1145/3447556.3447567 (cit. on pp. 25, 26, 42) 101 BIBLIOGRAPHY Chen, Y., Lin, Y., Kung, C., Chung, M., & Yen, I. (2019). Design and Implementation of Cloud Analytics- Assisted Smart Power Meters Considering Advanced Artificial Intelligence as Edge Analytics in Demand-Side Management for Smart Homes. Sensors , 19 (9), 2047. https://doi.org/10.3390 /s19092047 (cit. on p. 14) Chen, Z., Yeo, C. K., Lee, B., Lau, C. T., & Jin, Y. (2018). Evolutionary Multi-objective Optimization Based Ensemble Autoencoders for Image Outlier Detection. Neurocomputing , 309 , 192–200. https: //doi.org/10.1016/j.neucom.2018.05.012 (cit. on p. 28) Cheng, B., & Titterington, D. M. (1994). Neural Networks: A Review From a Statistical Perspective. Statistical Science , 2–30 (cit. on p. 14). Cheng, J. C., Chen, W., Chen, K., & Wang, Q. (2020). Data-driven Predictive Maintenance Planning Framework for MEP Components based on BIM and IoT using Machine Learning Algorithms. Automation in Construction , 112 , 103087. https://doi.org/10.1016/j.autcon.2020.103087 (cit. on pp. 26, 27) Cho, S., May, G., Tourkogiorgis, I., Perez, R., Lázaro, Ó., de la Maza, B., & Kiritsis, D. (2018). A Hybrid Machine Learning Approach for Predictive Maintenance in Smart Factories of the Future. Advances in Production Management Systems. Smart Manufacturing for Industry 4.0 - IFIP WG 5.7 International Conference, APMS 2018, Seoul, Korea, August 26-30, 2018, Proceedings, Part II , 536 , 311–317. https://doi.org/10.1007/978-3-319-99707-0_39 (cit. on pp. 26, 27, 57) Çınar, Z. M., Abdussalam Nuhu, A., Zeeshan, Q., Korhan, O., Asmael, M., & Safaei, B. (2020). Machine Learning in Predictive Maintenance Towards Sustainable Smart Manufacturing in Industry 4.0. Sustainability , 12 (19), 8211. https://doi.org/10.3390/su12198211 (cit. on p. 56) Cline, B., Niculescu, R. S., Huffman, D., & Deckel, B. (2017). Predictive Maintenance Applications for Machine Learning. 2017 Annual Reliability and Maintainability Symposium (RAMS) , 1–7. https: //doi.org/10.1109/RAM.2017.7889679 (cit. on pp. 27, 56) Coelho, G., Matos, L. M., Pereira, P. J., Ferreira, A. L., Pilastri, A. L., & Cortez, P. (2022). Deep Autoencoders for Acoustic Anomaly Detection: Experiments with Working Machine and In-vehicle Audio. Neural Computing and Applications , 34 (22), 19485–19499. https://doi.org/10.1007/s00521- 022-07375-2 (cit. on pp. 23, 79, 81) Coello, C. A. C., Lamont, G. B., & van Veldhuizen, D. A. (2007). Evolutionary Algorithms for Solving Multiobjective Problems, Second Edition . Springer. (Cit. on pp. 21, 77). Cook, D. (2016). Practical Machine Learning with H2O: Powerful, Scalable Techniques for Deep Learning and AI . O’Reilly Media, Inc. (Cit. on p. 16). Cortes, C., & Vapnik, V. (1995). Support-Vector Networks. Machine Learning , 20 (3), 273–297. https: //doi.org/10.1007/BF00994018 (cit. on p. 14) Cortez, P. (2010). Data Mining with Neural Networks and Support Vector Machines Using the R/rminer Tool. Advances in Data Mining. Applications and Theoretical Aspects, 10th Industrial Conference, ICDM 2010, Berlin, Germany, July 12-14, 2010. Proceedings , 6171 , 572–583. https://doi.org/1 0.1007/978-3-642-14400-4_44 (cit. on pp. 16, 37) 102 BIBLIOGRAPHY Cortez, P. (2020). Package ’rminer’. https://cran.r-project.org/web/packages/rminer/rminer.pdf. (Cit. on p. 24) Cortez, P. (2021). Modern optimization with R . Springer. (Cit. on p. 21). Cortez, P., Pereira, P. J., & Mendes, R. (2020). Multi-step Time Series Prediction Intervals Using Neuroevolution. Neural Computing and Applications , 32 (13), 8939–8953. https://doi.org/10.1007 /s00521-019-04387-3 (cit. on pp. 19, 75) Cristianini, N., & Shawe-Taylor, J. (2000). An Introduction to Support Vector Machines and Other Kernelbased Learning Methods . Cambridge University Press. https://doi.org/10.1017/CBO9780511 801389. (Cit. on p. 14) Dalianis, H. (2018). Evaluation Metrics and Evaluation. In Clinical Text Mining: Secondary Use of Electronic Patient Records (pp. 45–53). Springer International Publishing. https://doi.org/10.1007/978-3 -319-78503-5_6. (Cit. on p. 22) Dangut, M. D., Skaf, Z., & Jennions, I. K. (2022). Handling Imbalanced Data for Aircraft Predictive Maintenance Using the BACHE Algorithm. Applied Soft Computing , 108924. https://doi.org/10.101 6/j.asoc.2022.108924 (cit. on p. 62) Darwiche, A. (2018). Human-level Intelligence or Animal-like Abilities? Communications of the ACM , 61 (10), 56–67. https://doi.org/10.1145/3271625 (cit. on pp. 1, 31, 94) Das, P., Ivkin, N., Bansal, T., Rouesnel, L., Gautier, P., Karnin, Z. S., Dirac, L., Ramakrishnan, L., Perunicic, A., Shcherbatyi, I., Wu, W., Zolic, A., Shen, H., Ahmed, A., Winkelmolen, F., Miladinovic, M., Archembeau, C., Tang, A., Dutt, B., … Venkateswar, K. (2020). Amazon SageMaker Autopilot: a White Box AutoML Solution at Scale. In S. Schelter, S. Whang, & J. Stoyanovich (Eds.), Proceedings of the Fourth International Workshop on Data Management for End-to-End Machine Learning (2:1– 2:7). ACM. https://doi.org/10.1145/3399579.3399870. (Cit. on pp. 25, 26) Deb, K., Agrawal, S., Pratap, A., & Meyarivan, T. (2002). A Fast and Elitist Multiobjective Genetic Algorithm: NSGA-II. IEEE Transactions on Evolutionary Computation , 6 (2), 182–197. https://doi.org/10.11 09/4235.996017 (cit. on pp. 21, 77) de Lima Thomaz, R., Carneiro, P. C., Bonin, J. E., Macedo, T. A. A., Patrocinio, A. C., & Soares, A. B. (2018). Novel Mahalanobis-based Feature Selection Improves One-Class Classification of Early Hepatocellular Carcinoma. Medical & Biological Engineering & Computing , 56 (5), 817–832. https: //doi.org/10.1007/s11517-017-1736-5 (cit. on pp. 28, 29) de Sá, A. G. C., Pinto, W. J. G. S., Oliveira, L. O. V. B., & Pappa, G. L. (2017). RECIPE: A Grammar-Based Framework for Automatically Evolving Classification Pipelines. In J. McDermott, M. Castelli, L. Sekanina, E. Haasdijk, & P. Garcı �a-Sánchez (Eds.), Genetic Programming - 20th European Conference, EuroGP 2017, Amsterdam, The Netherlands, April 19-21, 2017, Proceedings (pp. 246– 261). https://doi.org/10.1007/978-3-319-55696-3\_16. (Cit. on p. 28) Dhir, N., Rudny, T., Zilli, D., & Tosi, A. (2020). An Automatic Type-Inferential General Latent Feature Model. 2020 International Joint Conference on Neural Networks, IJCNN 2020, Glasgow, United Kingdom, 103 BIBLIOGRAPHY Mauceri, S., Sweeney, J., & McDermott, J. (2020). Dissimilarity-based Representations for One-class Classification on Time Series. Pattern Recognition , 100 , 107122. https://doi.org/10.1016/j.patcog.2 019.107122 (cit. on p. 97) Miikkulainen, R. (2010). Topology of a Neural Network. In C. Sammut & G. I. Webb (Eds.), Encyclopedia of Machine Learning (pp. 988–989). Springer. https://doi.org/10.1007/978-0-387-30164-8 _837. (Cit. on p. 14) Miranda, T. Z., Sardinha, D. B., Basgalupp, M. P., & Cerri, R. (2022). A New Grammatical Evolution Method for Generating Deep Convolutional Neural Networks with Novel Topologies. In J. E. Fieldsend & M. Wagner (Eds.), GECCO ’22: Genetic and Evolutionary Computation Conference, Companion Volume, Boston, Massachusetts, USA, July 9 - 13, 2022 (pp. 663–666). ACM. https://doi.org/1 0.1145/3520304.3529025. (Cit. on pp. 28, 75) MLFlow. (2023). MLflow - A platform for the machine learning lifecycle. https://mlflow.org/. (Cit. on p. 140) Moctezuma, L. A., & Molinas, M. (2020). Multi-objective Optimization for EEG Channel Selection and Accurate Intruder Detection in an EEG-based Subject Identification System. Scientific Reports , 10 (1), 1–12. https://doi.org/10.1038/s41598-020-62712-6 (cit. on pp. 28, 29) Mohri, M., Rostamizadeh, A., & Talwalkar, A. (2012). Foundations of Machine Learning . MIT Press. http: //mitpress.mit.edu/books/foundations-machine-learning-0. (Cit. on p. 12) Moya, M. M., & Hush, D. R. (1996). Network Constraints and Multi-objective Optimization for One-Class Classification. Neural Networks , 9 (3), 463–474. https://doi.org/10.1016/0893-6080(95)0012 0-4 (cit. on pp. 17, 75) Moyano, J. M., & Ventura, S. (2022). Auto-adaptive Grammar-Guided Genetic Programming Algorithm to Build Ensembles of Multi-Label Classifiers. Information Fusion , 78 , 1–19. https://doi.org/10.10 16/j.inffus.2021.07.005 (cit. on p. 28) Neto, H. A., Alves, R. C., & Campos, S. V. (2020). NASirt: AutoML Based Learning with Instance-level Complexity Information. arXiv preprint arXiv:2008.11846 (cit. on p. 26). Ng, A. (2020). Machine Learning Yearning . deeplearning.ai. https://www.deeplearning.ai/machinelearning-yearning/. (Cit. on pp. 53, 67) Nyathi, T., & Pillay, N. (2018). Comparison of a Genetic Algorithm to Grammatical Evolution for Automated Design of Genetic Programming Classification Algorithms. Expert Systems with Applications , 104 , 213–234. https://doi.org/10.1016/j.eswa.2018.03.030 (cit. on pp. 19, 77) Oliveira, N., Cortez, P., & Areal, N. (2017). The Impact of Microblogging Data for Stock Market Prediction: Using Twitter to Predict Returns, Volatility, Trading Volume and Survey Sentiment Indices. Expert Systems with applications , 73 , 125–144. https://doi.org/10.1016/j.eswa.2016.12.036 (cit. on pp. 41, 47) Olson, R. S., Urbanowicz, R. J., Andrews, P. C., Lavender, N. A., Kidd, L. C., & Moore, J. H. (2016). Automating Biomedical Data Science Through Tree-Based Pipeline Optimization. In G. Squillero & 110 BIBLIOGRAPHY P. Burelli (Eds.), Applications of Evolutionary Computation - 19th European Conference, EvoApplications 2016, Porto, Portugal, March 30 - April 1, 2016, Proceedings, Part I (pp. 123–137). Springer. https://doi.org/10.1007/978-3-319-31204-0_9. (Cit. on p. 24) O’Neill, M., & Ryan, C. (2001). Grammatical Evolution. IEEE Transactions on Evolutionary Computation , 5 (4), 349–358. https://doi.org/10.1109/4235.942529 (cit. on pp. 19, 77) Paolanti, M., Romeo, L., Felicetti, A., Mancini, A., Frontoni, E., & Loncarski, J. (2018). Machine Learning Approach for Predictive Maintenance in Industry 4.0. 14th IEEE/ASME International Conference on Mechatronic and Embedded Systems and Applications, MESA 2018, Oulu, Finland, July 2-4, 2018 , 1–6. https://doi.org/10.1109/MESA.2018.8449150 (cit. on pp. 27, 56) Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., Blondel, M., Prettenhofer, P., Weiss, R., Dubourg, V., VanderPlas, J., Passos, A., Cournapeau, D., Brucher, M., Perrot, M., & Duchesnay, E. (2011). Scikit-learn: Machine Learning in Python. Journal of Machine Learning Research , 12 , 2825–2830. https://doi.org/10.5555/1953048.2078195 (cit. on pp. 16, 59, 80) Peffers, K., Tuunanen, T., Rothenberger, M. A., & Chatterjee, S. (2008). A Design Science Research Methodology for Information Systems Research. Journal of Management Information Systems , 24 (3), 45–77. http://www.jmis-web.org/articles/765 (cit. on pp. xi, 3) Pereira, P. J., Cortez, P., & Mendes, R. (2021). Multi-objective Grammatical Evolution of Decision Trees for Mobile Marketing User Conversion Prediction. Expert Systems with Applications , 168 , 114287. https://doi.org/10.1016/j.eswa.2020.114287 (cit. on pp. 75, 78) Perera, P., Oza, P., & Patel, V. M. (2021). One-class classification: A survey. arXiv preprint arXiv:2101.03064 (cit. on p. 17). Peteiro-Barral, D., & Guijarro-Berdiñas, B. (2013). A Survey of Methods for Distributed Machine Learning. Progress in Artificial Intelligence , 2 (1), 1–11. https://doi.org/10.1007/s13748-012-0035-5 (cit. on pp. 1, 4, 24, 31) Pfisterer, F. (2022). Democratizing Machine Learning . Ludwig-Maximilians-Universität München. https: //doi.org/10.5282/edoc.30947. (Cit. on p. 28) Płonska, A., & Płonski, P. (2022). MLJAR: State-of-the-art Automated Machine Learning Framework for Tabular Data. Version 0.10.3. https://github.com/mljar/mljar-supervised. (Cit. on p. 16) Poole, D., Mackworth, A. K., & Goebel, R. (1998). Computational Intelligence - a Logical Approach . Oxford University Press. (Cit. on p. 11). Ribeiro, D., Matos, L. M., Moreira, G., Pilastri, A. L., & Cortez, P. (2022). Isolation Forests and Deep Autoencoders for Industrial Screw Tightening Anomaly Detection. Computers , 11 (4), 54. https: //doi.org/10.3390/computers11040054 (cit. on pp. 17, 58, 75, 81) Risi, S., & Togelius, J. (2017). Neuroevolution in Games: State of the Art and Open Challenges. IEEE Trans. Comput. Intell. AI Games , 9 (1), 25–41. https://doi.org/10.1109/TCIAIG.2015.2494596 (cit. on p. 19) 111 BIBLIOGRAPHY Rokach, L., & Maimon, O. (2007). Data Mining with Decision Trees - Theory and Applications (Vol. 69). WorldScientific. https://doi.org/10.1142/6604. (Cit. on p. 13) Russell, S. J., & Norvig, P. (2003). Artificial Intelligence - A Modern Approach, 2nd Edition . Prentice Hall. http://www.worldcat.org/oclc/314283679. (Cit. on p. 12) Ryan, C., O’Neill, M., & Collins, J. (2018). Handbook of Grammatical Evolution (Vol. 1). Springer. (Cit. on p. 75). Salesforce. (2022). TransmogrifAI - AutoML Library for Building Modular, Reusable, Strongly Typed Machine Learning Workflows on Spark from Salesforce Engineering. https://transmogrif.ai/. (Cit. on pp. 17, 24) Samuel, A. L. (1959). Some Studies in Machine Learning Using the Game of Checkers. IBM Journal of Research and Development , 3 (3), 210–229 (cit. on p. 11). Samuel, A. L. (1967). Some Studies in Machine Learning Using the Game of Checkers. II—Recent Progress. IBM Journal of Research and Development , 11 (6), 601–617 (cit. on p. 11). Schölkopf, B., Platt, J. C., Shawe-Taylor, J., Smola, A. J., & Williamson, R. C. (2001). Estimating the Support of a High-Dimensional Distribution. Neural Computation , 13 (7), 1443–1471. https://doi.org/10 .1162/089976601750264965 (cit. on p. 19) Schwarz, G. (1978). Estimating the Dimension of a Model. The Annals of Statistics , 6 (2), 461–464. https: //doi.org/10.1214/aos/1176344136 (cit. on p. 139) Scikit-Learn. (2022a). Isolation Forest. https://scikit-learn.org/stable/modules/generated/sklearn. ensemble.IsolationForest.html. (Cit. on pp. 80, 138) Scikit-Learn. (2022b). Local Outlier Factor. https://scikit-learn.org/stable/modules/generated/sklearn. neighbors.LocalOutlierFactor.html. (Cit. on pp. 80, 138) Scikit-Learn. (2022c). One-Class SVM. https://scikit-learn.org/stable/modules/generated/sklearn.svm. OneClassSVM.html. (Cit. on pp. 80, 138) Seliya, N., Zadeh, A. A., & Khoshgoftaar, T. M. (2021). A Literature Review on One-Class Classification and its Potential Applications in Big Data. Journal of Big Data , 8 (1), 122. https://doi.org/10.11 86/s40537-021-00514-x (cit. on pp. 17, 75) Silva, A. J., Cortez, P., Pereira, C., & Pilastri, A. (2021). Business Analytics in Industry 4.0: A Systematic Review. Expert Systems , e12741. https://doi.org/https://doi.org/10.1111/exsy.12741 (cit. on p. 56) Stanley, K. O., D’Ambrosio, D. B., & Gauci, J. (2009). A Hypercube-Based Encoding for Evolving Large- Scale Neural Networks. Artificial Life , 15 (2), 185–212. https://doi.org/10.1162/artl.2009.15.2 .15202 (cit. on p. 75) Straus, P., Schmitz, M., Wöstmann, R., & Deuse, J. (2018). Enabling of Predictive Maintenance in the Brownfield through Low-Cost Sensors, an IIoT-Architecture and Machine Learning. IEEE International Conference on Big Data (IEEE BigData 2018), Seattle, WA, USA, December 10-13, 2018 , 1474–1483. https://doi.org/10.1109/BigData.2018.8622076 (cit. on pp. 26, 27, 58) 112 BIBLIOGRAPHY Szegedy, C., Zaremba, W., Sutskever, I., Bruna, J., Erhan, D., Goodfellow, I. J., & Fergus, R. (2014). Intriguing Properties of Neural Networks (Y. Bengio & Y. LeCun, Eds.). http://arxiv.org/abs/131 2.6199 (cit. on p. 14) TensorFlow. (2022a). Convolutional Variational Autoencoder. https://www.tensorflow.org/tutorials/ generative/cvae. (Cit. on pp. 80, 138) TensorFlow. (2022b). Intro to Autoencoders. https://www.tensorflow.org/tutorials/generative/autoencoder. (Cit. on pp. 80, 138) Thornton, C., Hutter, F., Hoos, H. H., & Leyton-Brown, K. (2013). Auto-WEKA: Combined Selection and Hyperparameter Optimization of Classification Algorithms. In I. S. Dhillon, Y. Koren, R. Ghani, T. E. Senator, P. Bradley, R. Parekh, J. He, R. L. Grossman, & R. Uthurusamy (Eds.), The 19th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD 2013, Chicago, IL, USA, August 11-14, 2013 (pp. 847–855). ACM. https://doi.org/10.1145/2487575.248762 9. (Cit. on pp. 1, 3, 15, 16, 31, 42, 76) Tornede, T., Tornede, A., Wever, M., Mohr, F., & Hüllermeier, E. (2020). AutoML for Predictive Maintenance: One Tool to RUL Them All. IoT Streams for Data-Driven Predictive Maintenance and IoT, Edge, and Mobile for Embedded Machine Learning, ITEM 2020, Belgium, September 14-18, 2020, Revised Selected Papers , 1325 , 106–118. https://doi.org/10.1007/978-3-030-66770-2\_8 (cit. on pp. 26, 27) Tranmer, M., & Elliot, M. (2008). Multiple Linear Regression. The Cathie Marsh Centre for Census and Survey Research (CCSR) , 5 , 30–35 (cit. on p. 13). Truong, A., Walters, A., Goodsitt, J., Hines, K. E., Bruss, C. B., & Farivar, R. (2019). Towards Automated Machine Learning: Evaluation and Comparison of AutoML Approaches and Tools. 31st IEEE International Conference on Tools with Artificial Intelligence, ICTAI 2019, Portland, OR, USA, November 4-6, 2019 , 1471–1479. https://doi.org/10.1109/ICTAI.2019.00209 (cit. on pp. 24–26) Turing, A. (1950). Computing Machinery and Intelligence. Mind , 59 (236), 433 (cit. on p. 11). Vanschoren, J., van Rijn, J. N., Bischl, B., & Torgo, L. (2013). OpenML: Networked Science in Machine Learning. ACM SIGKDD Explorations Newsletter , 15 (2), 49–60. https://doi.org/10.1145/2641 190.2641198 (cit. on pp. 24, 44, 76, 83) Vapnik, V. (1998). Statistical Learning Theory . New York: Wiley. (Cit. on p. 14). Wang, C., & Wu, Q. (2019). FLO: Fast and Lightweight Hyperparameter Optimization for AutoML. arXiv preprint arXiv:1911.04706 (cit. on p. 26). Wang, L. (2005). Support Vector Machines: Theory and Applications . Springer Science & Business Media. (Cit. on p. 14). Wang, S., Liu, Q., Zhu, E., Porikli, F., & Yin, J. (2018). Hyperparameter Selection of One-class Support Vector Machine by Self-adaptive Data Shifting. Pattern Recognition , 74 , 198–211. https://doi. org/10.1016/j.patcog.2017.09.012 (cit. on p. 19) 113 BIBLIOGRAPHY Waring, J., Lindvall, C., & Umeton, R. (2020). Automated Machine Learning: Review of the State-of-the-art and Opportunities for Healthcare. Artificial Intelligence in Medicine , 104 , 101822. https://doi. org/10.1016/j.artmed.2020.101822 (cit. on pp. 25, 26) Witten, I. H., Frank, E., Hall, M. A., & Pal, C. J. (2016). Data Mining: Practical Machine Learning Tools and Techniques . Morgan Kaufmann. (Cit. on pp. 16, 23). Xanthopoulos, I., Tsamardinos, I., Christophides, V., Simon, E., & Salinger, A. (2020). Putting the Human Back in the AutoML Loop. In A. Poulovassilis, D. Auber, N. Bikakis, P. K. Chrysanthis, G. Papastefanatos, M. A. Sharaf, N. Pelekis, C. Renso, Y. Theodoridis, K. Zeitouni, T. Cerquitelli, S. Chiusano, G. Vargas-Solar, B. Omidvar-Tehrani, K. Morik, J. Renders, D. Firmani, L. Tanca, D. Mottin, … Y. Velegrakis (Eds.), Proceedings of the Workshops of the EDBT/ICDT 2020 Joint Conference, Copenhagen, Denmark, March 30, 2020 . CEUR-WS.org. http://ceur-ws.org/Vol-25 78/ETMLP5.pdf. (Cit. on p. 26) Yakovlev, A., Moghadam, H. F., Moharrer, A., Cai, J., Chavoshi, N., Varadarajan, V., Agrawal, S. R., Karnagel, T., Idicula, S., Jinturkar, S., & Agarwal, N. (2020). Oracle AutoML: A Fast and Predictive AutoML Pipeline. Proceedings of the VLDB Endowment , 13 (12), 3166–3180. https://doi.org/10 .14778/3415478.3415542 (cit. on p. 26) Yao, Q., Wang, M., Chen, Y., Dai, W., Yi-Qi, H., Yu-Feng, L., Wei-Wei, T., Qiang, Y., & Yang, Y. (2018). Taking Human out of Learning Applications: A Survey on Automated Machine Learning. arXiv preprint arXiv:1810.13306 (cit. on p. 24). Zimmer, L., Lindauer, M., & Hutter, F. (2021). Auto-Pytorch: Multi-Fidelity MetaLearning for Efficient and Robust AutoDL. IEEE Transactions on Pattern Analysis and Machine Intelligence , 43 (9), 3079– 3090. https://doi.org/10.1109/TPAMI.2021.3067763 (cit. on pp. 16, 25, 26) Zola, P., Cortez, P., & Brentari, E. (2021). Twitter Alloy Steel Disambiguation and User Relevance via One- Class and Two-Class News Titles Classifiers. Neural Computing and Applications , 33 (4), 1245– 1260. https://doi.org/10.1007/s00521-020-04991-8 (cit. on pp. 17, 75) Zöller, M., & Huber, M. F. (2021). Benchmark and Survey of Automated Machine Learning Frameworks. Journal of Artificial Intelligence Research , 70 , 409–472. https://doi.org/10.1613/jair.1.11854 (cit. on pp. 24–26) Thisdocumentwascreatedwiththe(pdf/Xe/Lua)L A T E XprocessorandtheNOVAthesistemplate(v6.10.17)(Lourenço,2021).12cc90221730b8ba41bb3b1f8b517acd Lourenço,J.M.(2021).TheNOVAthesisL A T EXTemplateUser’sManual.NOVAUniversityLisbon.https://github.com/joaomlourenco/novathesis/raw/main/template.pdf.(Cit.onp.114) 114 Appendix A Computational Experiments and Code of Section 3.3 Benchmark Study A.1 Overview The benchmark study presented in Section 3.3 was applied in the paper “A Comparison of AutoML Tools for Machine Learning, Deep Learning and XGBoost” (Ferreira, Pilastri, Martins, et al., 2021). The code used in these experiments is publicly available at the following GitHub repository: luisferreira97/autoautoml. This repository includes all the code used in a benchmark of eight open-source AutoML tools: Auto-Keras, Auto- PyTorch, Auto-Sklearn, AutoGluon, H2O AutoML, rminer, TPOT and TransmogrifAI. This comparison study includes hundreds of computational experiments based on three scenarios: General Machine Learning (GML), Deep Learning (DL), and XGBoost (XGB). A.2 Folder Description and Structure The GitHub repository is organized as follows: 1. The code that was used to generate all the benchmark models is inside the data folder and its subfolders. 2. Inside the data folder, there is a subfolder for each of the datasets used for the benchmark. 3. Inside the datasets subfolders, there is one subfolder for each AutoML tool used for that dataset. 4. Inside the tools subfolders, there is the script used to generate the ML models and the resulting metadata (e.g., model leaderboards, performance metrics) The folder structure can also be represented by the following tree: project 115 APPENDIX A. COMPUTATIONAL EXPERIMENTS AND CODE OF SECTION 3.3 BENCHMARK STUDY aux-functions: scripts to divide the original datasets into folds join-data split-data docs: PDF of the IJCNN paper and other documentation data dataset A AutoML tool A run: script to run the experiment fold 1 model leaderboard performance metrics other metadata files fold 2 fold 3 other folds AutoML tool B AutoML tool C other AutoML tools dataset B dataset C other datasets A.3 Code Examples The scripts that execute the AutoML experiments follow a similar structure for all datasets. The variable part of the scripts are the training functions, that are specific for each AutoML API. This section presents an example of the code used for each AutoML tool. A.3.1 Auto-Keras import autokeras as ak f o r xi n range ( 0 , 1 0 ) : f o l d _ f o l d e r = ” . / d at a / c h o l e s t e r o l / a u t o k e r a s / f o l d ” + s t r ( x +1) f o l d s = [ f o l d 1 , f o l d 2 , f o l d 3 , f o l d 4 , f o l d 5 , f o l d 6 , f o l d 7 , f o l d 8 , f o l d 9 , f o l d 1 0 ] t e s t _ d f = f o l d s [ x ] X _ t e s t = t e s t _ d f . dr o p ( columns =[ t a r g e t ] ) . to_numpy ( ) 116 A.3. CODE EXAMPLES y _ t e s t = t e s t _ d f [ t a r g e t ] . to_numpy ( ) del f o l d s [ x ] t r a i n _ d f = pd . c o n c a t ( f o l d s ) X _ t r a i n = t r a i n _ d f . drop ( columns = [ t a r g e t ] ) . to_numpy ( ) y _ t r a i n = t r a i n _ d f [ t a r g e t ] . to_numpy ( ) c l a s s i f i e r = ak . S t r u c t u r e d D a t a R e g r e s s o r ( l o s s = ” m e a n _ a b s o l u t e _ e r r o r ” , o b j e c t i v e = ” v a l _ l o s s ” , d i r e c t o r y = f o l d _ f o l d e r , p r o j e c t _ n a m e =” r e s u l t s ” , ) s t a r t = d a t e t i m e . now ( ) . s t r f t i m e ( ”%H:%M: % S ” ) c l a s s i f i e r . f i t ( x = X _ t r a i n , y = y _ t r a i n , v a l i d a t i o n _ s p l i t = 0 . 2 5 ) end = d a t e t i m e . now ( ) . s t r f t i m e ( ”%H:%M:% S ” ) try : c l a s s i f i e r . e v a l u a t e ( x = X _ t e s t , y = y _ t e s t ) except E x c e p t i o n as e : e r r o r = s t r (e) b e s t _ t r i a l = e r r o r [ e r r o r . f i n d ( ” t r i a l ” ) : e r r o r . f i n d ( ” / c h e c k p o i n t s ” ) ] t r i a l s = os . l i s t d i r ( f o l d _ f o l d e r + ” / r e s u l t s ” ) f o r trial in t r i a l s : i f t r i a l == b e s t _ t r i a l : c h e c k p o i n t s = os . l i s t d i r ( f o l d _ f o l d e r + ” / r e s u l t s / ”+ t r i a l +” / c h e c k p o i n t s ” ) checkpoints = [ int ( c h e c k p o i n t [ 6 : ] ) f o r c h e c k p o i n t in checkpoints ] checkpoints . sort () i f checkpoints [0] == 0: del checkpoints [0] 117 APPENDIX A. COMPUTATIONAL EXPERIMENTS AND CODE OF SECTION 3.3 BENCHMARK STUDY best = min ( checkpoints ) os . rename ( f o l d _ f o l d e r + ” / r e s u l t s / ” + t r i a l + ” / c h e c k p o i n t s / epoch_0 ” , fold_folder + ” / r e s u l t s / ” + t r i a l + ” / c h e c k p o i n t s / epoch_ ” +s t r ( b e s t − 1 ) , ) elif ” t r i a l ” i n t r i a l : r m t r e e ( f o l d _ f o l d e r + ” / r e s u l t s / ” + t r i a l ) p r e d s = c l a s s i f i e r . p r e d i c t ( x = X _ t e s t ) p e r f = { } p e r f [ ” s t a r t ” ] = s t a r t p e r f [ ” end ” ] = end p e r f [ ” t e s t _ s c o r e ” ] = s k l e a r n . m e t r i c s . m e a n _ a b s o l u t e _ e r r o r ( y _ t e s t , p r e d s . r e s h a p e ( ( len ( p r e d s ) , ) ) ) p e r f = j s o n . dumps ( p e r f ) f = open ( f o l d _ f o l d e r + ” / p e r f . j s o n ” , ”w” ) f . w r i t e ( p e r f ) f . c l o s e ( ) model = c l a s s i f i e r . e x p o r t _ m o d e l ( ) try : model . s av e ( f o l d _ f o l d e r + ” / m o d e l _ a u t o k e r a s ” , s a v e _ f o r m a t = ” t f ” ) except : model . s av e ( f o l d _ f o l d e r + ” / m o d e l _ a u t o k e r a s . h5 ” ) A.3.2 Auto-Sklearn 118 A.3. CODE EXAMPLES from autosklearn import c l a s s i f i c a t i o n , r e g r e s s i o n f o r xi n range ( 0 , 1 0 ) : f o l d _ f o l d e r = ” . / d a t a / c h o l e s t e r o l / a u t o s k l e a r n / f o l d ” +s t r ( x + 1 ) f o l d s = [ f o l d 1 , f o l d 2 , f o l d 3 , f o l d 4 , f o l d 5 , f o l d 6 , f o l d 7 , f o l d 8 , f o l d 9 , f o l d 1 0 ] t e s t _ d f = f o l d s [ x ] X _ t e s t = t e s t _ d f . dr o p ( columns =[ t a r g e t ] ) . to_numpy ( ) y _ t e s t = t e s t _ d f [ t a r g e t ] . to_numpy ( ) del f o l d s [ x ] t r a i n _ d f = pd . c o n c a t ( f o l d s ) X _ t r a i n = t r a i n _ d f . drop ( columns = [ t a r g e t ] ) . to_numpy ( ) y _ t r a i n = t r a i n _ d f [ t a r g e t ] . to_numpy ( ) a u t o m l = a u t o s k l e a r n . r e g r e s s i o n . A u t o S k l e a r n R e g r e s s o r ( r e s a m p l i n g _ s t r a t e g y = ” cv ” , r e s a m p l i n g _ s t r a t e g y _ a r g u m e n t s ={ ” f o l d s ” : 5 } ) s t a r t = d a t e t i m e . now ( ) . s t r f t i m e ( ”%H:%M: % S ” ) a u t o m l . f i t ( X _ t r a i n . copy ( ) , y _ t r a i n . c opy ( ) , m e t r i c = a u t o s k l e a r n . m e t r i c s . m e a n _ a b s o l u t e _ e r r o r ) a u t o m l . r e f i t ( X _ t r a i n . copy ( ) , y _ t r a i n . c opy ( ) ) end = d a t e t i m e . now ( ) . s t r f t i m e ( ”%H:%M:% S ” ) p r e d i c t i o n s = a u t o m l . p r e d i c t ( X _ t e s t ) p e r f = { } p e r f [ ” s t a r t ” ] = s t a r t p e r f [ ” end ” ] = end p e r f [ ” s t a t i s t i c s ” ] = a u t o m l . s p r i n t _ s t a t i s t i c s ( ) p e r f [ ” p r e d _ s c o r e ” ] = s k l e a r n . m e t r i c s . m e a n _ a b s o l u t e _ e r r o r ( y _ t e s t , p r e d i c t i o n s ) 119 APPENDIX A. COMPUTATIONAL EXPERIMENTS AND CODE OF SECTION 3.3 BENCHMARK STUDY t e s t _ d f = f o l d s [ x ] t e s t = h2o . H2OFrame ( t e s t _ d f ) del f o l d s [ x ] t r a i n _ d f = pd . c o n c a t ( f o l d s ) t r a i n = h2o . H2OFrame ( t r a i n _ d f ) x = t r a i n . columns y = t a r g e t x . remove ( y ) aml = H2OAutoML ( seed =42 , s o r t _ m e t r i c =” mae ” , n f o l d s =5 , i n c l u d e _ a l g o s =[ ” XGB oost ” ] , max_runtime_secs=3600, ) s t a r t = d a t e t i m e . now ( ) . s t r f t i m e ( ”%H:%M: % S ” ) aml . t r a i n ( x =x , y =y , t r a i n i n g _ f r a m e = t r a i n ) end = d a t e t i m e . now ( ) . s t r f t i m e ( ”%H:%M:% S ” ) l b = aml . l e a d e r b o a r d . a s _ d a t a _ f r a m e ( ) l b . t o _ c s v ( f o l d _ f o l d e r + ” / l e a d e r b o a r d . c s v ” , i n d e x = F a l s e ) p e r f = aml . l e a d e r . m o d e l _ p e r f o r m a n c e ( t e s t ) p e r f = aml . t r a i n i n g _ i n f o p e r f [ ” s t a r t ” ] = s t a r t p e r f [ ” end ” ] = end p e r f [ ” m e t r i c ” ] = aml . l e a d e r . m o d e l _ p e r f o r m a n c e ( t e s t ) . mae ( ) p e r f = j s o n . dumps ( p e r f ) f = open ( f o l d _ f o l d e r + ” / p e r f . j s o n ” , ”w” ) f . w r i t e ( p e r f ) f . c l o s e ( ) 126 A.3. CODE EXAMPLES m y _ l o c a l _ m o d e l = h2o . d ownload_model ( aml . l e a d e r , p a t h = f o l d _ f o l d e r ) h2o . s h u tdown ( ) import time t i m e . s l e e p ( 5 ) A.3.8 rminer library ( r m i n e r ) f o r ( x i n 0 : 9 ) { f o l d _folder = paste ( ” . /d a t a /c h o l e s t e r o l /r m i n e r /f o l d ” , as .characte r ( x + 1 ) , se p = ” ” ) folds = l i s t ( f o l d 1 , f o l d 2 , f o l d 3 , f o l d 4 , f o l d 5 , f o l d 6 , f o l d 7 , f o l d 8 , f o l d 9 , f o l d 1 0 ) t e s t _ df = f o l d s [ [ ( x + 1 ) ] ] f o l d s = f o l d s [ − ( x + 1 ) ] train_ df <− do .call (rbind , f o l d s ) inputs=ncol ( t r a i n _ df ) −1 sm=mparheuristic (model= ” a u t o ml 3 ” , n=NA , t a s k = t a s k , inputs=inputs ) method=c( ” k f o l d ” , 5 , 1 2 3 ) search=list (search=sm , smethod = ” a u t o ” , method = method , m e t r i c = m e t r i c , c o n v e x =0) M= f i t ( ch ol~ . , data= t r a i n _ df ,model= ” a u t o ” , search=search , f d e b u g =TRUE ) P= predict (M, t e s t _ df ) 127 APPENDIX A. COMPUTATIONAL EXPERIMENTS AND CODE OF SECTION 3.3 BENCHMARK STUDY t e s t _metric = round ( mmet r i c ( t e s t _ df$chol , P , m e t r i c = m e t r i c ) , 2 ) best_model = M@model best_model_ index =match ( best_model , M@mpar$LB$model ) validation_metric = round ( M@mpar$LB$eval , 4 ) [ b e s t _model_ index ] r e s u l t s = paste ( ’ { ” t i m e ” : ’ , M@time , ’ ,” b e s t _model ” : ” ’ , best_model , ’ ” ,” v a l i d a t i o n _m e t r i c ” : ’ , validation_metric , ’ ,” t e s t _m e t r i c ” : ’ , test_metric , ’ } ’ , sep = ” ” ) write ( r e s u l t s , paste ( f o l d _f o l d e r , ” /p e r f . j s o n ” , sep = ” ” ) ) save (M, file =paste ( f o l d _f o l d e r , ” /model . RData ” , sep = ” ” ) ) } A.3.9 rminer (XGBoost) library ( r m i n e r ) f o r ( x i n 0 : 9 ) { f o l d _folder=paste ( ” . /d a t a /c h o l e s t e r o l /rm i n e r − x g b o o s t /f o l d ” , as .characte r ( x + 1 ) , se p = ” ” ) folds = l i s t ( f o l d 1 , f o l d 2 , f o l d 3 , f o l d 4 , f o l d 5 , f o l d 6 , f o l d 7 , f o l d 8 , f o l d 9 , f o l d 1 0 ) t e s t _ df = f o l d s [ [ ( x + 1 ) ] ] f o l d s = f o l d s [ − ( x + 1 ) ] train_ df <− do .call (rbind , f o l d s ) inputs=ncol ( t r a i n _ df ) −1 128 A.3. CODE EXAMPLES sm=mparheuristic (model= ” x g b o o s t ” , n= ” h e u r i s t i c 1 0 ” , t a s k = ta s k , i n p u t s = i n p u t s ) method=c( ” k f o l d ” , 5 , 1 2 3 ) search=list (search=sm , smethod =” g r i d ” , method = method , m e t r i c = m e t r i c , c o n v e x =0) M= f i t ( ch ol~ . , data= t r a i n _ df ,model=”xgboost” , search=search , f d e b u g =TRUE ) P= predict (M, t e s t _ df ) r e s u l t s = paste ( ’ { ” t i m e ” : ’ , M@time , ’ ,” v a l i d a t i o n _m e t r i c ” : ’ , M@error , ’ ,” t e s t _m e t r i c ” : ’ , round ( mmet r i c ( t e s t _ df$chol , P , m e t r i c = m e t r i c ) , 2 ) , ’ } ’ , sep = ” ” ) write ( r e s u l t s , paste ( f o l d _f o l d e r , ” /p e r f . j s o n ” , sep = ” ” ) ) save (M, file =paste ( f o l d _f o l d e r , ” /model . RData ” , sep = ” ” ) ) } A.3.10 TPOT from t p o t import T P O T C l a s s i f i e r , T P O T R e g r e s s o r f o r xi n range ( 0 , 1 0 ) : f o l d _ f o l d e r = ” . / d a t a / c h o l e s t e r o l / t p o t / f o l d ” + s t r ( x + 1 ) f o l d s = [ f o l d 1 , f o l d 2 , f o l d 3 , f o l d 4 , f o l d 5 , f o l d 6 , f o l d 7 , f o l d 8 , f o l d 9 , f o l d 1 0 ] t e s t _ d f = f o l d s [ x ] X _ t e s t = t e s t _ d f . dr o p ( columns =[ t a r g e t ] ) . to_numpy ( ) y _ t e s t = t e s t _ d f [ t a r g e t ] . to_numpy ( ) 129 APPENDIX A. COMPUTATIONAL EXPERIMENTS AND CODE OF SECTION 3.3 BENCHMARK STUDY del f o l d s [ x ] t r a i n _ d f = pd . c o n c a t ( f o l d s ) X _ t r a i n = t r a i n _ d f . drop ( columns = [ t a r g e t ] ) . to_numpy ( ) y _ t r a i n = t r a i n _ d f [ t a r g e t ] . to_numpy ( ) t p o t = T P O T R e g r e s s o r ( max_time_mins=60, v e r b o s i t y =3 , r a n d o m _ s t a t e =42 , scoring=”neg_mean_absolute_error” , cv =5 , n _ j o b s = −1 , e a r l y _ s t o p =3 , ) s t a r t = d a t e t i m e . now ( ) . s t r f t i m e ( ”%H:%M: % S ” ) t p o t . f i t ( X _ t r a i n , y _ t r a i n ) end = d a t e t i m e . now ( ) . s t r f t i m e ( ”%H:%M:% S ” ) t p o t . e x p o r t ( f o l d _ f o l d e r + ” / p i p e l i n e . py ” ) p e r f = { ” s c o r e ” : t p o t . s c o r e ( X _ t e s t , y _ t e s t ) , ” s t a r t ” : s t a r t , ” end ” : end } p e r f = j s o n . dumps ( p e r f ) f = open ( f o l d _ f o l d e r + ” / p e r f . j s o n ” , ”w” ) f . w r i t e ( p e r f ) f . c l o s e ( ) A.3.11 TransmogrifAI import com . s a l e s f o r c e . op . _ object AzureBlobAnalysisv2 { def main ( a r g s : A r r a y [ S t r i n g ] ) { LogManager . g e t L o g g e r ( ” com . s a l e s f o r c e . op ” ) . s e t L e v e l ( L e v e l . ERROR ) v a l c o n f = new SparkConf () 130 A.3. CODE EXAMPLES c o n f . setAppName ( ” A u t o M L F o r A l l ” ) implicit val spark =S p a r k S e s s i o n . b u i l d e r . c o n f i g ( c o n f ) . g e t O r C r e a t e ( ) v a l confh=new o r g . apache . hadoop . c o n f . C o n f i g u r a t i o n ( ) v a l targetColumn =” c h o l ” f o r ( f o l d <− 1 t o 1 0 ) { p r i n t l n ( ” F o l d : � ” + f o l d ) ; var fold_folder=” . / d a t a / c h o l e s t e r o l / t r a n s m o g r i f a i / f o l d ” + f o l d . t o S t r i n g ( ) var t r a i n _ d f =s p a r k . s q l C o n t e x t . r e a d . f o r m a t ( ” c s v ” ) . option ( ” he a d e r ” , ” t r u e ” ) . o p t i o n ( ” i n f e r S c h e m a ” , ” t r u e ” ) . l o a d ( f o l d _ f o l d e r + ” / t r a i n . c s v ” ) var toBechanged =t r a i n _ d f . schema . f i e l d s . f i l t e r ( x=> x. dataType == I n t e g e r T y p e || x. dataType == LongType ) t o B e c h a n g e d . f o r e a c h ( { row => t r a i n _ d f =t r a i n _ d f . w i t h C o l u m n ( row . name . c o n c a t ( ” tmp ” ) , t r a i n _ d f . c o l ( row . name ) . c a s t ( D o u b l e T y p e ) ) . d ro p ( row . name ) . withColumnRenamed ( row . name . c o n c a t ( ” tmp ” ) , row . name ) } ) var ( s a l e p r i c e , f e a t u r e s ) =FeatureBuilder . fro m D at a F r am e [ RealNN ] ( t r a i n _ d f , r e s p o n s e =targetColumn ) var featureVector =f e a t u r e s . t o S eq . a u t o T r a n s f o r m ( ) var checkedFeatures =s a l e p r i c e . s a n i t y C h e c k ( f e a t u r e V e c t o r , checkSample =1 . 0 , r e m o v e B a d F e a t u r e s = tr ue ) 131 APPENDIX A. COMPUTATIONAL EXPERIMENTS AND CODE OF SECTION 3.3 BENCHMARK STUDY var pred =R e g r e s s i o n M o d e l S e l e c t o r . w i t h C r o s s V a l i d a t i o n ( numFolds =5 , validationMetric =E v a l u a t o r s . R e g r e s s i o n . mae ) . s e t I n p u t ( s a l e p r i c e , c h e c k e d F e a t u r e s ) . g e t O u t p u t ( ) var wf = new OpWorkflow () var start =C a l e n d a r . g e t I n s t a n c e . g e t T i m e var model =wf. setInputDataset ( t r a i n _ d f ) . s e t R e s u l t F e a t u r e s ( p r e d ) . t r a i n ( ) var end =C a l e n d a r . g e t I n s t a n c e . g e t T i m e p r i n t ( model . s u m m a r y P r e t t y ( ) ) var summary =model . s u m m a r y P r e t t y ( ) v a l evaluator =E v a l u a t o r s . R e g r e s s i o n ( ) . s e t L a b e l C o l ( s a l e p r i c e ) . s e t P r e d i c t i o n C o l ( p re d ) var testData =s p a r k . s q l C o n t e x t . r e a d . f o r m a t ( ” c s v ” ) . o p t i o n ( ” h e a d e r ” , ” t r u e ” ) . o p t i o n ( ” i n f e r S c h e m a ” , ” t r u e ” ) . l o a d ( f o l d _ f o l d e r + ” / t e s t . c sv ” ) var toBechanged2 =t e s t D a t a . schema . f i e l d s . f i l t e r ( x=> x. dataType == I n t e g e r T y p e || x. dataType == LongType ) to B e c h a n g e d 2 . f o r e a c h ( { row => testData =t e s t D a t a . w i t h C o l u m n ( row . name . c o n c a t ( ” tmp ” ) , t e s t D a t a . c o l ( row . name ) . c a s t ( D o u b l e T y p e ) ) . d ro p ( row . name ) . withColumnRenamed ( row . name . c o n c a t ( ” tmp ” ) , row . name ) } ) var preds =model. setInputDataset ( t e s t D a t a ) . s c o r e A n d E v a l u a t e ( e v a l u a t o r ) . t o S t r i n g ( ) var w= new BufferedWriter (new FileWriter ( f o l d _ f o l d e r + ” / p e r f . t x t ” ) ) 132 A.3. CODE EXAMPLES w . w r i t e ( ” START \n ” ) w . w r i t e ( s t a r t . t o S t r i n g ( ) ) w . w r i t e ( ” \n\n\n \nEND\n ” ) w . w r i t e ( end . t o S t r i n g ( ) ) w . w r i t e ( ” \n\n\ n\ nPREDS \ n ” ) w . w r i t e ( p r e d s ) w . w r i t e ( ” \n\n\n \nSUMMARY\n ” ) w . w r i t e ( summary ) w . c l o s e ( ) model . s a v e ( f o l d _ f o l d e r + ” / model ” ) } // R ead d a t a a s a D a t a F r a m e var p a s s e n g e r s D a t a =s p a r k . s q l C o n t e x t . r e a d . f o r m a t ( ” c s v ” ) . o p t i o n ( ” h e a d e r ” , ” t r u e ” ) . o p t i o n ( ” i n f e r S c h e m a ” , ” t r u e ” ) . l o a d ( ” c h o l e s t e r o l − t r a i n . c s v ” ) v a l p a s s e n g e r s D a t a =D a t a R e a d e r s . S i m p le . c s vCa se [ L i v e r ] ( O p t i o n ( ” l i v e r − d i s o r d e r s − t r a i n . cs v ” ) ) . r e a d D a t a s e t ( ) . toDF ( ) v a l targetColumn =s p a r k . s p a r k C o n t e x t . w h o l e T e x t F i l e s ( ” d r i n k s ” ) . t a k e ( 1 ) ( 0 ) . _2 v a l targetColumn =” c l a s s ” // C o n v e r t I n t and L ong t o D o u b l e t o a v o i d // F e a t u r e B u i l d e r e x c e p t i o n w i t h I n t e g e r / L o ng T y p e s v a l toBechanged =p a s s e n g e r s D a t a . schema . f i e l d s . f i l t e r ( x=> x. dataType == I n t e g e r T y p e || x . d a t a T y p e == LongType ) t o B e c h a n g e d . f o r e a c h ( { row => p a s s e n g e r s D a t a =p a s s e n g e r s D a t a . wi t hCo lum n ( row . name . c o n c a t ( ” tmp ” ) , p a s s e n g e r s D a t a . c o l ( row . name ) . c a s t ( D o u b l e T y p e ) ) . d ro p ( row . name ) . withColumnRenamed ( row . name . c o n c a t ( ” tmp ” ) , row . name ) 133 APPENDIX A. COMPUTATIONAL EXPERIMENTS AND CODE OF SECTION 3.3 BENCHMARK STUDY } ) // L e t ’ s t r y t o u n d e r s t a n d f r o m t h e t a r g e t v a r i a b l e // w h i c h ML p r o b l e m we w an t t o s o l v e v a l v i e w =p a s s e n g e r s D a t a . c r e a t e O r R e p l a c e T e m p V i e w ( ” myview ” ) v a l countTarget =s p a r k . s q l ( ” SELECT � COUNT ( DIST INCT � ” + t a r g e t C o l u m n + ” ) � FROM � myview ” ) . t a k e ( 1 ) ( 0 ) . g e t ( 0 ) . t o S t r i n g ( ) . t o I n t v a l targetType =p a s s e n g e r s D a t a . schema . f i e l d s . f i l t e r ( x=> x . name == t a r g e t C o l u m n ) . t a k e ( 1 ) ( 0 ) . d a t a T y p e // Max D i s t i n c t V a l u e s f o r B i n a r y C l a s s i f i c a t i o n // i s 2 and f o r m u l t i c l a s s i s 30 v a l b i n a r y L : I n t =2 v a l m u l t i L : I n t =30 // I f t h e t a r g e t v a r i a b l e ha s 2 d i s t i n c t v a l u e s // and i t i s n u m e r i c c an be a b i n a r y c l a s s i f i c a t i o n i f ( countTarget == b i n a r y L && t a r g e t T y p e == DoubleType ) { v a l ( s a l e p r i c e , f e a t u r e s ) =FeatureBuilder . fro m D at a F r am e [ RealNN ] ( p a s s e n g e r s D a t a , r e s p o n s e =targetColumn ) v a l featureVector =f e a t u r e s . t o Se q . a u t o T r a n s f o r m ( ) v a l checkedFeatures =s a l e p r i c e . s a n i t y C h e c k ( f e a t u r e V e c t o r , checkSample =1 . 0 , r e m o v e B a d F e a t u r e s = tr ue ) v a l pred =BinaryClassificationModelSelector . withCrossValidation ( numFolds =5 , validationMetric =Evaluators . B i n a r y C l a s s i f i c a t i o n . auROC ) . s e t I n p u t ( s a l e p r i c e , c h e c k e d F e a t u r e s ) . g e t O u t p u t ( ) v a l wf = new OpWorkflow () v a l start =C a l e n d a r . g e t I n s t a n c e . g e t T i m e v a l model =wf. setInputDataset ( p a s s e n g e r s D a t a ) . s e t R e s u l t F e a t u r e s ( p r e d ) . t r a i n ( ) v a l end =C a l e n d a r . g e t I n s t a n c e . g e t T i m e 134 A.4. CITATION p r i n t ( model . s u m m a r y P r e t t y ( ) ) v a l evaluator =E v a l u a t o r s . B i n a r y C l a s s i f i c a t i o n ( ) . s e t L a b e l C o l ( s a l e p r i c e ) . s e t P r e d i c t i o n C o l ( p re d ) model . s e t I n p u t D a t a s e t ( t e s t D a t a ) . s c o r e A n d E v a l u a t e ( e v a l u a t o r ) model . s a v e ( ” t r a n s m o g r i f a i ” ) } var testData =s p a r k . s q l C o n t e x t . r e a d . f o r m a t ( ” c s v ” ) . o p t i o n ( ” he a d e r ” , ” t r u e ” ) . o p t i o n ( ” i n f e r S c h e m a ” , ” t r u e ” ) . l o a d ( ” /home/ l f e r r e i r a / a u t o a u t o m l / d a t a / m f e a t / mfeat − t e s t . c s v ” ) v a l toBechanged =t e s t D a t a . schema . f i e l d s . f i l t e r ( x=> x. dataType == I n t e g e r T y p e || x . d a t a T y p e == LongType ) t o B e c h a n g e d . f o r e a c h ( { row => testData =t e s t D a t a . w i t h C o l u m n ( row . name . c o n c a t ( ” tmp ” ) , t e s t D a t a . c o l ( row . name ) . c a s t ( D o u b l e T y p e ) ) . d ro p ( row . name ) . withColumnRenamed ( row . name . c o n c a t ( ” tmp ” ) , row . name ) } ) model . s e t I n p u t D a t a s e t ( t e s t D a t a ) . s c o r e A n d E v a l u a t e ( e v a l u a t o r ) s p a r k . c l o s e ( ) } } A.4 Citation If you use the GitHub repository for your research, please cite the following paper: • Ferreira, L., Pilastri, A. L., Martins, C. M., Pires, P. M., & Cortez, P. (2021). A Comparison of AutoML Tools for Machine Learning, Deep Learning and XGBoost. International Joint Conference 135