###### Abstract
These limitations can affect the quality of collected data and lead to propagated errors in the analysis, potentially skewing the aggregated results [10]. The integration of machine learning in HAR has traditionally depended on heuristic feature extraction methods, which often limit classification accuracy and robustness [10]. In contrast, deep learning approaches, such as Long Short-Term Memory (LSTM) networks, utilize raw data to construct complex models with multiple layers, effectively tackling challenges in sequence learning [11]. LSTM's capability to address vanishing gradient issues and manage information flow through controllable gates significantly improves accuracy compared to traditional methods. [PERSON] et al. utilized LSTM models to predict activities from smart home datasets, demonstrating superior performance compared to probabilistic models such as Naive Bayes and Hidden Markov Models (HMM) [12]. [PERSON] and [PERSON] further advanced HAR in smart homes by applying accelerometer and gyroscope data with LSTM networks, achieving notable improvements in accuracy [13]. However, these studies largely focus on controlled environments with position-dependent datasets, which may not fully represent real-world scenarios where devices can be held in various positions. Most HAR studies using smartphones rely on controlled, position-dependent datasets, which fail to capture the complexities of real-life scenarios where devices may be held in varying positions. This discrepancy can result in decreased accuracy in activity recognition. To address these challenges, it is crucial to utilize unconstrained, position-independent datasets [12; 13]. Furthermore, many recent studies overlook the inclusion of sensors like gravity and linear accelerometers in smartphone-based HAR systems, despite their potential to enhance recognition accuracy. In recent studies, HAR using smartphone sensors has shown promise in transportation and real-world activity tracking. However, the inherent challenges of position variability, sensor data diversity, and model robustness remain unresolved. This study addresses these issues by focusing on realistic, position-independent HAR, combining machine learning and deep learning approaches for improved recognition across various user scenarios. The primary contributions of this study are as follows:  
* Realistic, Position-Independent Data Collection: Our research investigates HAR using smartphones placed in multiple realistic positions--chest and leg pockets--reflecting common device placements in real-world settings. This approach addresses limitations associated with fixed-position data collection and improves the generalizability of activity recognition models. * Enhanced Sensor Suite Utilization: In addition to accelerometers and gyroscopes, this study incorporates linear accelerometers and gravity sensors, providing a more comprehensive dataset that better captures dynamic activity patterns and improves classification accuracy. Comparative Analysis of Machine Learning and Deep Learning Models: This study evaluates both classical machine learning models (Decision Tree, K-Nearest Neighbors, Random Forest, Support Vector Classifier, and XGBoost) and advanced deep learning models (GRU, LSTM, TCN, and Transformer) for HAR. * Performance Optimization through Overlapping Data Segmentation: The study compares non-overlapping and 50% overlapping data segmentation methods, identifying the advantages of overlapping windows for improving model accuracy by capturing transitional information. * Application to Intelligent Transportation Systems (ITS): By demonstrating high-accuracy passenger behavior recognition, our research provides insights into practical ITS applications, contributing to enhanced traffic management, safety monitoring, and real-time emergency response systems. These contributions establish a foundation for robust, real-world HAR implementations in intelligent transportation contexts, advancing the state of the art in activity recognition research.