Abstract
Mobile phone based activity recognition uses data obtained from embedded sensors to infer user’s physical activities. The traditional approach for activity recognition employs machine learning algorithms to learn from collected labeled data and induce a model. To enhance the accuracy and hence to improve the overall efficiency of the system, the good classifiers can be combined together. Fusion can be done at the feature level and also at the decision level. In this work, we propose a new hybrid classification model Weighted SVM-KNN to perform automatic recognition of activities that combines a Weighted Support Vector Machines (WSVM) to learn a model with a Weighted K-Nearest Neighbors (WKNN), to classify and identify the ongoing activity. The sensory inputs to the classifier are reduced with the Linear Discriminant Analysis (LDA). We demonstrate how to train the hybrid approach in this setting, introduce an adaptive regularization parameter for WSVM approach, and illustrate how our method outperforms the state-of-the-art on a large benchmark datasets.
Introduction
The rapid growth in the technology has made a huge forward leap in the field of human activity recognition through the embedded sensors in a smartphone. Recently, smart phones, equipped with a rich set of sensors, are explored as an alternative platform for human activity recognition (HAR) [1, 2], which is conducted in many application areas [3–5] such as health monitoring, fall detection, context-aware mobile applications, human survey system, home automation, etc. The essential motivation behind the activity recognition is to identify the actions being performed by a person given a set of observations and the surrounding environment. The performance in these activities can also be crucial indicators for the remote health care, the old people, the disabled and the persons with special needs [6]. They can raise an alarm if there is a change in the pattern or an early alarm of healthcare emergency.
Smartphones are becoming an integral part of the daily human life. Therefore, they’re being preferred as the most usable appliances that could recognize the human activity due to its powerful in terms of mobility, user-friendly interface, network capability, strong CPU, memory, and battery. They contain a large number of hardware sensors such as accelerometer, magnetometer, gyroscope, temperature, humidity, light sensor and GPS receiver. The smartphone provides enormous amount of sensor data for one to understand the daily activity patterns of an individual [7]. The aim of this work is to use data collected from the smartphone sensors to recognize simple full body motor activities such as standing, sitting, walking upstairs, walking downstairs, and running.
The human sensor based activity recognition is a combination of sensor networks hand-in-hand with the data mining and Machine Learning (ML) techniques [8, 9]. The basic procedure for mobile activity recognition involves i) collection of labeled data, i.e., associated with a specific class or activity from users that perform sample activities to be recognized ii) classification model generation by using a collected data to train and test the classification algorithms iii) a model deployment stage where the learnt model is transferred to the mobile device for identifying new contiguous portions of sensor data streams that cover various activities of interest. Sensor data can be processed in real-time [10] or logged for offline analysis and evaluation [11]. The model generation is usually conducted offline, the model is built and tuned with the optimal parameters on a server system and later deployed to the phone to recognize the performed activity.
Building an accurately system to identify these activities is a challenging task. Each time researchers have comes up with better ways of using the algorithms and setting new benchmarks to improve the accuracy rate. We will cite some of them such as the Support Vector Machine (SVM) [12, 13], J48 [14], Logistic Regression [14], Multilayer Perceptron [14], Random Forest [15], Hidden Markov Model (HMM) [16], k-Nearest Neighbors (kNN) [17, 18], Bagging [18], Decision Tree [19], Artificial Neural Networks (ANN) [20], Boosting algorithm [21], Quadratic discriminant analysis [11], Convolutional neural networks (CNN), Long-short-term memory recurrent (LSTM) neural networks [22], and improved LSTM networks [23].
The purpose of this study carries out an effective approach of recognition of activities using smartphones by combining two classifiers namely, Weighted Support Vector Machines (WSVM) and Weighted K-Nearest Neighbors (WKNN). The power of merging the both methods would give complementary decisions and advance the accuracy level of the results. These kernel methods WSVM and WKNN have shown to be more effective than SVM and KNN in terms of representation due to the kernel trick used in [24] which enable them to operate in a high-dimensional, implicit feature space, where the data are linearly separable.
WSVM has been applied to investigate the effect of overweighting the minority class on SVM modeling between the performed activities and it deals with a “class-boundary-skew (CBS) problem” [25].
Furthermore, there is very limited number of publications in the literature that investigate the application of the WKNN [26] to infer the smartphone’s data. Weighted KNN is known to classify the data using the kernel function without any training step because it doesn’t use any model for fitting and are only based on memory to store the training instances. Another limitation affecting this method is that the nearest neighbors are imbalanced. This is due to the fact that dataset is not evenly distributed among various classes and therefore, the prediction using different weights for each nearest neighbor will be biased. Our study put forward a new WSVM training step on the balanced dataset for the WKNN classifier to handle these issues and improve the classification performances.
WKNN is not suitable for the large dimensional data. In such cases, dimension needs to reduce to improve the performance. In this work, we employed the Linear Discriminant Analysis (LDA) to reduce the feature vectors. LDA has shown to be more effective than PCA in terms of feature representation due to separability criteria between classes [27]. The process HAR system is shown in Fig. 1.

