https://doi.org/10.31449/inf.v45i2.3509 Informatica 45 (2021) 315–316 315 Three Methods for Energy-Efficient Context Recognition Vito Janko Jožef Stefan Institute, Ljubljana, Slovenia E-mail: vito.janko@ijs.si Thesis summary Keywords: context recognition, optimization, energy efficiency, Markov chains, duty-cycling, decision trees Received: April 13, 2021 Context recognition is a process where (usually wearable) sensors are used to determine the context (location, activity, etc.) of users wearing them. A major problems of such context-recognition systems is the high energy cost of collecting and processing sensor data. This paper summarizes a doctoral thesis that focuses on solving this problem by proposing a general methodology for increasing the energy- efficiency of context-recognition systems. The thesis proposes and combines three different methods that can adapt a system’s sensing settings based on the last recognized context and last seen sensor readings. Povzetek: V doktorski disertaciji so predstavljene tri različne metode za povečevanje energijske učinkovitosti nosljivih senzorjev. 1 I ntr o duct i o n Widespread accessibility of wearable sensing devices opens many possibilities for tracking the users who wear them. Possible applications range from measuring their exercise patterns and checking on their health, to giving them location-specific recommendations. In this work we will use the term context-recognition for all these tasks. A common problem when using such context- recognition systems is their impact on the battery life of the sensing device. It is easy to imagine that an application that monitors users’ habits using all the sensors in a smartphone (accelerometer, GPS, Wi-Fi etc.) will quickly drain the phone’s battery, making it useless in practice. While many methods for reducing the energy- consumption of a context-recognition system already exist, most of them are specialized. They work either in a specific domain or can only optimize the energy consumption of specific sensors [1]. Adapting these methods to another domain can be laborious and may require a lot of expert knowledge and experimentation. In addition, many methods proposed in the related work are “static”, i.e., they always use the same sensing setting instead of switching between them based of the current need [2]. It would be highly beneficial to have a general methodology that can prescribe rules for dynamically adapting sensing settings of any context-recognition system to make it more energy-efficient – without having any expert knowledge about the domain. One such methodology was proposed in our doctoral thesis [3], and is summarized in this paper. 2 M etho d o l o g y The presented methodology consists of three different methods for decreasing the energy-consumption of a context recognition system, and then combining them in three different ways. The first two methods adapt sensor settings based on the last recognized context, while the last adapts them based on the values of features used by machine-learning models for context recognition. 2.1 Setting to Context Assignment (SCA) Assume that the context recognition system is classifying subsequent instances using some setting s. A setting can be what sampling frequency is used, the list of active sensors, duty-cycle lengths, etc. The setting used changes whenever the context changes, for example, when context c 1 is detected we might use setting s 4, but when context c 2 is detected we might use setting s 1. This opens the problem of finding an ideal assignment of which setting to use for each context. Trying every combination is infeasible, due to a) the large number of assignment combinations and b) the long time needed to evaluate each combination. We thus proposed a more efficient search scheme. First, we created a mathematical model based on Markov chains that can predict the performance of any single assignment. The only inputs needed for this are the performances of using each setting individually, and the transition matrix between different contexts. Second, we used multi- objective optimization (specifically the NSGA-II [4] algorithm) – with the two objectives being the energy consumption and the classification accuracy – to efficiently search for Pareto-optimal assignments. 2.2 Duty-Cycle to Context Assignment (DCA) The second method works essentially the same way as the first: a mathematical model is first built to model assignments and the NSGA-II algorithm is used to search for the best ones. 316 Informatica 45 (2021) 315–316 V. Janko The main difference is that the DCA method is specialized and can only use duty-cycle lengths as the settings. This allows for the construction of a mathematical model that is more accurate and needs only the performance of one setting (no duty-cycling) as the input. This specialization is justified as effectively every context recognition system can use duty-cycling to effectively reduce its energy consumption. 2.3 Cost-Sensitive Decision Trees (CS-DT) The first two methods change settings based on the last recognized context. Such adaptation might be considered too “coarse”, especially if the number of contexts is low. To remedy this, we introduced the third method that can adapt based on the feature values instead. This is done by using cost-sensitive decision trees (CS-DT) [5]. These trees work similarly to regular decision trees, with the exception that when building them we also consider the cost of each feature and not only its utility. In our thesis we show how to adapt the CS-DT methodology for context recognition. When traversing such a tree, the setting (usually which sensors are used) is dynamically changing based on the tree node reached – thus implicitly adapting to feature values. 2.4 Method combinations The three methods can be combined in different ways to further increase the energy efficiency. We proposed the SCA + DCA, SCA + CS-DT and the SCA + DCA + CS- DT combinations. The combination of all three methods is made by first generating different CS-DTs, and then using them as settings for the SCA method. After an assignment of which CS-DT is used for each context is made, we use the DCA method to determine the duty-cycle lengths for different contexts. 3 R es ul t s Our methodology was tested on four real-life datasets (publicly available SHL and Opportunity, and our own Commodity12 and E-Gibalec) and on a family of artificial datasets. While many solutions were generated, we here list one sample solution for each dataset to serve as a reference for the efficiency of our methodology. These results were taken from the best performing method combination. For the SHL dataset we were able to use only 5% of the available data (by using lower frequency, duty-cycling and using a sensor subset) and in exchange sacrifice only 5% of the accuracy. For the Opportunity dataset we were able to find a solution that uses 4 sensors on average (instead of the original 30) and in exchange loses a minimal amount (0.01 points) of F-score. For the Commodity12 dataset we analysed four different users with somewhat different habits. Averaging the results of all four we decreased the smartphone’s energy consumption from 123 mA to 29 mA. In exchange we lost less than 1 percentage point of accuracy in all cases. Finally, for the E-Gibalec dataset, energy was reduced from 46 mA to 24 mA at the cost of less than 1 percentage point of accuracy. The methods outperformed two state-of-the-art methods from the related work – both when compared to our methods used individually, but especially when our methods were combined. Comparison between different methods is shown in Figure 1. It shows different trade-offs between the energy consumption and classification accuracy, and how combining different methods improves the quality of the found trade-offs. Figure 1: Comparison of different methods and their combinations on the E-Gibalec dataset. 4 C o ncl u s i o n The presented methods are very general and should be applicable to most context recognition systems. They require no expert knowledge (with the exception of selecting possible settings) and almost no hand-picked parameters. The method implementation is openly available in the form of a Python library [6] and we hope it could be of use to designers of context-recognition systems. R efe r ence s [1] Wang, Yi, et al. "A framework of energy efficient mobile sensing for automatic user state recognition." Proceedings of the 7th international conference on Mobile systems, applications, and services. 2009. [2] Khan, Aftab, et al. "Optimising sampling rates for accelerometer-based human activity recognition." Pattern Recognition Letters 73 (2016): 33-40. https://doi.org/10.1016/j.patrec.2016.01.001 [3] Janko, Vito. Adapting sensor settings for energy- efficient context recognition. Diss. Ph. D. thesis, Jožef Stefan International Postgraduate School, 2020. [4] Lomax, Susan, and Sunil Vadera. "A survey of cost- sensitive decision tree induction algorithms." ACM Computing Surveys (CSUR) 45.2 (2013): 1-35. https://doi.org/10.1145/2431211.2431215 [5] Deb, Kalyanmoy, et al. "A fast and elitist multiobjective genetic algorithm: NSGA-II." IEEE transactions on evolutionary computation 6.2 (2002): 182-197 https://doi.org/10.1109/4235.996017 [6] EECR, https://pypi.org/project/eecr/, Last accessed: 08-03-2021