XX \jnumXX
Department: Head \editorEditor: Name, xxxx@email
Enabling Automated Machine Learning for Model-Driven AI Engineering
Abstract
Developing smart software services requires both Software Engineering and Artificial Intelligence (AI) skills. AI practitioners, such as data scientists often focus on the AI side, for example, creating and training Machine Learning (ML) models given a specific use case and data. They are typically not concerned with the entire software development life-cycle, architectural decisions for the system and performance issues beyond the predictive ML models (e.g., regarding the security, privacy, throughput, scalability, availability, as well as ethical, legal and regulatory compliance). In this manuscript, we propose a novel approach to enable Model-Driven Software Engineering and Model-Driven AI Engineering. In particular, we support Automated ML, thus assisting software engineers without deep AI knowledge in developing AI-intensive systems by choosing the most appropriate ML model, algorithm and techniques with suitable hyper-parameters for the task at hand. To validate our work, we carry out a case study in the smart energy domain.
Building smart software systems, relies on the deployment of AI methods and techniques in software and systems engineering. In particular, a sub-discipline of AI, namely Machine Learning (ML) is currently the cutting edge. However, the state of practice in ML engineering is similar to software engineering in the sense that both are at the border of engineering and art. For instance, by observing the workflows in the daily routine of a data scientist, one does not perceive that they continuously follow a prescribed process with clearly defined methods and principles. Although there exist a number of heuristics and best practices based on the current state of research, for example, regarding how to initialize parameters, we still see that many practitioners have no choice but conducting trial-and-error [1] and following their intuitions. This is not only time-consuming, but also makes the performance and efficiency of their ML models highly dependent on their specific choices, which for many of them no explanation can be provided. Moreover, they tend to either create over-complex ML models that might perform well, but might not be efficient enough (e.g., since their training is costly), or create ML models that are under-performing. Yet, the real challenge is when developers themselves need to use ML methods and techniques, or maintain the ML components of the system. This is a common scenario, due to the shortage of data scientists around the globe.
To enable software engineers without extensive knowledge in ML to carry out the development, maintenance and customization of AI-intensive software systems, we propose a novel approach that integrates Automated Machine Learning (AutoML) with automated source code and ML model generation. Our work has two pillars: domain-specific Model-Driven Software Engineering (MDSE) and Model-Driven AI Engineering (MDAE). We advocate the Model-Driven Engineering (MDE) paradigm for software and AI engineering since it offers abstraction and automation. Both are necessary in order to handle the complexity and heterogeneity that are involved in modern AI-enabled software systems, in particular given their distributed nature and the diversity of their hardware and software platforms, APIs and communication protocols. In this manuscript, we concentrate on the domain of the Internet of Things (IoT) since it can reflect the said challenges related to decentralization and heterogeneity very well. We adopt the DSM methodology as proposed by Kelly and Tolvanen [2] and build on the prior work ML-Quadrat [3].
We enable software system models to become capable of not only generating the code, test cases, build/run scripts, and documentation, but also the ML models. In addition, the generated ML models can be automatically trained, tested, deployed, re-trained and re-configured as necessary. The choice of the ML model family or architecture (e.g., decision trees), as well as the ML model hyper-parameters (e.g., learning algorithm) and other possible configurations may be performed in a fully automated fashion. This is the main innovation of this work compared to the state of the art, namely ML-Quadrat [3].
In the following, we first propose our novel approach. Then, we show the experimental results of our case study for the validation. Finally, we conclude.
AutoML
AutoML aims to automate the practice of ML for real-world applications. It offers end-to-end solutions to non-experts (and experts) in the field of ML in a more efficient manner, compared to the manual approach. The automation might be applied to any part of the ML pipeline: from data pre-processing to hyper-parameter optimization and model evaluation. Most existing AutoML solutions concentrate on one particular part of the ML pipeline [1]. In this work, we focus on ML model family/architecture selection, as well as hyper-parameter optimization for the ML model. To this aim, we construct a tree-structured search space by considering a number of ML methods that have proven useful for the selected use case scenario of the case study that will follow. The set of selected ML methods comprises (i) Decision Trees (DT), (ii) Random Forests (RF), (iii) Gated Recurrent Units (GRU), (iv) Long Short-Term Memories (LSTM), (v) Fully-Connected Neural Networks (FCNN), also known as Multi-Layer Perceptron (MLP), (vi) Denoising Autoencoders (DAE), (vii) Factorial Hidden Markov Models (FHMM), and (viii) Combinatorial Optimization (CO). Figure 1 illustrates the mentioned search space with these ML methods and the possible hyper-parameters that must be automatically tuned for each of them should they get selected by the AutoML engine.

