ansactions Towards an Efficient Implementation of Human Activity Recognition for Mobile Devices

The availability of diverse and powerful sensors embedded in modern Smartphones opportunities for developing context-aware appli human activity data with such devices, data pre required to operate while meeting hardware resource constraints, par present a comparison study for HAR exploiting feature selection approaches to reduce the computation and training time needed for the discrimination of targeted activities publicly available dataset. Results show that Recursive Feature Elimination method combined with Radial Basis Function Support Vector Machine classifier offered the best tradeoff between training time/recognition


Introduction
Researchers are developing many new challenging application scenarios based on mobile phone sensors in various aspects related to the Smart City concept such as in healthcare (e.g., fitness, diabetes, elderly and obesity assisted surveillance), in smart homes (e.g., context aware indoor air quality and thermal comfort control) and in smart transportation (e.g., traffic congestion).necessary elements to make the link between the physical world and the virtual world while the intelligent system performs analysis in the virtual world.It turns out that modern smartphones/mobile devices can play a key role in the recognition of complex states of the user and its environment, particularly the inference of her physical activity thanks to the multitude of embedded sensors and Researchers are developing many new challenging application scenarios based on mobile phone sensors in concept such as in healthcare (e.g., fitness, diabetes, elderly and obesity assisted surveillance), in smart homes (e.g., context aware comfort control) and in smart transportation (e.g., traffic congestion).Sensors are the necessary elements to make the link between the physical world and the virtual world while the intelligent system performs analysis in the virtual world.It turns out that modern smartphones/mobile devices can play a key role in states of the user and its environment, particularly the inference of her physical embedded sensors and Machine Learning techniques (ML).Recognition (HAR) using Smartphones has been widely studied during recent years mainly because Smartphones are not intrusive, widely used in everyday life wearable.In addition, modern Smartphones devices integrate powerful processors, multiple communication technologies, multimedia capability and memory storage.Today's smartphones can also power of the cloud that allows them to offload expensive computation.Moreover, the variety of available wireless access and communication technologies implemented provide means of long-distance communication to user's body wearable sensors.present the smartphone internal study, then overview the current trends related to activity recognition pr

Towards an Efficient Implementation of Human Activity
Mohamed Bakhouya 2   obile devices has created exciting Although there is good capacity for collecting and classifying processing and model building techniques that achieve this goal are time applications.In this paper, we present a comparison study for HAR exploiting feature selection approaches to reduce the computation and training time .We validated our approach on a Results show that Recursive Feature Elimination method combined with Radial Basis Function Support Vector Machine classifier offered the best tradeoff between training time/recognition performance.distributed under the terms of the Creative ive ), which permits unlimited use, distribution and techniques (ML).Human Activity Recognition (HAR) using Smartphones has been widely recent years mainly because Smartphones are widely used in everyday life, and also odern Smartphones devices integrate powerful processors, multiple communication apability and memory storage.also benefit from the growing power of the cloud that allows them to offload expensive the variety of available wireless access and communication technologies implemented distance communication to the other user's body wearable sensors.In the following, we will internal sensors used for HAR in our , then overview the current trends and constraints process.

Accelerometer
Accelerometer has been initially integrated into smartphones in order to automatically determine the orientation in which the user is holding the phone and to adjust the screen to proper viewing when user changes the orientation from landscape/horizontal to portrait/vertical and vice Accelerometer readings reflect accelerations, i.e. velocity (as the acceleration is the first time derivative of the velocity) and changes in position (by integrating the signal).
The accelerometer, however, measures all the accelerations that affect the device, which are the sum of the gravity acceleration and the actual linear acceleration that are associated with the movement of the device physical axis: x (lateral), y (vertical) and z (longitudinal) relative to the screen of the phone as described in Fi (leftside) .The raw data stream from the accelerometer is the acceleration of each axis measured in SI (International System) units, m/s2.A time stamp can also be returned together with the three axes readings.However, some activities are usually indistinguishable using only accelerometer information.Thus, multiple required.

Gyroscope
Gyroscope is used to help determine mobile orientation by use of earth's gravity.It also adds an additional dimension to the information supplied by the accelerometer by tracking rotation or twist and it is primarily used for navigation and measurement of the angular rotational velocity.measures the phone's rotational velocity along the roll, pitch, and yaw axes.The axes directions are s Figure 1 (rightside).The raw data from a gyroscope is in rad/s (radian per second).Modern mobile devices refined the gravity measurement by creating a virtual sensor that is implemented as a sensor-fusion of several basic physical sensors, the accelerometer, the gyroscope, and the magnetic sensor instead of the previous low-pass filter which induced an inherent delay.The new technique resulted in much more accurate and fast responding gravity and tilt measurements.

