**4. Discussion**

The findings of the study are rather interesting and suggest the effect of class imbalance on system performance and how different classifiers behave when training classes are highly imbalanced. The SVM proved itself to be the best performance among all classifiers, and the second-best classifier is the ADA (RF) classifier. The possible rationale behind the high performance of the SVM in all the experiments could be due to the fact that it uses an adaptive weighting approach at the training stage [10]. This adaptive weighting reduced the bias induced at the training stage due to the class imbalance and underrepresentation and penalized the majority of classes with weighted samples. Moreover, the ADA (RF) uses a more sophisticated random-forest-based method to train, which could have been able to handle class imbalance to some extent.

The analysis of the class imbalanced datasets also suggested that most of the machine learning classifiers investigated in this work are sensitive to class balance except SVM, which is less sensitive to class imbalance due to its inherited property of adaptive weighting

at the training stage to compensate for class imbalance up to some extent. The direction that can be opted in future works is to investigate the methods that can deal with class imbalance by performing a variety of data-handling techniques. These methods include synthetic minority over-sampling technique (SMOTE) [36], adaptive synthetic sampling technique (ADASYN) [37], under sampling and over sampling [38]. Therefore, such methods should be implemented on physical activity classification dataset collected in real life conditions with more natural settings. It is also worth mentioning that treating class imbalance can be harmful in some scenarios, as reported by Goorbergh et al. [39]. This is because treating class imbalance also depends on the type of classifier implemented, application domain and type of class imbalance dataset, as highlighted in [40].

Nevertheless, it is worth mentioning that the findings of the study are very encouraging and suggest that the proposed methods can obtain very high performance of above 96% in classifying the activities of daily living (sitting, standing, walking, lying, walking upstairs and waking downstairs). This provides the strength of the proposed physical activity classification system and its applicability in real life conditions. Promoting quality of life and tracking daily life activities are strongly correlated with obesity since active life patterns discourage sedentary behaviors and reduce the onset of several diseases (hypertension, diabetes, cardiovascular diseases), including obesity. Profiling such ADLs for a relatively longer duration (weeks, months, years, etc.) not only provides a detailed insight to individuals but also provides a detailed overview of the activity behaviors to the healthcare care practitioners, who can then tailor and customize the treatment to those suffering from obesity and other severe conditions.

The proposed physical activity classification system is applicable to a variety of different application scenarios in daily life conditions. Since the dataset used in this study utilizes the in-built motion sensors (accelerometer and gyroscope) of smartphones, there is no need for a separate sensing unit or equipment to acquire the activity patterns and retrieve sensory data. This sensory dataset acquired through smartphone can benefit from the on-device processing unit to compute the task requiring low computational power. Further processing can benefit from the scenario presented in Figure 1, where IoT assessment points can transmit the data to the cloud and storage units, where more sophisticated machine learning models can be implemented to classify the activity patterns. These activity patterns can then be profiled (e.g., 2% running, 10% walking, 20% sitting, 25% lying, 10% standing, 33% other sedentary or active activity over the day) and provide the distribution of activities performed by any individual over the course of a day, week, months and even years. This will not only benefit the general population to adopt a healthier lifestyle and well-being but also tracks the individuals with health issues such as obesity. The profiling of obese individuals with health disorders can then be linked with the healthcare services via IoT to track the activity patterns of individuals and to develop be-spoke exercise and therapy plans to effectively reduce obesity and to become healthy and active members of society. As the proposed system only used the smartphone for data gathering, its applicability in large-scale studies would not require resource-intensive equipment to track activity patterns. Moreover, such large-scale studies should be practiced in the future to develop big datasets in real life conditions and to train data-intensive deep learning classifiers for the efficient classification of daily life activities.

While the proposed research offers great to possibly deal with real life situations, there are certain limitations. One of such limitations is that it uses the dataset of only healthy individuals due to the unavailability of the sensory datasets collected from overweight individuals. Therefore, future works should focus on collecting and analyzing the dataset of only obese or overweight individuals to classify the activity patterns. It is important to mention that conducting longitudinal studies for overweight cohorts to record sensory data requires significant resources. This is one of the reasons why the publicly available dataset is used for the analysis and classification of physical activities in the present work. In future work, it would also be interesting to investigate how the deep-learning-based machine learning classifiers' (such as convolutional neural network (CNN) [41], long-short

term memory (LSTM) [42] or other deep learning classifiers') behaves on the imbalanced dataset. In future research, a broad range of deep learning techniques will be evaluated for imbalanced dataset to investigate their performance. Moreover, cloud-based computing paradigms can be explored in the future to enable scalability and remote accessibility. The future work should also focus on reducing the impact of class imbalance on the classifier's performance by implementing data-handling techniques such as over-sampling, under sampling, SMOTE, ADASYN, etc.

#### **5. Conclusions**

The study developed a novel physical activity classification system and investigated the impact of class imbalance on the performance of machine learning classifiers. The findings concluded that the proposed system is capable of classifying daily life activities such as sitting, standing, walking, lying, walking upstairs and walking downstairs with very high accuracy (above 96%). In addition, a thorough analysis of the impact of class imbalance on the performance of classifiers' is also investigated. A number of experiments are conducted with class imbalance. The findings also suggested that the weighted SVM with penalized approach offered the best classification performance, followed by the ADA(RF) in most of the experiments. Out of the six classifiers evaluated, the SVM, with an overall performance of above 80% in all the class imbalance experiments, depicts its ability to deal with real life situations with certain types of activities being underrepresented.

**Author Contributions:** Conceptualization, S.A.A., M.R., M.I. and M.A.; methodology, M.R, M.I. and M.A.; software, M.R. and M.A.; validation, M.R. and N.A.; formal analysis, M.R. and M.A.; investigation, M.I. and N.A.; resources, S.A.A.; data curation, M.R. and M.A.; writing—original draft preparation, M.R. and M.A.; writing—review and editing, S.A.A., M.R., M.I., N.A. and M.A.; visualization, M.R. and M.A.; supervision, S.A.A., N.A. and M.A.; project administration, S.A.A., A.M.A. and M.Y.A.; funding acquisition, S.A.A., A.M.A. and M.Y.A. All authors have read and agreed to the published version of the manuscript.

**Funding:** The authors would like to acknowledge the support of the Deputy for Research and Innovation-Ministry of Education, Kingdom of Saudi Arabia, for this research through a grant (NU/IFC/ENT/01/020) under the institutional Funding Committee at Najran University, Kingdom of Saudi Arabia.

**Acknowledgments:** The authors would like to acknowledge the support of the Deputy for Research and Innovation-Ministry of Education, Kingdom of Saudi Arabia, for this research through a grant (NU/IFC/ENT/01/020) under the institutional Funding Committee at Najran University, Kingdom of Saudi Arabia. The authors would like to acknowledge Saeed Saad Alahamri from Najran University for their valuable feedback on the draft to improve the flow and quality of the work.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **Appendix A**


**Table A1.** Performance by class of different classifiers using the train/test split in Experiment 1 (E1).


**Table A2.** Performance by class of different classifiers using the train/test split in Experiment 2 (E2).

**Table A3.** Performance by class of different classifiers using the train/test split in Experiment 3 (E3).


**Table A4.** Performance by class of different classifiers using the train/test split in Experiment 4 (E4).


**Table A5.** Performance by class of different classifiers using the train/test split in Experiment 5 (E5).



**Table A6.** Performance by class of different classifiers using the train/test split in Experiment 6 (E6).

**Table A7.** Performance by class of different classifiers using the train/test split in Experiment 7 (E7).

