## 4 Discussion  
The core aim of this experiment was to emphasize the exaggerated accuracy derived from k-fold cross-validation in HAR models. From Section 3, LOSO achieved a lower accuracy compared to k-fold. This is due to subject-specific data leakage in the former. K-fold cross-validation randomly splits the data into subsets, with the possibility of subject-specific information presenting in multiple folds simultaneously, leading to unintentional  
Figure 6: Testing accuracy comparison of raw sensor models and feature-trained models validated with k-fold and LOSO on random forest and logistic regression classifiers.  
data leakage. This results in the model appearing more robust during k-fold validation, but less so when faced with entirely new subjects in LOSO validation.  
Therefore, LOSO accuracy, which rigorously tests the model's ability to generalize to unseen subjects, provides a more accurate evaluation in the presence of subject-specific data and more realistic results in real-life deployment.  
Considering that overlapping windows and a small window size of 2 s were used in this experiment, overlap between adjacent windows in subject data creates dependency, also causing over-estimation in k-fold generalization. As activities span multiple overlapping windows, predictions for one window are influenced by information in the neighboring windows, leading to dependencies between the training and testing fold and overestimation of the model's generalization performance [29; 30; 31; 32; 33; 34; 35; 36; 37]. With overlapping dependence occurring within the same subject, LOSO is not impacted by this, as it focuses on one subject at a time during testing.  
For a personalized activity recognition system that is tailored to a specific user, k-fold would be better suited. Ref. [38] consider it a hybrid of the subject-independent models, which refers to the LOSO approach, and subject-dependent models, which are models built specifically with the data of the final user. While the subject-independent approach expectedly achieves the highest accuracy of all personalized models, it is not realistic in real-life use because the models cannot be built for every user, except in special cases. This makes k-fold a preferred alternative.  
In considering performance improvements on LOSO to develop a model that generalizes better, training with a similar population to user characteristics should be considered. Evaluating the subject-level performance of LOSO in Table 6, the highest testing accuracy of 87% was achieved when the model was trained on subjects 1-7 and tested on subject 8, while the lowest accuracy was achieved when the model was trained on the other subjects and tested on subject 5. These results are caused by the semblance and dissimilarity between the validation subject and those included in the training set, respectively. This means that subject 8 has a high similarity with the trained subjects, while subject 5 has a low similarity. Figure 7 captures this trend. Training models on data similar to those of its final user increases its adaptability and performance. Previous studies [39; 40; 41; 42; 43; 44; 45; 46; 47; 48; 49; 50] highlight this, where fitness level contributed to the characterization of sporting activities like running, and demographics like gender and body physique informed moderate activities like walking.  
Figure 7: Training vs. testing accuracy in each subject in LOSO.  
The secondary focus of this study was on the importance of hand-crafted features in training HAR systems, which was achieved by training on raw sensors and comparing the results with the former. While this was established in the earlier section, segmentation and windowing also positively impacted the performance of the HC models. By segmenting into smaller windows, relevant patterns like the sequence of movements of activity over time were captured by the models within smaller time intervals. Their computational efficiency was also improved, as the models were processed in smaller chunks.