Activities
Activities recognized by smartphones can be classified in terms of complexity, from simple locomotion such as moving or stationary, walking or running, etc, t complexe activities such as cooking, dining, brushing teeth, etc.Some applications, use either smartphone sensors or a combination of environmental smartphone sensors for collecting information infer context-aware activities.Moreover, s physical and behavioral characteristics are unique to an individual, smartphone-based personal biometric signature may provide a wide range of possible solutions, which could be used either for the purpose of controlling smart home appliances (e.g., TVs, stereos, dishwashers, heating and and C. N. Auth Ilham Amezzane et al.

2
Accelerometer has been initially integrated into smartphones in order to automatically determine the orientation in which the user is holding the phone and to adjust the screen to proper viewing when user changes the orientation from landscape/horizontal to portrait/vertical and vice-versa.
eflect accelerations, i.e. changes in (as the acceleration is the first time derivative of the (by integrating the signal).The accelerometer, however, measures all the accelerations are the sum of the gravity acceleration and the actual linear acceleration that are associated with the movement of the device on all three physical axis: x (lateral), y (vertical) and z (longitudinal) relative to the screen of the phone as described in Figure 1 .The raw data stream from the accelerometer is the acceleration of each axis measured in SI (International System) units, m/s2.A time stamp can also be returned together with the three axes readings.However, some indistinguishable using only multiple sensors may be Gyroscope is used to help determine mobile orientation by use of earth's gravity.It also adds an additional dimension by the accelerometer by tracking rotation or twist and it is primarily used for navigation and measurement of the angular rotational velocity.Gyroscope measures the phone's rotational velocity along the roll, pitch, and yaw axes.The axes directions are shown in data from a gyroscope is in Modern mobile devices refined the gravity measurement by creating a virtual sensor that is fusion of several basic physical celerometer, the gyroscope, and the magnetic pass filter which induced an inherent delay.The new technique resulted in much more accurate and fast responding gravity and tilt measurements.
nized by smartphones can be classified in terms of complexity, from simple locomotion such as moving or stationary, walking or running, etc, to more dining, brushing teeth, use either smartphone embedded environmental sensors and sors for collecting information, in order to Moreover, since many physical and behavioral characteristics are unique to an based personal biometric signature range of possible solutions, which could be used either for the purpose of controlling smart home appliances (e.g., TVs, stereos, dishwashers, heating and light), or to authenticate users and thus to p level of security and theft prevention.For example, in [28], Accelerometer Gesture Recognition, called uWave based on physical manipulation of the device with low cost and high efficiency.It is particularly suitable for implementation on resource-constrained devices, such as mobile phones and TV remotes.
A major goal of the current rese to develop new technologies and applications for elderly care.Those applications could help prevent harms, detecting dangerous situations.For example, it is possible to recognize trends or daily habits can be easy to early detect any to be recognized play an important role in the design decisions of an HAR system, because it can help appropriate choices regarding sensor extraction and classification methods

HAR Process
Typical HAR can simply be defined as the process of interpreting raw sensor data to classify a set of human activities.ML techniques are used to infer information about the activities from the raw sensor reading consists of the following sequences (1) Sensing (or data acquisition): In this step, sensor data are collected at a specific sampling rate from one or more sensors.
(2) Preprocessing: In this step, For example, noise is removed and data are segmented.
( and Gyroscope axes on Smartphones [29,30] ], Accelerometer-based Personalized uWave, enables authentication based on physical manipulation of the device with low cost and high efficiency.It is particularly suitable for constrained devices, such as mobile phones and TV remotes.A major goal of the current researches in HAR monitoring is to develop new technologies and applications for elderly care.Those applications could help prevent harms, by dangerous situations.For example, it is possible to recognize trends or daily habits of an elderly user, so that it detect any anomaly.The set of activities recognized play an important role in the design ystem, because it can help make the regarding sensor selection, feature cation methods [1].
Typical HAR can simply be defined as the process of interpreting raw sensor data to classify a set of human activities.ML techniques are used to infer information about the activities from the raw sensor readings; the process consists of the following sequences.
(1) Sensing (or data acquisition): In this step, sensor data are fic sampling rate from one or more (2) Preprocessing: In this step, collected data are processed.example, noise is removed by applying specific filters In this step, various features are .These features are used as inputs to the classifier , the trained classifiers are used activities.
3 Before the classification step can be performed for the first time, a model need to be trained.In supervised ML, the training phase requires labeled data to learn the model parameters.The classification phase uses the parameters of the trained model to classify new detected activities.Training can either be offline on a desktop machine or online on the phone itself.In the offline approach, labeled data are first collected and stored.These data are used later for obtaining the model parameters.If training is performed online, the labeled data are directly processed for training and the obtained model parameters are stored for later use in the actual online activity recognition.

Resource constraints
Although the research on activity recognition is beneficial from the availability and flexibility of smartphone's embedded sensors, it also faces many challenges.Actually, modern Smartphone devices have great capacity for collecting and classifying large amounts of multiple sensor readings.However, energy consumption is of a great a concern, especially for continuous monitoring applications which might deliver critical information.Consequently, in most applications, extending the battery life is a desirable feature.HAR energy consumption is mainly due to sensing, processing, communication, and user interface tasks.By processing, we mean data pre-processing, features extraction, training and classification.Communicating sensor data is generally more energy consuming than processing data locally, therefore, one way of improving battery life of any mobile device is to minimize the amount of transmitted data [31].Nonetheless, if communicating data is necessary in some applications, short range wireless networks should be preferred over long range networks as the former require lower power.Minimizing communication means more local processing on the device, which means additional computations that may affect the battery life as well.Thus, every step of the HAR process must consider the trade-off between battery life and effectiveness.In the present work, our goal is to create a simple classification model for HAR, by selection of few relevant features without scarifying the performance.This model is intended to be run in online HAR system; therefore, an accelerated implementation is also studied to reduce training time.This is the first step towards energy consumption analysis which will follow in a second phase.The remainder of this paper is organized as follows.In Section 2 we will present a state of the art of works linked to our goals.Material and methods used in the present study are presented in Section 3. Experimental results are discussed in Section 4. Section 5 presents the conclusions and future work.

Related Work
In the literature, many approaches may be used in order to save energy and improve response time during the processing steps, such as adaptive/dynamic sensor selection [8,9] and adaptive sampling rate [10,11].Another important point is whether the classification or training steps should be done online on the device or offline in the server or the cloud.Actually, offline scheme provides more powerful resources capabilities allowing the use of complex approaches for better results, especially if intended for applications that do not require real-time feedback or where online recognition is not necessary because it may introduce additional time to classify activities due to the high computational demands.On the opposite, online scheme should substantially reduce the energy drained from the battery as collected data would not have to be continuously sent to a server or cloud for processing and/or classification.Although it is still a challenging task, online approach would not have been feasible if modern smartphones were not equipped with higher computing and storage resources, even though battery capacities are still scaling more slowly.If online HAR system is implemented fully on-device it offers other advantages such as robustness and responsiveness, thanks to its independence from unreliable wireless communication links or Internet connection that are needed for sending sensor data for further processing to a server or a cloud.Moreover, it avoids transmission of sensitive user information, such as location, activities and user's health.Authors in [1] have reviewed research studies in this domain and stated that only few of them focused on online training in which classifiers can be trained in real time on mobile phones [2][3][4][5][6][7].In addition, classifiers could play a key role in HAR process regarding energy consumption depending on their simplicity or complexity.Nonetheless, some of them have proven their suitability for Smartphone implementation, such as K-nearest neighbours (KNN), Support Vector Machine (SVM) and Decision Tree (DT) [1].Moreover, in the pre-processing phase, various features (or variables) are extracted from sensor readings.They are used later during training or recognition phases.Two main types of features are generally used: time and frequency domain features.It has been shown in [12] that the former are cheaper than the latter in terms of computation and storage costs.However, frequency-domain features may improve classification accuracy.Similarly, large feature sets may significantly slow down the learning process in practice, although extracting more features may improve accuracy [13].In fact, the "dimensionality curse" phenomenon states that the number of needed training data grows exponentially with the number of dimensions used [14].Subsequently, the training phase requires further intensive computation if locally undergone on Smartphones [15].Here come Feature Selection (FS) approaches into play in order to select optimal subsets of variables in the preprocessing step.The main benefits are reducing the computation cost and storage requirements as well as training time [13].In the following, we review studies done so far that implement online activity recognition systems, especially works that combine the following desirable features: • They implement online activity recognition locally on the phone.Towards an Efficientnt Implementation of HumHuman Activity Recognition for Moobbile Devic

EAI Endorsed Transactions on
• They only employ the internal mobile phone sensors, excluding any work that may combine external and internal smartphone sensors.• Their systems are able to recognize some activities.
• Their systems are able to achieve high overall recognition rates • They should evaluate their systems regarding at least one of the mobile phone resources such as CPU usage/ memory / power consumption.In particular, we will present the impact of on mobile phone resources like sensor selection, rate, features set, classification methods and

Sensor selection impact
Each specific activity may need one or a combination of different sensors for its accurate recognition.However, for a set of various targeted activities, it is possible that some sensors are useful only sometimes during continuous online monitoring for their targeted activities, but still turned on all the time draining power subsequently.Methods such as dynamic and adaptive sensor selection have been used by some researchers in order to improve battery life.This means that unused sensors are turned off adaptive way after detection of the mobile status and user's activities.In [8], an adaptive GPS strategy allows the phone to save power by intelligently disabling the GPS as soon as a user enters a building.In [9], authors demonstrated hierarchical sensor management strategy significantly improved battery life of the device by selectively turning on the minimum set of sensors and triggering new set of sensors if necessary to achieve state transition detection.It has been shown in the same work that energy consumed by different sensors varies greatly.To further drain from sensors, some works investigated activity classification using a single accelerometer approach produces data set that can be smaller than that of a multiple sensor approach, saving power in classification.

Sampling rate impact
The sampling frequency (SF) has a direct impact on the system's resources.Increasing the sampling more samples and therefore more pre-processing operations and memory usage of the system.In [37], sampling rate of 1 Hz could achieve high performance for detecting activities (sitting, standing, walking, and running) in an offline HAR system.Evaluation of the power consumption of the online system with different sampling rates that data processing is the most consuming part, followed by data collection part and then the proposed recognition algorithm part.In their survey, authors in 50, 32 and 20 Hz were the most SF used observe a range from 2 Hz to 125 Hz with reasonable reported accuracies.They also reported that m used a fixed SF except two, where adaptive sampling for Each specific activity may need one or a combination of different sensors for its accurate recognition.However, for a set of various targeted activities, it is possible that some sensors are useful only sometimes during continuous online eir targeted activities, but still turned on all the time draining power subsequently.Methods such as dynamic and adaptive sensor selection have been used by some researchers in order to improve battery life.This means that unused sensors are turned off in real time in an detection of the mobile status and user's an adaptive GPS strategy allows the phone the GPS as soon as a demonstrated that a hierarchical sensor management strategy significantly improved battery life of the device by selectively turning on the minimum set of sensors and triggering new set of sensors if necessary to achieve state transition detection.It n the same work that energy consumed by further minimize power investigated activity ccelerometer [33][34][35][36].This smaller than that of a ensor approach, saving power in classification.has a direct impact on the the sampling rate means processing operations ], sampling rate of 1 Hz could achieve high performance for detecting simple activities (sitting, standing, walking, and running) in an power consumption with different sampling rates has shown is the most consuming part, followed by part and then the proposed recognition in [1] found out that SF used.Overall, they observe a range from 2 Hz to 125 Hz with reasonable They also reported that most studies daptive sampling for energy efficiency has been used authors used an accelerometer and GPS, where GPS is sampled in an adaptive way.In use an activity-sensitive strategy for continuous activity recognition which adaptively makes the choices on bot sampling frequency and classification features in real time.
Recently, in [38], authors propose dynamically controls the activity recognition dura investigated the impact of varying the size (WS) by starting with a high SF and small WS to quickly identify changing activities.If the same dynamic activity is maintained for a long time, same activity will continue and adopt a method SF and increase the WS.The experimental resu that their approach reduced energy consumption compared to conventional HAR without in [32], an adaptive sampling scheme adjusts the sampling rate of the sensors dynamically based on the context of the user in terms of events observed (i.e., the sensors are sampled at a high rate when interesting events are detected and vice versa) and thus achieves an improved accuracy without considerably compromising on the energy consumption.In [39], authors proposed an saving strategy by selecting an appropriate combination of flexible frequency and classification feature for each activity.They achieved an overall 28% of energy saving in activity recognition on mobile phone.

Feature set impact
The longest is the feature vector the better the information it contains for the accurate performance of classification algorithm.However, it takes longer time to collect large data samples for long feature authors propose a hierarchical method based on a single accelerometer reduces the usage of frequency the WS to improve accuracy.domain features, authors in [ consumption by about 6.7% compared to a conventional approach adopting SVM and fast Fourier transform (FFT).They also plot power consumption against different numbers of FFT coefficients.It showed dimensionality.Recently, in effect of FS techniques on accuracy and ANNs model building time.Obviously this step simplified the model and reduced its time requirement but the recognition rate slightly decreased.For example, with the original feature set network reached 97% accuracy within 1327s and 619 s with the selected feature set.combined the effects of more than one parameter.For example, in [42], authors adopt the best sampling rates and extract feature sets in accordance with the different activities, alongside with an improved structure of multi class SVM combined with the probability of activity occurrence.Experiments show that with 51.0% of energy saving.
een used.In the first one [10], authors used an accelerometer and GPS, where GPS is In the other one [11], authors sensitive strategy for continuous activity recognition which adaptively makes the choices on both sampling frequency and classification features in real time.
proposed an approach that controls the activity recognition duration.They investigated the impact of varying the SF and the window with a high SF and small WS to quickly identify changing activities.If the same dynamic activity is maintained for a long time, they assume that the same activity will continue and adopt a method to lower the The experimental results showed approach reduced energy consumption compared to conventional HAR without sacrificing accuracy.Finally, n [32], an adaptive sampling scheme adjusts the sampling rate of the sensors dynamically based on the context of the terms of events observed (i.e., the sensors are sampled at a high rate when interesting events are detected and vice versa) and thus achieves an improved accuracy without considerably compromising on the energy proposed an adaptive energysaving strategy by selecting an appropriate combination of flexible frequency and classification feature for each They achieved an overall 28% of energy saving in activity recognition on mobile phone.the feature vector the better the discerning for the accurate performance of classification algorithm.However, it takes longer time to collect large data samples for long feature sets.In [40], hierarchical method to recognize activities based on a single accelerometer.The proposed method equency-domain features and adjusts o improve accuracy.By using SVM and timeors in [38] reduced the power consumption by about 6.7% compared to a conventional approach adopting SVM and fast Fourier transform (FFT).
power consumption against different numbers showed quadratic increase with the [41], authors examined the on accuracy and ANNs model Obviously this step simplified the model and reduced its time requirement but the recognition rate slightly decreased.For example, with the original feature set the network reached 97% accuracy within 1327s while 95.8% s with the selected feature set.Some studies combined the effects of more than one parameter.For ], authors adopt the best sampling rates and extract feature sets in accordance with the different activities, alongside with an improved structure of multiclass SVM combined with the probability of activity Experiments show that accuracy is up to 90.6% Ilham Amezzane et al.

Classification methods impact
Since supervised classification algorithms need intensive computation to generate models from training data, still only few models can be suitable for smartphone implementation.Authors, in [2], introduced "hardware friendly" adaptation for multiclass classification.The proposed approach adapts the standard Support Vector Machine (SVM) and exploits fixed-point arithmetic for computational cost and battery consumption reduction.They highlighted the proportional relationship between the number of bits used and resource consumption.For instance, the 32-bits integer model outperforms in speed and battery life the 32-bit float model.In [43], authors use DT for training all the data which do not spend too much CPU processing and memory, and then they use the SVM to analyze the hard portion only.This way they got the best tradeoff between accuracy and energy consumption.Deep learning approaches are being explored to make them suitable for mobile devices.By extracting features directly from the input data, learning methods can be more generalized instead of hand-crafting appropriate features for each type of activities.However, this is typically achieved by introducing additional layers and nodes for classification, which increases computational complexity.In [44], authors use the Hexagon DSP of the Qualcomm Snapdragon SoC available in some smartphones.This chip is particularly suitable for continuous sensing tasks since it allows the power-hungry CPU to often remain in lowenergy sleep mode.They observed on average an 8× to 14× in energy savings when DNNs run on the DSP instead of the CPU.Although, DSP presents several limitations due to its small program and memory space; DNN use is feasible on the DSP and has a low energy and runtime overhead allowing real-time requirements while preserving accuracy.Runtime values of about 16ms are reported for processing 4 seconds of accelerometer data using 24 feature set.

Online Training impact
In most of the current studies, training is performed offline using ML tools.In fact, the training algorithm which is trained on a large data set of many users have long calculation times, since the training data set increases with every user added to it.In [45] DT, -NN, and NN have been trained.The faster was -NN with only 0.1 s.The DT was also fast, with 2.88 s.The training process of the NN was much slower, as it needed 967.16 s.Both the DT and the NN produced a model of ≈1 MB size, -NN gives a model of ≈10 In [6], authors considered using limited training data which can be collected only in a few minutes considering the limited memory available on the phones.However, there are limitations that can result from using this type of learning process: • The obtained model is static: once a model is generated it does not adapt to the user's activity profile changes and is not subject specific.• Computational costs: training batch algorithms usually requires cross-validation techniques in order to avoid overfitting, and that the entire dataset is allocated into main memory.Subsequently, there is a need towards implementing training models on the mobile devices in an online manner, since online training can help developing fast user dependent applications such as for fitness or healthcare monitoring.In [7], authors demonstrate the Mobile Activity Recognition System (MARS) where for the first time the model is built and continuously updated on-board the mobile device itself using data stream mining.The benefit of data stream mining is that the training samples do not need to be stored on the phone.However, the system will require initial training data for model generation and more data for adaptation.Evaluations of the resource consumption (i.e memory utilization and CPU usage) of the training phase vary proportionally with the data set sizes.Finally, in [46], authors propose a framework for activity recognition called mobile online activity recognition system (MOARS), which integrates data collection, training and inference.The framework dynamically takes into account real-time user feedbacks to increase prediction accuracy, at the cost of additional time.Nonetheless, some activities are recognized from 2 to 4 seconds, depending on the choice of the classifier.It should be noted that no information is provided regarding resource consumption or online training times.

Materials and Methods
In this section, we present a comparison study for HAR exploiting feature selection approaches to reduce the computation and training time while maintaining significant performance.Training simulations were also run using parallel resampling of cross-validation over 2 CPU cores.

Data Assumptions
We use a publicly available dataset from UCI repository [16], which has been used by the authors to conduct experiments using Support Vector Machine (SVM) classifier [17].The latest update (15-Feb-2015) includes labeled data collected from 30 subjects, within an age bracket of 19-48 years, who engaged in six different activities (standing, sitting, laying down, walking, walking downstairs and walking upstairs), while wearing a Smartphone on the waist.According to the dataset text files in [16], the features selected for this database come from the accelerometer and gyroscope 3-axial raw signals.These time domain signals were captured at a constant rate of 50 Hz.Then they were filtered using a median filter and a 3rd order low pass Butterworth filter with a corner frequency of 20 Hz to remove noise.Similarly, the acceleration signal was then separated into body and gravity acceleration signals using another low pass Butterworth filter with a corner frequency of 0.3 Hz.Subsequently, the body linear acceleration and angular velocity were derived in time to obtain Jerk signals.Also the magnitude of these three-dimensional signals was calculated using the Euclidean norm.Towards an Efficientnt Implementation of HumHuman Activity Recognition for Moobbile Devic applied to some of these signals.From each window, a vector of 17 signals is then obtained.A set of different statistical variables were estimated from these signals so as each activity window (2,56 seconds) is finally composed of 561-feature vector.The list of all the measures applied to the time and frequency domain signals are also available in [16].All features were normalized and bounded within [ 1].We observed that the instances in the data set are fairly evenly distributed across the six activity classes.Therefore, the overall accuracy can be representative of th performance of a classifier.The dataset employed came from a controlled experiment, where subjects did a single activity in a given time frame and the activities were separated with a pause of a few seconds.results therefore can be attributed solely to the dataset features vector with certainty.'subject ID' was not included as a covariate.This is because we do not consider the subject dependency in this dataset.The number and class proportions of observations in each subset are shown in Table 1.

Feature Selection
In practice, little knowledge is available about features that might capture relevant information to various targeted classes.Therefore, many candidate features are excessively constructed.Given the large feature set, it is expected that many features are irrelevant for any given activity.Actually, these features will represent just noise to the classifier.FS methods aim to select a small subset of features that minimize redundancy and maximize relevance to the target.For example, a feature F i is said to be relevant to a class if F i and C j are highly correlated [18].For the supervised classification problem, The HAR system operates in two modes: learning (training) from a given set of examples and predicting or (testing).In the training phase, s may find suitable features that best describes the input patterns guided by the label information.In the classi phase, the system makes automatic decision about unknown input patterns.In literature, there are three main approaches for FS: i) Filter methods for measuring the "relevance" the features independently of the classifier Wrapper methods for measuring the "usefulness" of the features guided by a classifier performance Embedded methods that are implemented by alg and C. N. Auth From each window, a s is then obtained.A set of different statistical variables were estimated from these signals so as ach activity window (2,56 seconds) is finally composed of The list of all the measures applied to the s are also available in ll features were normalized and bounded within [-1, e observed that the instances in the data set are fairly evenly distributed across the six activity classes.Therefore, the overall accuracy can be representative of the true he dataset employed came from a controlled experiment, where subjects did a single activity in a given time frame and the activities were separated with a pause of a few seconds.The experimental e attributed solely to the dataset features vector with certainty.Finally, 'subject ID' was not included as a covariate.This is because we do not consider the subject dependency in this dataset.The number and class bset are shown in

Class proportions
: 0.17 : 0.19 : 0.17 : : 0.15 : 0.17 : 0.17 : 0.15 : : 0.14 : 0.17 : 0.18 : 0.17 : : 0.16 In practice, little knowledge is available about features that might capture relevant information to various targeted classes.Therefore, many candidate features are excessively constructed.Given the large feature set, it is expected that e irrelevant for any given activity.Actually, these features will represent just noise to the classifier.FS a small subset of features that minimize redundancy and maximize relevance to the target.
to be relevant to a class C j are highly correlated [18].For the supervised The HAR system operates in two modes: learning (training) from a given set of examples and predicting or (testing).In the training phase, supervised FS find suitable features that best describes the input .In the classification phase, the system makes automatic decision about unknown .In literature, there are three main approaches the "relevance" of the features independently of the classifier ii) measuring the "usefulness" of the features guided by a classifier performance, and iii) Embedded methods that are implemented by algorithms having their own built-in FS methods for performing variable selection implicitly while trained.The major advantage of the they are independent of the learning algorithm so that its bias does not interact with the bias of FS algorithm.Indeed, they typically make use of various statistical means to evaluate the relevance of features based on measures of the general characteristics of the training data such as distance, consistency, dependency and the features can be assigned a weight and they can be ranked.On the other hand, the major advantage of the wrapper models is that they may repeatedly utilize the performance of a learning algorithm to evaluate the usefulness of subsets of selected features.Nonetheless, this method is computationally expensive for data with a large number of features and they have a risk of overfitting to the model.Due to these limitations, the embedded models offer a compromise between filter and wrapper major advantage is that they perform FS and model fitting simultaneously.In the current study, we examined one method from each category: i) a filter method called Consistency-Based Filter (CBF) Recursive Feature Elimination (RFE) method called Mean Decrease in Accuracy (MDA) built in Random Forest algorithm.The three FS algorithms were run in RStudio [19] using the FSelector package [20] and the Caret package [21,22] respectively.CBF algorithm is that it includes the effect of interaction among features into evaluation of relevance [23].Consistency measures, in this regard, evaluate the collective relevance of a set of features and can be considered as a metric to measure a distance of consistent state [24].A feature set {F consistent, when Pr(C = c | F 1 = f 1 ,..., F n = f n ) = 0 where C is a target class , c is a given class value and f feature value.The main drawback of a filter method is that it totally ignores the effect of the selected feature subset on the performance of the learning model [25].approaches, a subset of features is selected and a model is fitted using them.The decision to remove (or add) iteratively features from the subset is taken based on the performance estimation until getting a highest performance value.The backward greedy search strategy which particularly computationally advantageous and robust against overfitting [18].The algorithm fits the mod features.Each feature is ranked using its importance to the model.Let S be a sequence of ordered numbers which are candidate values for the number of features to retain (S 1 > S 2 , …).At each iteration of feature selection, the S i top ranked features are retained, the model is refit and performance is assessed.The value of performance is determined and the top to fit the final model [21].In our experiments, we tried two learning models with RFE: Random Forest and Linear SVM.Finally, the MDA method algorithm embedded in the Random Forest model.The in FS methods for performing variable selection implicitly while the model is being .The major advantage of the filter methods is that they are independent of the learning algorithm so that its ith the bias of FS algorithm.Indeed, they typically make use of various statistical means to evaluate the relevance of features based on measures of the general characteristics of the training data such as distance, consistency, dependency and information [18].Therefore, the features can be assigned a weight and they can be ranked.On the other hand, the major advantage of the that they may repeatedly utilize the performance of a learning algorithm to evaluate the f selected features.Nonetheless, this method is computationally expensive for data with a large number of features and they have a risk of overfitting to the model.Due to these limitations, the embedded models offer filter and wrapper models.Their major advantage is that they perform FS and model fitting simultaneously.In the current study, we examined one method from each category: i) a filter method called Based Filter (CBF) ii) a wrapper method called Elimination (RFE) and iii) an embedded method called Mean Decrease in Accuracy (MDA) built in Random Forest algorithm.The three FS algorithms were run in RStudio [19] using the FSelector package [20] and the Caret package [21,22] respectively.The advantage of the CBF algorithm is that it includes the effect of interaction among features into evaluation of relevance [23].Consistency measures, in this regard, evaluate the collective relevance of a set of features and can be considered as a c to measure a distance of a feature subset from the A feature set {F 1 ,..., F n }is said to be ) = 0 (1) a target class , c is a given class value and f i is a The main drawback of a filter method is that it totally ect of the selected feature subset on the performance of the learning model [25].In wrapper approaches, a subset of features is selected and a model is decision to remove (or add) iteratively features from the subset is taken based on the performance estimation until getting a feature set with the highest performance value.The RFE algorithm consists of a backward greedy search strategy which seems to be particularly computationally advantageous and robust he algorithm fits the model to all features.Each feature is ranked using its importance to the be a sequence of ordered numbers which are number of features to retain , …).At each iteration of feature selection, top ranked features are retained, the model is refit performance is assessed.The value of S i with the best performance is determined and the top S i features are used to fit the final model [21].In our experiments, we tried two learning models with RFE: Random Forest and Linear method is a variable importance algorithm embedded in the Random Forest model.The general idea consists of randomly permuting the values of each feature and measuring how much the permutation decreases the accuracy of the model [26].If a feature is not useful for predicting a target, then, permuting its values will not result in a significant decrease in a model's performance.The greater the increase in percentage error the greater is the importance of the variable.