Human activity recognition system.
This remainder of the paper is organized as follows. Section 2 gives a comparison between WSVM and WKNN and describes the proposed method. Experimental results and discussion are given in Section 4. Conclusions are described in Section 5.
To enhance the quality of system accuracy, the classifiers use different criteria can be combined to yield an ideal one by harnessing the advantages of the individual classifiers. Recently, several authors have demonstrated that two classifiers can be combined in different ways; hybrid approaches have been successfully employed. For example, in [28], Ordóñez et al. showed that an ANN could be hybridized with HMMs to deal with an activity recognition problem. Lester et al. [29] developed a hybrid model that combined a modified version of AdaBoost with HMMs, and demonstrated it to be quite effective for recognizing various human activities using the wearable devices. A decision tree and Dynamic Hidden Markov Model (DHMM) are used in combination in [30]. Anguita et al. in [31] proposed the Multi-Class Support Vector Machine approach (MC-SVM), where the One-Vs-All (OVA) approach is used because it learned model uses less memory when compared with the One-Vs-One (OVO) method. They have also introduced in [12] the concept of a Multi-Class Hardware-Friendly SVM (MC-HF-SVM). This method was designed for binary classification problems by employing fixed point arithmetic (number of bits) in the feed-forward phase of the SVM classifier, with a purpose of allowing its use for battery-constrained devices. However, such classifiers aren’t able to effectively distinguish very similar activities, such as going upstairs and going downstairs. In [27], the authors developed new schemes named PCA/KNN-SVM and LDA/KNN-SVM and they have demonstrated that Linear discriminant analysis (LDA) can outperform the traditional Principal component analysis (PCA) for maximum discrimination between classes.
Abidine and et al. proposed numerous works [25, 33] within this context. A new approach for improving daily activity recognition combined with PCA, LDA and weighted-SVM has been addressed in [25] to overcome the problems of non-informative sequence features and class imbalance. In [32], they have proposed an efficient classification model for physical activity recognition based on k-means clustering and SVM-HMM hybrid classification approach that uses labels outputting of SVM in HMM. The same authors have improved in [33] the SVM-HMM classifier by inserting the weights for each class in the feature space to investigate the effect of overweighting the minority activity class on SVM modeling. HMM was chosen as a natural solution to address the activity complexity by — capturing and smoothing information. Chen and et al. in [34] have used the ensemble Extreme Learning Machine (ELM) with Gaussian random projection (GRP). GRP was used for the initialization of inputs weights of base ELMs. They obtained the recognition accuracies: 97.35% (Samsung) and 98.88% (Huwaei). In [35], the authors pre-trained SVMs are used to associate each feature vector with a corresponding micro-activity. Thereafter, they have used Hidden Markov Models (HMM) to model the transitions from one micro-activity to the other. In [36], the authors improved the classification performances of learning activities by introducing two new features: the time of activity and the significant location of object interactions with the sensors when the activity is performed. In our case, the use of this approach [36] can’t be applied. This is explained by the fact that all sensors are located in one place (the smartphone) and the postural activities are independent of time and space.
The proposed Weighted SVM-KNN system based LDA features
In Table 1, we show the advantages and disadvantages of the WSVM and WKNN methods. We use WSVM training to deal with the imbalanced training dataset. It allows a good representation and reduction of training set by using only the support vectors (SV). One significant drawback in WSVM, the training phase is slow. WKNN has the advantage of being able to classify the data without any training step because it doesn’t use any model for fitting and are only based on memory to store the feature vectors and class labels of the training instances.
Advantages and Disadvantages of WSVM and WKNN algorithms
Advantages and Disadvantages of WSVM and WKNN algorithms
Taking advantage of the relative strengths of these two classification paradigms, we have developed a hybrid Weighted SVM-KNN architecture using our training method to increase recognition performance. The efficiency of the proposed technique in term of high accuracy can be explained by the fact that WKNN is more robust using WSVM training approach.
The architecture of the proposed activity recognition system is depicted in detail on how the process has been performed. The steps of the framework are visualized in Fig. 2.

