Improving gym exercise recognition with Light Gradient Boosting
Tests whether LightGBM recognises gym exercises from wearable sensor data better than Random Forest, at three sensor positions, with each subject held out in turn. LightGBM scored higher at all three and trained in under half the time.
Bachelor's thesis, Aalto University, 2026. Grade 5 of 5.
Results
macro F1 after tuning
| Position | LightGBM | Random Forest | Difference |
|---|---|---|---|
| Wrist | 0.889 | 0.868 | +0.021 |
| Leg | 0.793 | 0.773 | +0.020 |
| 0.528 | 0.519 | +0.009 |
Bars run from 0 to 1.
Method
Dataset
10 subjects, five men and five women, performed 11 gym exercises wearing sensors on the wrist, on the leg and in the pocket. Each sensor recorded 3-axis acceleration, 3-axis gyroscope and body capacitance at 20 Hz.
Features
4-second sliding windows with 2 seconds of overlap. Mean, minimum, maximum, standard deviation and MAD per channel give 35 features and 117,437 labelled windows.
Tuning
Grid search over 5 hyperparameters per model on the first two folds, wrist position. Best LightGBM settings:
num_leaves=60, lr=0.05, n_estimators=400.Evaluation
Leave-one-group-out cross-validation: each fold holds out one subject entirely, so every score is on a person the model never saw. Reported as macro F1.
The code
live from GitHub
Stack
Python, LightGBM, scikit-learn, pandas, NumPy, Matplotlib, Jupyter