Evaluation
To evaluate whether the feature subsets were more effective for classification than the entire feature set regarding accuracy, training time and computation cost, four common classifiers were run using all features and then using the feature subsets: Linear Discriminative Analysis (LDA), Radial Basis Function Support Vector Machine (RBF SVM), K-nearest neighbors (KNN), and Random Forest (RF).In order to discriminate test data into labeled classes, classifiers have been trained first.The training data have been further automatically divided into 10 smaller datasets for the purpose of 10-fold cross-validation during learning phases.The parameters of the best final models were preserved for testing on holdout data.This classification procedure evaluated the FS results and provided outcome measures determine which classifier is best suited to online HAR implementation.In general, feature subsets with similar classifier performance to the full feature set should reduce computational burden, thus facilitating on-device implementation.

Experimental Results
After running calculations, we obtained 7 features in the subset selected by the CBF algorithm and 20 features in the subset selected by the MDA.The RFE method was tested with 2 wrapper algorithms: RF and Linear SVM.Simulations showed that the highest accuracy estimation was obtained with a 50 feature subset for the former, while it was obtained with a 280 feature subset for the latter.The latter is however not relevant to our comparative study because it showed almost the same accuracy levels as the former in the model generation phase but with longer runtimes.Thus, we excluded the RFE-Linear SVM feature subset in the rest of this paper for the sake of concision.After checking the names and descriptions of the selected features, we noticed that some variables are common between the three subsets and that the CBF subset contains only 2 frequency domain features, while the MDA subset contains 5 and the RFE subset contains 10.This reduction in the number of frequency domain features is beneficial in terms of computation cost, because the original feature set contains many frequency domain features based on FFT, which demands extra computation.Then, we constructed three new datasets with the selected subsets and conducted a comparison study in order to the feature subset that works the best regarding recognition performance and training time.We evaluated our classifiers before and after feature selection, using 10-fold cross validation technique.The parameters of the best final models were preserved for testing on hold-out data.Because balanced class proportions assumption is verified in our data sets, good performance of each classifier can be measured by accuracy metric only, and good performance of each activity is obtained if that activity can be classified with high precision (PR), recall (RC), and F-measure (F1) metrics.In Table 2, summary results of the best final models run on the Test data, in terms of time taken to build the model and Accuracy (Acc.).Activities averaged metrics such as, Macro-precision (m-PR), Macro-recall (m-RC) and Macro-F1-measure (m-F1) are also shown.Overall, LDA and SVM offered the highest performance values for the original feature set.It can be seen that the RFE subset offers the best tradeoff performance/training time with the SVM model.For all the other subsets, prediction accuracy is between 87% and 90%.The shortest training time is in favour to KNN.Therefore, recognition phase shows the best stability and performance in favour of SVM for all the subsets.With all subsets, the training time is however far better than with the original feature set.Because time domain features help preserve battery life by virtue of being less computationally intensive, we discarded all the frequency domain features from the best subset (i.e RFE subset) and the new subset (40 features) was studied using the same procedure as the previous experiments.There was a slight decrease in performance (2~3%) compared to the RFE subset (see Table 2).We also show the F1-measure that for each activity.It can be seen from Table 3, that in all experiments, the "Laying" activity was perfectly classified, followed by Walking", then "Walking Downstairs", then "Walking Upstairs", then "Standing" and finally "Sitting".The confusion matrix shown in Towards an Efficientnt Implementation of HumHuman Activity Recognition for Moobbile Devic However, the classifier sometimes confuses a misclassifies one activity from another when there are inter class similarities.Actually, it confuses little bit between all types of walking activities, but little more between "Sitting" and "Standing".On the contrary, the "Laying" activity is again perfectly classified.Furthermore, in order to figure out how well they perform over different sized versions of the training set, we have simulated the learning curves of the final SVM models obtained before and after feature selection (see Figure 2).For this purpose, the original Training data (7352 instances) was partitioned into Training set (75%) and Test set (25%), and 10-fold cross validation was used for resampling.As expected, reducing the feature space helped reducing the amount of training data reach the same classification performance.For example, in order to reach 90% of accuracy, approximately 5000 instances were needed before feature selection (Figure Left side), while only 3500 instances were needed after feature selection (Figure 2, Right side).The evaluation of the RFE subset with SVM classifier showed improvements in training time and a slight decrease in activity recognition accuracy compared to the entire feature set.This indicates that the features eliminated in the feature selection process were redundant and did not significantly contribute to classifier accuracy.Thus, with appropriate pre procedure, it is possible to obtain equivalent classifier performance with a smaller feature set, effectively reducing computation burden on the HAR process.It's worth noting that more than half of the RFE subset (i.e.27 features) is based on gravity acceleration signals, and 13 features are based on body acceleration signals, while 3 features are based on angles between the XYZ axes and the Mean signal (see [16] text files for features identification).Hence, for our study, the RFE algorithm found the gravity signals to be more relevant followed by body acceleration signals.The remaining 7 features are based on angular velocity extracted from gyroscope.Statistic estimates such as interquartile range, skewness and kurtosis of the frequency domain signals were not useful.Additional vectors obtained by averaging the signals in a signal window sample used on the angle variable were not useful as well.Finally, in Table 5, we compare approximations of sequential execution times versus parallel execution times over 2 CPU cores.The values presented are for comparison only.They may vary depending on hardware platforms, the written code, the libraries and the programming languages used.For the sequential part, we notice that total CPU time is close to elapsed time.This means that the codes are CPU bound.For the parallel part, it is clear that it helps reducing CPU time many orders of magnitude.However, still the elapsed time is large in this case.This means that the codes are Memory bound.In other words, more time is requesting data than processing it.The reason is that number of workers increases, the memory required also increases.For example, using two cores would keep a total of three versions of the data in memory.If the data are large or the computational model is demanding, performance can be affected if the amount of required and C. N. Auth 8 However, the classifier sometimes confuses and misclassifies one activity from another when there are interclass similarities.Actually, it confuses little bit between all types of walking activities, but little more between "Sitting" and "Standing".On the contrary, the "Laying" activity is perfectly classified.Furthermore, in order to figure out how well they perform over different sized versions of the training set, we have simulated the learning curves of the final SVM models obtained before and after feature this purpose, the original Training data (7352 instances) was partitioned into Training fold cross validation was used for resampling.As expected, reducing the feature space helped reducing the amount of training data needed to reach the same classification performance.For example, in order to reach 90% of accuracy, approximately 5000 instances were needed before feature selection (Figure 2, Left side), while only 3500 instances were needed after , Right side).The evaluation of the RFE subset with SVM classifier showed improvements in training time and a slight decrease in activity recognition accuracy compared to the entire feature set.This indicates ture selection process were redundant and did not significantly contribute to classifier accuracy.Thus, with appropriate pre-processing equivalent classifier performance with a smaller feature set, effectively reducing computation burden on the HAR process.It's worth noting that more than half of the RFE subset (i.e.27 features) is gravity acceleration signals, and 13 features are based on body acceleration signals, while 3 features are s between the XYZ axes and the Gravity Mean signal (see [16] text files for features identification).Hence, for our study, the RFE algorithm found the gravity signals to be more relevant followed by body acceleration based on angular velocity extracted from gyroscope.Statistic estimates such as interquartile range, skewness and kurtosis of the frequency domain signals were not useful.Additional vectors obtained by averaging the signals in a signal window variable were not useful as well.n Table 5, we compare approximations of versus parallel execution times are for comparison only.They may vary depending on hardware platforms, the written code, the libraries and the programming languages , we notice that total CPU time that the codes are CPU , it is clear that it helps reducing CPU time many orders of magnitude.However, still the elapsed time is large in this case.This means that the codes are Memory bound.In other words, more time is spent The reason is that as the number of workers increases, the memory required also increases.For example, using two cores would keep a total of three versions of the data in memory.If the data are utational model is demanding, performance can be affected if the amount of required memory exceeds the physical amount available.addition, all cores share a single memory bus linking to RAM.Memory Bound would Therefore, our ongoing research training computations using specific can be distributed across multiple (CPUs, GPUs or DSPs).This may help alleviate the CPU computation burden for calculations that parallel and may save more ene  memory exceeds the physical amount available.In addition, all cores share a single memory bus linking to RAM.Memory Bound would be slower than CPU Bound.our ongoing research involves performing specific framework so that they can be distributed across multiple smartphone devices .This may help alleviate the CPU computation burden for calculations that can be run in more energy as well.
2. Learning Curves of the SVM final models obtained: Before feature selection (Left side) and after feature selection (Right side).