Block diagram of the proposed approach.
Sensor data for different activities has been collected and stored from multiple sensors using the smartphone. Data has also been divided into two partitions: Training-set and Test-set. Every activity has predefined training set will be compared with template by classification process. The proposed activity recognition system is a cascaded architecture of two kernel learning machines: the former one is the supervised WSVM, and the latter is the supervised WKNN. WSVM training is responsible for robust activity classification. First, we reduce the number of features by the LDA method using labeled dataset in order to obtain the best discrimination between the classes in the new LDA space. Second, we train the Weighted SVM on the LDA features to generate the support vectors (SV) that determine the boundary of activity data. The extracted SV that creates the new reduced balanced training data makes the classification process less complex. The ultimate classifier is performed by the WKNN algorithm using the k samples limited only within the support vectors when a new sample appears and classify the appeared sample according to most similar class. An estimated label vector is generated by the WKNN classifier and the system will output the recognized activity. The following subsections will discuss in detail each step of the proposed approach.
LDA seeks directions that are efficient for discrimination. For this discrimination analysis, we first define Between-Class Scatter matrix SB and Within-Class Scatter Sw by
Where, N is the number of activity class,
Osuna et al. [37] proposed an extension of the SVM training, the Weighted SVM algorithm to overcome the imbalance problem by introducing two different cost parameter C- and C+ in the primal Lagrangian in the objective function (eq. 4) for the minority (y i = –1) and majority classes (y i = +1) by maximizing the distance between support vectors and the decision boundary, as follow
Where φ is a nonlinear mapping and m+ (resp. m-) are the number of positive (resp. negative) instances in the initial database (m- + m+ = m). It’s a nonlinear extension with a property of maximizing the margin between two classes.
The dual optimization problem of WSVM with different constraints on α
i
can be solved similarly to [38]:
Where
Some authors [25, 38] have proposed adjusting different cost parameters to solve the imbalanced problem. They suggest using different penalty factors C+ and C- for positive and negative classes, reflecting their importance during training. Abidine and et al. [25] raised a Weighted SVM algorithm. The coefficients are typically chosen as:
Where C is the common cost parameter of the WSVM. w+ and w– are the weights for +1 and –1 class respectively. They put forward the corresponding solutions to deal with this problem in the SVM algorithm like this:
To extend the Weighted SVM to the multi-class scenario, the authors [25] proposed that the cost of misclassifying a point from the small class should be heavier than the cost for errors on the large class. They used different misclassification C
i
per class, use this conclusion can get a satisfactory result. By taking C - = C
i
and C+ = C, with m+ and mi be the number of samples of majority classes and number of samples in the ith class, the main ratio cost value C
i
for each activity can be obtained through:
Weighted KNN [26, 39] is a generalized extension based on simple K-Nearest Neighbors. One of the many issues that affect the performance of the KNN algorithm is the approach to combining the class labels. The simplest method is to take the majority vote, but this can generate a problem if the nearest neighbors vary widely in their distance. The improvement of WKNN algorithm is to give weight to the contributions of k nearest neighbors. The intuition behind Weighted KNN, is to give more weight to the points which are nearby and less weight to the points which are farther away.
Consequently, we start finding the k neighbors that have the smallest distances to the test data. In the second phase, we compute the weights of each k nearest neighbors based on WKNN algorithm and we obtain the distance-weighted sum of different categories. Finally, we set the classification results according to the distance values of various categories.
For this purpose, the distances used in WKNN, must be transformed into similarity measures, to be used as weights. Widely employed distance metrics are the Euclidean, Manhattan, Chebyshev, Minkowski, and Hamming. In this work, we have used the Minkowski distance of order q between x and the neighbor training x
i
. The equation of this distance metric is seen in (11) as follows:
When q = 1, q = 2 or q⟶∞, it corresponds to the Manhattan, Euclidean, and Chebyshev distances respectively. Instance x is assigned to the class for which the weights of the representatives among the k nearest neighbors sum to the greatest value. The function weights can be calculated using the kernels K(d). In our work, we choose the weights corresponding to the Triangular kernel as in equation (12) (where the weight is higher in the decision when the observations are close to the new observation).
The prediction the class for new test data (x) is done by using different weights (wi) for each nearest neighbor (NN) labeled (yNNi), with q as the total number of NN:
w i represents the weight value for the distance (d) from the observation.
We show in Fig. 3, the concept of Weighted KNN using the balanced dataset extracted from the support vectors (SV). The training data has significantly reduced by using the Weighted SVM to deal the imbalanced problem. The weights for each nearest neighbor are calculated on the labeled support vectors. According to the proposed idea, the proposed algorithm can be expressed by the pseudo-code, and it’s described in Table 2.

