Problem
Classify six activities — walking, walking upstairs, walking downstairs, sitting, standing and lying — from smartphone accelerometer data, for machine learning coursework at IIT Gandhinagar. The constraint that shaped the work was interpretability: the point was a model I could read end to end, not a leaderboard score.
Data
UCI-HAR. The public dataset: 30 participants wearing a smartphone at the waist, raw inertial signals sampled at 50 Hz. I used the first 10 seconds of each recording — 500 samples — and split the pooled data into stratified train, test and validation sets.
My own recordings. I also collected accelerometer data for the same six activities on a OnePlus phone with the Physics Toolbox Suite app at 200 Hz, resampled to 50 Hz with interpolation and trimmed to a matching 10-second window, so a model trained on UCI-HAR could be tested against data I recorded myself.
Approach
Filtering. A Butterworth bandpass filter to keep the frequency band where the activity actually lives, and a median filter for transient spikes.
Features. Three views of the same signal: the raw three-axis channels; total acceleration magnitude (ax² + ay² + az²); and an automatic feature set extracted with TSFEL.
Model. A Decision Tree with the entropy criterion, and an accuracy-versus-depth sweep to choose the depth rather than guess it. Scored with accuracy, precision, recall and F1, plus per-class confusion matrices.
Visualisation. PCA down to two components — on total acceleration and on the TSFEL features — to see how separable the six activities are before trusting any classifier.
What it showed
- Locomotion (walking and its variants) separates from the stationary classes in PCA space, and the confusion matrices show where the remaining errors sit.
- The depth sweep is worth doing: accuracy climbs and then flattens, and the tree at the chosen depth can be read to see which features it keys on.
- The trained model was then run against my own recordings — the honest test, since my phone, its placement and its sampling rate all differed from the dataset's.
Stack
Python · NumPy · SciPy (Butterworth and median filters) · scikit-learn (Decision Trees, PCA, metrics) · TSFEL · Pandas · Matplotlib
What I'd do next
- A random forest or gradient-boosted ensemble, to measure what the interpretability is costing in accuracy.
- More self-collected data, from more people and more phone placements — one person's recordings make for a thin test set.