EMBEDLIX RESEARCH · MACHINE LEARNING LABORATORY SERIES

Human Activity Recognition Using Machine Learning

From smartphone sensor rows to recurrent movement sequences: controlled performance and the limits of generalization

Chathuranga Bandara PolkotuwaResearch portfolio · Labs 1–4Six chapters · Source-backed study

Abstract

Smartphone motion sensing provides a practical setting for studying how machine learning moves from raw measurements to activity decisions. This laboratory series compares K-nearest neighbours, Decision Trees, a feedforward neural network and a compact gated recurrent unit (GRU) network using six acceleration and gyroscope channels from 48 recordings and 95,837 aligned rows. Recording identities are retained during splitting, and scaling is fitted to training data only. [1–5]

The selected KNN achieved 91.12% same-person test accuracy; the feedforward network achieved 90.09%. A one-layer, 32-unit GRU processing 100-sample windows achieved 99.19% on the controlled test. However, 99% window overlap creates correlated observations. Continuous recording agreement was approximately 63.62%, while another-person evaluation fell to 37.94% for KNN and approximately 25.78% for GRU under different external protocols. The latter also used approximate labels and a mismatched fourth activity.

The findings support temporal modelling under the controlled collection conditions, but do not establish person-independent reliability. Improved participant diversity, consistent phone setup, exact activity annotations and a stronger final evaluation protocol are more important next steps than simply increasing model complexity.

Keywords: human activity recognition; inertial sensing; smartphone; grouped validation; KNN; neural networks; GRU; distribution shift.

48

Separate recordings

6

Sensor channels

4

Activity classes

Controlled test accuracy · 0–100%

KNN91.12%
FFN90.09%
GRU99.19%
Source-derived comparison [1–5]. KNN and FFN use rows; GRU uses correlated windows. Eight test recordings, not thousands of independent trials. Decision Tree test accuracy was not reported.

The central finding

99.19% controlled accuracy is not a real-world reliability claim. A new participant and natural continuous movement exposed substantial failure, including confident incorrect predictions. Both the achievement and its limits are part of the research result.

A real walking sequence from the notebook. Original Lab 4 window: 100 standardized rows and six channels. Values after standardization are dimensionless.

Study contributions

  1. 01A transparent progression from timestamp-aligned smartphone signals to classical, feedforward and recurrent classifiers.
  2. 02Recording-aware evaluation and training-only scaling, with repeated-test-access and overlap limitations explicitly acknowledged.
  3. 03Class-level and external-condition analysis rather than a headline accuracy alone.
  4. 04Original code and figures accompanied by implementation explanations, source references and an actionable follow-up protocol.

The research chapters

Primary research materials

Original logbook and seminar, plus notebook copies with personal workstation paths redacted. Raw CSVs and fitted models were not supplied; saved outputs are not an independent replication.