We consider the possible choices for setting the hyper-parameters as listed below: (a) criterion {MSE (Mean Squared Error), Friedman_MSE, MAE (Mean Absolute Error)}; (b) min sample split Uniform [2,200]; (c) n estimators (i.e., number of estimators) Uniform [5,100]; (d) optimizer {Adam, Nadam, RMSprop}; (e) learning rate {1e-2, 1e-3, 1e-4, 1e-5}; (f) loss function {MSE, MAE}; (g) n layers (i.e., number of layers) Uniform [5, 8]; (h) dropout probability Uniform [0.1, 0.6]; (i) sequence length {64, 128, 256, 512, 1024}.
To enable the automated selection of the best ML model architecture/family and the most appropriate hyper-parameters for the selected ML model given a specific use case and a dataset, we deploy Bayesian Optimization (BO). There exist various open-source libraries that offer BO. We pick the most widely-used library, namely Hyperopt [4]. This library requires a Tree-structured Parzen Estimator (TPE) model and provides distributed, asynchronous hyper-parameter optimization. Moreover, it supports search spaces with different types of variables (continuous and discrete), varied search scales (e.g., uniform vs. log-scaling), as well as conditional variables that are only meaningful for certain combinations of other variables [4].
AutoML-enabled MDSE & MDAE
We augment MDSE with AutoML to support software developers who might not be ML experts in creating smart software systems. We provide them with a Domain-Specific Modeling Language (DSML) that is based on the prior work ML-Quadrat [3], which supported automated source code and ML model generation for smart IoT services. In ML-Quadrat, the practitioners themselves had to specify the target ML model family/architecture, as well as the values of the corresponding hyper-parameters. However, to assist the software developers who use the DSML and have ML requirements, but may not necessarily possess sufficient ML knowledge and skills, we provide the above-mentioned AutoML prototype as open-source software on Github111https://github.com/ukritw/autonialm. Currently, it is tailored to the target use case domain of our case study that is described below. Using this prototype that has also a web-based Graphical User Interface (GUI), one can select the most appropriate setup for ML and feed it into the ML-Quadrat DSML. Last but not least, we implement a number of constraints and exception handling mechanisms, according to the API documentations of the target ML libraries, namely Scikit-Learn and Keras/TensorFlow, in the model-to-code transformations (code generators) of ML-Quadrat. If the AutoML mode is enabled, then we can enforce these constrains and allow them to make necessary changes to the existing user-specified parameters of the model instances. Otherwise, we only let them show warnings without overriding any user-specified option. For instance, if standardization of numeric values must have been done before training a certain ML model, but this is missing, we warn them while generating the implementation of the target IoT service out of the software model. Only in the case that AutoML is ON, then we additionally add the proper standardization technique in the data pre-processing phase of the ML pipeline.
Case Study
To validate the proposed approach, we demonstrate our experimental results of a case study from the smart energy systems domain. Here is the use case scenario: Given an aggregate signal of the electrical energy consumption of a household over a period of time, we aim to disaggregate the signal into a number of individual loads. This is called Non-Intrusive (Appliance) Load Monitoring (NIALM/NILM) or energy disaggregation, and is similar to the single-channel source separation problem in Physics and Signal Processing, but generally more challenging. We conduct a benchmarking of a number of competing approaches to NIALM, using the REDD [5] and the UK-DALE [6] reference datasets. It transpires that simple ML models, such as DT that have not been studied can actually outperform some of the more complex deep learning ML model architectures that were proposed in the literature. Note that training a DT is much faster and requires much less amount of data and computational, as well as energy resources, compared to a deep learning model. This example shows the benefits of the proposed AutoML-based approach, even for the ML experts themselves, since they could avoid trial-and-error practices for selecting the ML model and tuning its hyper-parameters. In addition, another deep learning ML model, namely GRU, which is proposed by this work, outperforms the state of the art approaches. Figure 2 illustrates the experimental results of our benchmarking study with the following NIALM approaches: (i) CO [7], (ii) DAE [8], (iii) DT, (iv) Dictionary-based (our implementation of [9]), (v) DNN-HMM (our implementation of [10]), (vi) FCNN, (vii) FHMM [11], (viii) GRU, (ix) LSTM [8]. Note that applying DT, FCNN and GRU to this problem is our initiative. Table 1 shows the average error (MAE) for the mentioned approaches. Note that we used the data of days from house 1 of the REDD dataset [5] with a sampling rate of Hz.

