Compact and Explainable Human Activity Recognition with Boruta-RFE Feature Selection and SHAP Interpretation
Abstract
Human activity recognition (HAR) based on wearable sensors commonly involves high-dimensional sensor-derived features, which may contain substantial redundancy and complicate model interpretation. In this study, we developed and evaluated a compact and explainable machine-learning framework using the UCI Human Activity Recognition Using Smartphones dataset, comprising 10,299 observations from 30 participants and 561 time- and frequency-domain sensor features. The official subject-wise partition was retained, with 7352 observations from 21 participants used for model development and 2947 observations from nine separate participants reserved for independent testing. Feature selection was restricted to the training partition. Boruta retained 458 predictors, after which random-forest recursive feature elimination with participant-grouped five-fold cross-validation identified a compact 100-feature subset using the one-standard-error criterion. Support vector machine, random forest, and XGBoost classifiers were compared across the full 561-feature set, the 458-feature Boruta subset, and the 100-feature compact subset. XGBoost yielded the highest independent-test accuracy point estimate among the evaluated classifiers across all three feature representations. The full-feature XGBoost model achieved 95.55% accuracy, 95.50% macro-F1, 97.26% balanced accuracy, and a macro-AUC of 99.84% on the independent test set. The Boruta-based XGBoost model achieved 95.28% accuracy, whereas the compact 100-feature model achieved 93.89% accuracy and 93.84% macro-F1. Thus, reducing the feature space from 561 to 100 predictors decreased dimensionality by 82.17%, with an absolute test-accuracy reduction of 1.66 percentage points relative to the full-feature XGBoost model. SHAP analysis further revealed class-specific predictive patterns, with static postures relying more strongly on gravity-, orientation-, and gyroscope-related descriptors, whereas locomotor activities were characterized primarily by body-acceleration energy, amplitude, correlation, entropy, and jerk-related features. These findings demonstrate a measurable trade-off between feature compactness and subject-independent predictive performance while providing interpretable insight into the sensor-derived information used by the model.