Weighted SVM-KNN classification. (a) WSVM training to extract SV (b) 5-nearest neighbors outcome is a white dot.
Summary of the proposed activity recognition approach
We used the publicly available as well as widely conducted datasets to examine the performance of our method rather than using private and elaborately preprocessed dataset. In this section we start by describing the dataset used in these experimental procedures, the learning algorithm implemented, the attribute extraction technique used in order to validate the construction of new features, and evaluation of the experimental results. Nevertheless, our study skips data collection and preprocessing steps on purpose because it’s meant to improve the HAR by providing better feature extraction and classification.
Datasets
Publicly available and annotated datasets for activity recognition [40–43] have been conducted to evaluate the performance of the proposed approach. We used four different nature datasets, using different physical activities such as (Locomotion: walking, running, walking upstairs, walking downstairs), (Postures: laying, sitting and standing) and (Transitions: sit-to-stand, stand-to-sit). They had varying formats, multiple sensors, and have been sampled at different frequencies. The data collection was investigated on a Samsung Galaxy SII phone with Android. The first used dataset is named Human Activity Recognition Dataset (HAR). The second dataset (HAPT) with Postural Transitions is quite similar to the previous one, but it includes postural transitions such as sit to stand. The third dataset is known as the Sensors Activity Recognition (SAR). This dataset contains the raw data collected from the smartphone carried on the waist. The last dataset is the dataset created by the WIreless Sensor Data Mining (WISDM) laboratory. Some of these datasets included tri-axis angular velocity from the gyroscope measurements, in addition to the tri-axis accelerometer measurements common to all. The different publicly datasets provide a large number of features, extracted by prepossessing the raw signals generated from different sensors. The raw signal data (at the generic time instant) are transformed into feature vectors where a fixed period analysis window is shifted along the signal sequence for frame extraction. A detailed description of each dataset is presented in Table 3.
Summary of datasets used in the evaluation of the proposed approach. Accelerometer (A), Gyroscope (G), Magnetometer (M)
Summary of datasets used in the evaluation of the proposed approach. Accelerometer (A), Gyroscope (G), Magnetometer (M)
For annotating activities, the video-recorded is used to label the data manually. The number of instances of each activity for each dataset is shown in Table 4. It enables us to visualize the disparity between activities in terms of number of observations (particularly for HAPT, e.g. ‘Walking’ and ‘Sit to Stand’) and (WISDM dataset, e.g. ‘Walking’ and ‘Standing’). The HAPT dataset has an imbalanced data distribution with transiting activities are under-represented in comparison to non-transiting activities as shown in the Table 4.
Annotated list and the number of instances per activity of physical activities
Four measures are used to test the proposed model’s ability using true positives (TP), false positives (FP), and false negatives (FN) are given as:
where N is the total number of instances. We adopt the Accuracy, Precision, Recall, F-score, and Error rate as our evaluation metrics for fair comparison with the state-of-the-arts, which F-score is calculated from the Precision and Recall scores. F-score and accuracy return values between [0, 1], where a value near to 1 shows the best performance, and near to 0 indicates the worst performance. In an extremely imbalanced dataset, the overall classification accuracy isn’t considered an appropriate performance measure, but this measure was used to evaluate the accuracy of each activity class.
Feature extraction stage: The power of WSVM and WKNN algorithms decreases with the existence of dependencies between features. In this study, an approach based on LDA algorithm is conducted to eliminate the redundancy information from the segmented raw data. See Fig. 4 for the feature process. The input dimensionality is reduced by selecting the number of extracted features that directly equal to N-1-dimensional feature space, where N is the number of physical activities. Classification stage: To evaluate the performance of the proposed data mining approach for automatic human activity recognition from smartphone data, we have used the extracted features by LDA and the Weighted SVM algorithm has been tested with a LibSVM implementation [45]. We note that each training dataset is normalized before the classification step within a range of [–1, 1]. Some of the classifier parameters are adjusted until we maximize the error rate of 10-cross validation technique. Results are computed by averaging the result obtained on each test fold. For WKNN method, we have used an order q of similarity distance in a range of [1, 1.5, 2] and the k parameter in the range [1, 3, 5, 7, 9, 11]. The hyper-parameter σ is estimated using a grid search method in the range [0.1–1]. Then locally, we optimized the cost parameter C
i
adapted for each activity class by using WSVM classifier with the common cost fixed parameter C = 1. The summary of the optimal values obtained with the proposed method are summarized in Table 5.