Conclusion
We proposed a novel approach to enable AutoML in model-driven software and AI engineering of smart IoT services. We automated the ML model family/architecture selection and the hyper-parameter configuration parts of the ML pipeline. The deployed BO method selects the best options for the ML model and its hyper-parameters, such that the prediction results of the trained ML model outperform any manual practices, or at least perform as good as them222Obviously, this holds only for the supported ML models and methods by the AutoML engine..
References
- [1] He, X., Zhao, K., Chu, X. (2021). “AutoML: A survey of the state-of-the-art” Knowledge-Based Systems., Volume 212.
- [2] Kelly, S., Tolvanen, J.P. (2008). Domain-Specific Modeling: Enabling Full Code Generation, 1st edn. Wiley, Hoboken.
- [3] Moin, A., Challenger, M., Badii, A., Günnemann, S. (2022). A model-driven approach to machine learning and software modeling for the IoT. Softw Syst Model.
- [4] Bergstra, J., Yamins, D., Cox, D. D. (2013) Making a Science of Model Search: Hyperparameter Optimization in Hundreds of Dimensions for Vision Architectures. Proc. of ICML.
- [5] Kolter, J. Z., Johnson, M. J. (2011). REDD: A public data set for energy disaggregation research. Proc. of the SustKDD workshop on Data Mining Applications in Sustainability.
- [6] Kelly, J., Knottenbelt, W. (2015). The UK-DALE dataset, domestic appliance-level electricity demand and whole-house demand from five UK homes. Sci Data 2, 150007. Nature.
- [7] Hart, G. W. (1992). Nonintrusive appliance load monitoring. Proc. of the IEEE, vol. 80, no. 12, pp. 1870-1891.
- [8] Kelly, J., Knottenbelt, W. (2015). Neural NILM: Deep Neural Networks Applied to Energy Disaggregation. Proc. of the ACM Int. Conf. on Embedded Systems for Energy-Efficient Built Environments.
- [9] Elhamifar, E., Sastry, S. (2015). Energy disaggregation via learning ’Powerlets’ and sparse coding. Proc. of the AAAI Conf. on Artificial Intelligence.
- [10] Mauch, L., Yang, B. (2016). A novel DNN-HMM-based approach for extracting single loads from aggregate power signals. Proc. of the IEEE ICASSP.
- [11] Reyes-Gomez, M. J., Raj, B., Ellis, D. R. W. (2003). Multi-channel source separation by factorial HMMs. Proc. of the IEEE ICASSP.
Armin Moin is a doctoral researcher at the department of Informatics of the Technical University of Munich (TUM) in Germany. His research is at the intersection of ML and MDSE for smart IoT services. Contact him at [email protected].
Ukrit Wattanavaekin is an alumnus of the Computer Science Master’s program of the department of Informatics of the TUM in Germany. Contact him at [email protected].
Alexandra Lungu is an alumna of the Computer Science Master’s program of the department of Informatics of the TUM in Germany. Contact her at [email protected].
Moharram Challenger is an assistant professor at the department of Computer Science of the University of Antwerp, Belgium. His research interests include MDE and cyber-physical systems. Contact him at [email protected].
Atta Badii is a professor in secure pervasive technologies at the department of Computer Science of the University of Reading, UK. He has established a track record of key contributions to over 40 projects. Contact him at [email protected].
Stephan Günnemann is a professor at the department of Informatics of the TUM in Germany and director of the Munich Data Science Institute. His research focuses on making ML robust and reliable. Contact him at [email protected].
Notice
This work has been submitted to the IEEE for possible publication. Copyright may be transferred without notice, after which this version may no longer be accessible.