Keywords

1 Introduction

The smartphones are equipped with powerful preinstalled sensors such as audio sensors, GPS sensors, image sensors, temperature sensors, light sensors, acceleration sensors, and direction sensors which are very much useful for a human [1]. These small mobile devices with fast computing powers to send and receive data create a whole new domain for data mining applications and research.

All the smartphones and music players, including the iPod and the iPhone [2], have triaxial accelerometers installed, which measure the acceleration in all the three spatial dimensions. These accelerometers are highly capable of detecting the location of the mobile device which is very useful and important information for activity recognition. Initially, the accelerometer was installed into these devices to enable the screen rotation and to support advanced game playing, but later the use extended to recognize a user’s activity and many other useful applications. The phone can gather the information about the activity which a human performs and can be used by various applications as per the requirement.

Activity recognition of a human’s body is not a new concept [3]; the concept is used to recognize almost 25 human body activities using the biaxial accelerometer situated in five different locations on the human body. The data used to predict user’s energy consumption [4], the movement of the user after the fall [5], and user’s activity level so that it can be used to promote user’s health and fitness [6]. Earlier studies involved smartphones that focused on a very small set of users [7] and for particular user [8] they had trained models rather than making a universal model which can be applied to any user.

This paper discussed the use of accelerometer sensor installed on a mobile phone, to recognize human activity. The data is taken from mobile phones based on the Android operating system because such phones are easy to handle, operate and are also becoming popular day by day covering the whole market.

The ensemble learning algorithms, namely, random forest, AdaBoost, and bagging are used on the data generated by more than 29 users while performing various physical activities such as jogging, sitting, standing, walking, and climbing stairs. The performance of used ensemble learners is evaluated using accuracy, f1 score, recall, and precision.

Rest of the paper is organized as follows: Sect. 2 discusses related work, and Sect. 3 defines the process, which addresses the activity recognition task and collection of data, preprocessing of data and transformation of data. Section 4 gives us a brief knowledge about the experiments, and the results and Sect. 5 summarizes the future work along with the conclusion.

2 Related Work

The availability of accelerometers in smartphones is increasing day by day, capturing of human activity is becoming very easy. Enormous work has already been reported on the activity recognition using several accelerometers positioned on different body parts to get the of the user’s activity record. In [3] data recorded to track the change in user’s daily activity, five accelerometers on 20 user’s are analyzed using C4.5 and Naive Bayes classifiers and made a model capable of recognizing 20 activities which a user can perform. The results demonstrated that the accelerometers which were placed at thigh proved to be more powerful in recognizing the user’s activity as compared to the others placed on different body parts.

In [9], two accelerometers are employed on three subjects for recording five human activities such as to sit, to walk, to run, to stand, and lie down. The results of this paper claim that the thigh accelerometer was unable to detect activities properly. Therefore, a need arises to place accelerometers at various body parts to resolve the issue. In [10], the data collected from ten different users wearing accelerometers on their lower body parts is tested and analyzed by applying different learning methods. In [11], activity data recorded by putting five accelerometers at different body locations of 21 subjects. The data is used for implementation of a real-time model for recognizing 30 activities added the dataset from the heart monitor along with the accelerometer data.

In [12], authors utilized five triaxial accelerometers attached to different body locations such as wrist, ankle, hip, thigh, and arm to identify 20 activities of 13 different users. The authors used several learning methods to recognize various postures such as standing, lying, sitting, and five movements which include walking, stair climbing, running, and cycling. In [13], five accelerometers in one experiment to generate the dataset are utilized, out of which two accelerometers were used for activity recognition. The experimentation was performed on 31 males, and a hierarchical classification model was designed to easily differentiate between the postures like lying and sitting at different specific angles and also to distinguish between the motions of walking and climbing stairs at different speeds.

In [14], authors identify the user activities such as standing, lying, walking, running, swimming, football, playing ball, croquet, and for using the toilet in the specific locations of subjects by 20 different types of sensors worn on wrist and chest. In [15], activities and locations such as standing, sitting, walking on the ground, walking downstairs, and walking upstairs using the biaxial accelerometer in the sensor module and also used angular velocity sensor kept in the pocket with the digital compass worn by the user at the waist are recognized. In [16], a model capable of recognizing same activities was built, and the dataset was taken from the triaxial accelerometer, phototransistors, temperature and barometric pressure sensors, two microphones, and GPS to distinguish between a stationary state, walking, jogging, driving a vehicle, and climbing up and down stairs. The other systems were not very practical as they involved multiple sensors situated all across the body but in [17] author used a system which involved various accelerometers or combination of accelerometers capable of identifying a wide range of activities. The system can work for only some small-scale applications (e.g., hospital setting). In [18], six activities are identified by employing a watch fitted on the belt, shirt’s pocket, backpack, and trouser pocket. The “e-Watch” dwelled with the biaxial accelerometer and the light sensor and used four classifiers along with five-fold cross-validation. In [4], seven different types of sensors are utilized for the recognition of activities such as walking, sitting, standing, ascending stairs, descending stairs, elevator moving up and down, and brushing one’s teeth.

3 Activity Recognition Task

This section describes the processes for activity recognition and also describes activity recognition. Section 3.1 tells about the raw accelerometer data that have been collected, Sect. 3.2 describes the processing and transformation of raw data into a set of examples and describes the activities that are to be identified or are going to be identified.

3.1 Collection of Data