Eigenvalues after applying LDA on the features of training samples.
Optimal values of the LDA/Weighted SVM-KNN method
We conducted several experiments to compare the results of the proposed method for all datasets. The impact of main parameters on the recognition performance results of the proposed method is exhibited in Table 6. The results have been obtained using the 70% of the patterns has been used for training purposes and 30% as test data. As activity recognizer, we compared the proposed method with WSVM, WKNN, and hybrid methods LDA/SVM-KNN, LDA/WSVM-KNN, LDA/SVM-WKNN, Weighted SVM-KNN, and PCA/SVM-HMM [32], PCA/WSVM-HMM [33] are also reported.
Comparison of the proposed model against the state-of-the-art methods on various human activity benchmark datasets
While most conventional ML classifiers presented in the literature [12, 48] show good performances in terms of all measures across all the datasets, it’s clear from Table 6 that the proposed classifier LDA/Weighted SVM-KNN improved significantly the performance of smartphone-based HAR, and classify movement activity perfectly. The WSVM and WKNN classifiers have investigated well and hence when combined in Weighted SVM-KNN has shown a superior performance for all datasets. We explained this by the fact that WSVM is used as the training algorithm to select support vectors for the WKNN classifier. For instance, with HAR dataset, the classification error reached 1.9% in terms of F-score on the proposed method; it shows a decrease of the error comparatively to other methods. The Multiclass SVM
(MC-SVM), Multiclass Hardware Friendly SVM (MC-HF-SVM), Decision Trees, and Random Forest methods present more than 10% of F-score error.
One also notices that the results also show that WSVM significantly outperforms WKNN for recognizing imbalanced data activities for all datasets, particularly for HAPT and WSIDM. This can be explained by the fact that in these datasets, some activities contain a large number of samples whereas some of them have a very small number of samples. The consideration of postural transitions as individual imbalanced classes in HAPT dataset can increase the degree of difficulty of the recognition task, and therefore, can decrease the recognition rate of basic activities.
In terms of reducing the amount of the dataset, the feature selection identifies the most relevant features for the training process.We outline that the proposed method provides a better prediction of these activities when trained on the LDA features compared with Weighted SVM-KNN, particularly for HAR and HAPT datasets. The Error rate of the proposed method was improved from 4.8% with Weighted SVM-KNN to 1.3% (+3.5%) for HAR dataset. In similar, for HAPT, the Error rate of the proposed method was improved from 2.9% with Weighted SVM-KNN to 0.9% (+2%). The Error rate of the proposed method was improved from 2.1% with Weighted SVM-KNN to 0.9% (+1.2%) for SAR dataset. For WISDM dataset, the Error rate of the proposed method was improved from 6.5% with Weighted SVM-KNN to 5.9% (+0.6). We notice that in SAR and WISDM datasets, the Error rate is slightly improved in the proposed method compared with Weighted SVM-KNN. This is explained by the fact that the number of features (6) for the both datasets isn’t sufficient when using LDA algorithm. A high dimension of features increases the complexity and has a negative effect on final result. Hence, feature extraction using LDA in the proposed method becomes crucial for HAR and HAPT with 561 features.
We argue that LDA/WSVM-KNN is better than LDA/SVM-KNN. This is explained by the fact that WSVM is adapted for the imbalanced dataset and consequently the obtained support vectors regarded as the new training dataset for different activity classes are balanced. Unlike SVM which the number of support vectors is imbalanced.
Comparing all ML classifiers for each dataset in this table reveals that the F-score is higher for the proposed method with 0.98, 0.98, 0.99, and 0.94 for HAR, HAPT, SAR, and WISDM datasets, respectively.
Also, the F-score is lower for the proposed approach in the WISDM dataset using the accelerometer sensor while the activity was being performed. Therefore, using multiple sensors can boost activity recognition performance.
Besides the results in the Table 6, in order to get a detailed knowledge of the performances on each current activity, we calculate the confusion matrices for the proposed method in the Tables 7, 8 using the balanced HAR dataset, and imbalanced WISDM dataset, respectively with six different user’s physical activities. Referring to these tables, we see that in WISDM dataset, with the exception for the dynamic activities ‘W. Upstairs’ and ‘W. Downstairs’, the performance has high performance scores, whereas the score is higher and nearly consistent across all the activities in HAR dataset. This can be due to the highly imbalanced nature of WISDM where the percentage of data for ‘W. Upstairs’ and ‘W. Downstairs’ are about 12% and 10%, respectively, whereas for walking it’s about 38%.
Confusion matrix of proposed method on the HAR dataset
Confusion matrix of proposed method on the HAR dataset
Confusion matrix of proposed method on the WISDM dataset
The values are in percentages.
In HAR dataset, the activities as ‘Sitting’ and ‘Standing’ could be classified more accurately. We explained this by the fact that the nature of data distribution is almost uniform among all classes.
According to the Table 7, it can be observed that 99.1% of ‘W. Upstairs’ activity instances are correctly recognized, while 0.7% goes into ‘W. Downstairs’ and 0.2% are confused with ‘Walking’ activity. The similar classes such as ‘Walking’, ‘W. Upstairs’, and ‘W. Downstairs’ show similar trend of sharing errors among each other. The reason is the similar status of smartphone when the user does these dynamic activities.
We can notice that the static activities ‘Sitting’, ‘Standing’, and ‘Laying’ share errors among each other. 11% of ‘Standing’ activity instances misclassified as ‘Sitting’ activity and 8% of ‘Sitting’ activity instances are misclassified as ‘Standing’ activity. The main reason for this might be that both sitting and standing are still a static posture; hence the accelerometer readings are similar. However, the minority class ‘Laying’ in terms of number of instances (792) is rather better recognized using the proposed method.
In Table 8, in most cases, we get a high level of accuracy. For the two most common activities in terms of number of samples, ‘Walking’ and ‘Jogging’, we generally achieve accuracies above 97%. Both ‘Walking’ and ‘Jogging’ activities have significantly more samples than other activities, which could allow the recognition results biased toward these activities. ‘Jogging’ appears easier to identify than other activities, which seems to make sense, since jogging involves more extreme changes in acceleration. On the contrary, it appears much more difficult to identify the two stair climbing activities. (88.5% for ‘W. Upstairs’ and 90.9% for ‘W. Downstairs’), but as we shall see shortly, that is because those two similar activities are often confused with one another. When grouping these two activities as one (activity: stairs), the system was able to recognize it with 100% accuracy. For the static activities, we can note that there are very few instances of ‘Sitting’ (306) and ‘Standing’ (246), but we can still identify these activities quite well with the proposed method.
Although some of the user’s activities recorded reflect somewhat insufficient performance as in WISDM dataset for ‘W. Upstairs’ and ‘W. Downstairs’, we could state that our method is capable of producing a decent accuracy.
As mentioned above, the impact of gyroscope and accelerometer sensors were found to be sensitive to physical positions. Indeed, the gyroscope isn’t able to differentiate between similar activities like ‘Sitting’ and ‘Standing’. On the other side, the accelerometers perform badly with ‘W. Upstairs’ and ‘W. Downstairs’. For the WISDM dataset using an accelerometer sensor, we can note that the performances are decreasing comparatively to the other datasets. This is explained by the fact that only accelerometer sensor is used and therefore it’s insufficient to recognize all activities. However, the fusion sensors to collect the datasets would be useful for more accurate recognition performances.
In this work, we developed a novel activity recognizer model Weighted SVM-KNN using data from smartphone. This approach is based on the cascaded architecture of kernel machines: WSVM and WKNN. Extensive experimental evaluations using different publicly available databases of activity indicate a highly classification performance than the other hybrid ML classifiers. This is due to the learning dataset is more accurate using the support vectors (SV) extracted by the Weighted SVM.
The Weighted SVM-KNN classifier keeps the advantage of the WSVM is efficient in training phase for the WKNN algorithm. WSVM deals with a class-boundary-skew problem and it extracts the SV to reduce the training dataset. The purpose of the WKNN is to use the weight function (kernel) on the balanced dataset using the SV in order to optimize the output classification. Additionally, accuracy also tends to decrease when including few informative features to classify. All the classification methods conducted the reduced data by the LDA to select minimal number of discriminative and relevant features.
The purpose of this study is to build and test accurate offline model that can later be implemented on a mobile phone using only a limited number of SV from training data that can reduce the processing time to enable user-independent and operating system independent real-time recognition of the physical activities on the device.
More work is needed so that this method generalizes well to more users and more complex activities. Moreover, it would be interesting to use Transfer learning as alternative of machine learning where a model trained on one dataset is re-purposed on a second dataset. In our future work, we plan to carry out the experimental by using a nonlinear generalized LDA, Kernel Discriminant Analysis (KDA) for the extraction of more powerful features which, leads to the highest level of accuracy.
Figure 5 shows clusters of classes with a projection using the Gaussian kernel function, respectively in the LDA and KDA spaces. As it can be seen, each physical activity (class) is represented by a color in the 3D projection using the three features vectors for WISDM dataset. As we can see a better discrimination between the performed activity classes using KDA method. Therefore, we suggest a solution on the basis of combining KDA with the proposed approach.

Distribution of multi-activity patterns in (a) LDA and (b) KDA spaces for WISDM dataset.
Footnotes
Acknowledgments
The research presented in this paper is partly funded by Algeria National and Development Program PRFU (Projets de Recherche Formation-Universitaire) with Key Research project (A25N01UN160420180003), Communicating and Intelligent System Engineering Laboratory.