Conclusion and Perspectives
In this paper, we have conducted a comparison study using Smartphone accelerometer and gyroscope sensors data obtained from a publicly available HAR dataset.As the dimensionality of the original feature set is very high, we used feature selection approaches in order to reduce the feature space before classifying activities.We implemented them in three different experiments in order to evaluate their performance at selecting features in comparison with the first experiment where we used the entire feature set.After analyzing the results, the RFE subset, with only around 9% of the original feature set, showed the best tradeoff between classification accuracy, model building time, and confusion matrix using the SVM classifier.In another experiment, we discarded frequency domain features from the RFE subset to measure their impact.There was a slight little decrease in performance.In general, the SVM classifier offered the best compromise in terms of stability, training time, and performance metrics.This comparison study is our starting point towards finding energy efficient techniques for real time HAR based on Smartphone sensors.Further ongoing research involves an accelerated implementation of the proposed model, which might take advantage of specific hardware computation facilities.Moreover, HAR over smartphones is under development for diabetic control and prediction of hypoglycaemia [27].

Figure 1 :
Figure 1: Accelerometer and Gyroscope a Smartphones [ ) Feature extraction: In this generated.These features are used during recognition phase.(4) Classification: In this step, the trained classi to recognize targeted activities.light), or to authenticate users and thus to provide an extra level of security and theft prevention.
Context-aware Systems and Applications 07 2017 -03 2018 | Volume 4 | Issue 13 | e3 and C. N. Auth 4 They only employ the internal mobile phone sensors, excluding any work that may combine external and Their systems are able to recognize some physical Their systems are able to achieve high overall recognition They should evaluate their systems regarding at least one of the mobile phone resources such as CPU usage/ the impact of some parameters ensor selection, sampling and online training.

Figure. 2 .
Figure. 2. Learning Curves of the SVM final models obtained: Before feature selection (Left side) and after feature selection (Right side).

Table 1 .
Number and class proportions used for training, validation and test.

Table 1 .
Number and class proportions of observations used for training, validation and test.

TABLE 2 :
Comparative results: Time/Performance

Table 4
contains information about ground truth versus predicted activities of the best SVM final model run on Test data.It can be seen that there is a perfect classification between "moving" and "non-moving" activities.EAI Endorsed Transactions on Context-aware Systems and Applications 07 2017 -03 2018 | Volume 4 | Issue 13 | e3

TABLE 4 :
Confusion Matrix of SVM on Test data

TABLE 5 :
Comparative results: Sequential vs Parallel runtimes (in seconds)

TABLE 4 :
Confusion Matrix of SVM on Test dataIlham Amezzane et al.

TABLE 3 :
Comparative results: F1-measure for each activity