To collect data for supervised learning, it is mandatory to have large Android-based smartphone users who carry their smartphone with them while they are performing an activity. The data generated by different users were evaluated who carried their smartphone while performing any task like they carried their smartphone in the front pants leg pocket while they were standing, sitting, walking, running, jogging, ascending stairs or descending stairs for a particular period.

The collected data is controlled by a phone-based application which is designed to fulfill the same. This application helps to keep the record of the user’s name, the start and stop time of the user and the activity completed by the user.

3.2 Materials and Methods

The raw time data should be transformed at first as Standard classification algorithm because it cannot be applied directly. Therefore, the data is first preprocessed and transformed into training examples [9]. In the next step, the training dataset is used to make a model to recognize the activities such as jogging sitting, standing, walking, and climbing up and down stairs. Using the information or the dataset, the model recognizes the activities to keep a record of them, which can be used to help the user evaluate whether his daily activity is performing, and the accelerometer also plots the graph of the activities a user performs [10].

4 Experiments and Results

In experimentation, the raw data is collected from WISDM. The WISDM is an Android-based data collection platform consists of software and hardware architecture used to channelize the human activity data through a sensor-based smartphone to the Internet-based server and then the data is transformed. The steps are taken to evaluate the results are shown in Fig. 1, the first step is to take the raw data set which includes the missing values in multi-class than the average of the values are calculated, and the missing values are replaced with the average value. In the next step, the three classifiers are applied at ten-fold cross-validation, and the accuracy of all the three classifiers is evaluated. Moreover, a model is designed which predicts the daily activities such as jogging, sitting, standing, walking, climbing stairs, downstairs with the help of a cell phone based accelerometer that allows a user to have a daily check on his routine whether he is performing his daily routine regularly or not.

Fig. 1
figure 1

Process flow of human activity recognition

The experiment uses a dataset and records the accuracy from three different classifiers, i.e., random forest, AdaBoost, and begging for ten k-folds, and then the average accuracy is calculated. The random forest classifier results in maximum accuracy, and AdaBoost classifier results in the least accuracy.

The results as shown in Table 1 details about the various parameter values obtained on applying different classifiers on the dataset. Random forest classifier outperforms the other two on every parametric value and results into the maximum accuracy of 90.20% which is very high compared to AdaBoost classifier which yields only 67.83% accuracy. The accuracy of bagging classifier is 89.27% which is very much close to that of random forest classifier with 90% accuracy, but the best average result is obtained from random forest classifier.

Table 1 Percentage of record predicted correctly

On the parameter of the F1 score, AdaBoost classifier gives least performance of 61.84% followed by the Bagging classifier with 89.36%. Random forest classifier results into 90.02% F1 score and 90.20% recall value followed by the Bagging with 89.27% and AdaBoost with 67.83% recall value. The precision value for Bagging classifier is 89.76% almost equal to that of Random forest classifier with 90.17%. The AdaBoost again results into least precision of 61.10%.

The performance of AdaBoost classifier on all parametric values is very close to the random forest. However, the best average results are obtained using the random forest. Therefore, out of the three classifiers used Random forest gives the best average result.

The graph in Fig. 2 distinguishes between the average accuracy, the f1 score, recall, and the precision obtained using the three classifiers, and it can be seen that the average best results are obtained from the random forest classifiers.

Fig. 2
figure 2

Performance of different Classifiers

A confusion matrix is a way of classifying true positives, true negatives, and false positive and false negatives when there are more than two classes. Confusion matrix makes it easy to compute the precision and recall of a class. It is used for computing the precision and recall and hence f1 score for multi-class problems. The columns in Table 2 represent the actual values, and rows represent the predicted values.

Table 2 Confusion matrix for random forest classifier

In Tables 2, 3, and 4 the confusion matrices are presented which are associated with the three classification algorithms. The confusion matrix indicates the prediction and prediction errors due to confusion between the activities.

Table 3 Confusion matrix for AdaBoost Classifier
Table 4 Confusion Matrix for Bagging Classifier

Table 2 gives the confusion matrix for random forest classifier in which jogging class is predicted correctly.

Table 3 gives us the confusion matrix about the AdaBoost classifier.

Table 4 gives us the confusion matrix about the bagging classifier.

The diagonal elements represent the number of points for which the predicted label is equal to the true label, while off-diagonal elements represent those that are mislabelled by the classifier. The higher the diagonal values of the confusion matrix, the better, indicating many correct predictions.

5 Conclusion

This paper compares the performance of ensemble learners on human activity dataset obtained from WISDM Android-based data collection platform. The WISDM keeps a record of the basic human activities such as jogging, sitting, standing, walking, climbing stairs, downstairs in the day to day life. The raw dataset is preprocessed and prepared for experimentation. The experiments are performed on human activity dataset and record the performance from three different classifiers, i.e., random forest, AdaBoost and begging for ten k-folds, and then the average accuracy is calculated. The classifiers performance is evaluated on the basis of accuracy, average accuracy, f1 score, recall, and precision are calculated along with the confusion matrix. The random forest classifier results in maximum accuracy, and AdaBoost classifier results in the least accuracy.

In future, experiments may be performed with added activities, for instance, bicycling and car driving. The experimental data may be retrieved from users for the possible improvement in the results. More refined and practical features can be developed when collecting the raw time-series data. The impact of placing the cell phone at user’s different body locations like as on a belt loop may be tested.