# Efficient Human Activity Recognition Using Machine Learning and Wearable Sensor Data
## 4 Results and Discussion  
For the collected data, we first extract features from both the temporal and spatial domains to ensure that they fully capture the characteristics of the activity state. After extracting the feature data, we process it to compute the similarity and generate the similarity matrix. This is done using integer programming and majority decision models based on multiple machine learning. The accuracy of the classification results is shown in Tables 3 and 4. \begin{table}
\begin{tabular}{c c} \hline \hline
**Activity** & **Accuracy (\%)** \\ \hline walking forward & 90 \\ walking left & 95 \\ walking right & 95 \\ walking upstairs & 80 \\ walking downstairs, & 85 \\ running forward & 85 \\ jumping & 88 \\ sitting down & 95 \\ standing & 95 \\ lying down & 100 \\ taking the elevator upwards & 95 \\ taking the elevator downwards & 100 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: The majority decision model classification identification accuracy. \begin{table}
\begin{tabular}{c c} \hline \hline
**Activity** & **Accuracy (\%)** \\ \hline walking forward & 60 \\ walking left & 80 \\ walking right & 80 \\ walking upstairs & 70 \\ walking downstairs, & 40 \\ running forward & 80 \\ jumping & 90 \\ sitting down & 100 \\ standing & 100 \\ lying down & 80 \\ taking the elevator downwards & 90 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Integer programming model classification identification accuracy. We then tested the majority decision model based on multiple machine learning, and the confusion matrix is shown in Figure 1. For a more robust evaluation of the model, \(k\)-fold cross-validation (CV) was adopted (where \(k=5\) in this study). This approach further partitions the training set into \(k\) subsets. In each iteration, \(k\)-1 subsets are employed for model training, while the remaining 1 subset is used as the validation set. The data were split according to subjects, ensuring that the training and test folds consist of records from different subjects [29]. This process is repeated \(k\) times, giving each subset an opportunity to serve as the validation set once. By doing so, the data can be utilized more comprehensively. This subject-based cross-validation method can effectively prevent data leakage, guarantee the reliability of model evaluation, and endow the research findings with enhanced interpretability. Based on the classification accuracy of the two models for 12 types of behavioral activities, it can be known that the integer programming classification model has an average accuracy of 79.17%, while the majority voting classification model has an average accuracy of 91.92%. As is evident from Figure 1, on the basis of five sets of data for each exercise, the majority decision model exhibits relatively poor performance in recognizing activities such as ascending stairs, descending stairs, running forward, and jumping, when compared to other human activities. In the 5-fold cross-validation, the average accuracy rate is calculated to be 91.67%. It is also evident that, compared to integer programming, the majority decision model demonstrates superior ability in accurately recognizing activities. When comparing the results of the two models, the integer programming classification model struggles to distinguish between walking forward and walking downstairs, whereas the majority voting model performs better. However, we observed that the majority voting model still experiences some misclassification errors, particularly between walking upstairs and walking downstairs. Additionally, there is some confusion between running forward and jumping, which may be attributed to the similarity in acceleration between these motion states, causing their features to be too similar and resulting in misclassification. Overall, we can conclude that the majority decision model, based on multiple machine learning techniques, offers better robustness and accuracy than the integer programming classification model.