Activity recognition
Still, walk, run, cycle or other, every 30 seconds, from the strap's 1 Hz accelerometer and heart rate, fused with the strap's own step counter. Feeds “Looks like you went for a walk, save it?”.
Built from algorithms/activity/README.md
These are the project's working notes, published as written. “You” and “your strap” mean the author and the author's own WHOOP strap; only summary numbers from it appear here, never the recordings.
Finds what you're doing from the strap's 1 Hz accelerometer and heart rate, so Pulse can say "Looks like you went for a 32 min walk, save it?" and fill in workouts you didn't start by hand. Same pipeline as the AF and sleep models: open dataset → features → small boosted trees → held-out evaluation by person → generated Swift + vectors.
uv run --with numpy --with scikit-learn python train.py # downloads PAMAP2 to data/ if missing (~690 MB zip)
cd ../../ios/WhoopKit && swift test # ActivityModelTests checks the Swift port
Data
PAMAP2 (Reiss & Stricker 2012, UCI, CC BY 4.0): 9 people, IMU on the dominant wrist at 100 Hz plus a chest-strap
heart rate, 18 labelled activities from a protocol and optional free sessions. The wrist accelerometer is reduced
to 1-second means, which is what the strap's history record holds (see ../sleep/README.md: we checked that the
strap's values behave like 1 s means, not single samples). Epochs of 30 s, labelled when ≥ 90 % of the epoch is one
activity: 805 epochs.
| Class | PAMAP2 activities |
|---|---|
| still | lying, sitting, standing, watching TV, computer work, car driving |
| walk | walking, Nordic walking, stairs up/down |
| run | running |
| cycle | cycling |
| other | vacuuming, ironing, folding laundry, house cleaning, soccer, rope jumping |
Features (activity_features.py, 15)
Epoch movement (act, mean second-to-second change; ang, change in the gravity direction; sd and mean
deviation of |a|) with 1.5 and 3.5 min centred means and a 2.5 min max, and heart rate as a fraction of heart-rate
reserve, (HR − resting) / (max − resting), with means, spread and trend. HR reserve is what separates cycling
(quiet wrist, working heart) from sitting.
Results (leave one person out)
| Accuracy | 92.7 %, kappa 0.896 |
| Moving vs still | 98.3 % |
| Recall | still 97 %, walk 94 %, run 65 %, cycle 77 %, other 93 % |
| Precision | still 99 %, walk 88 %, run 65 %, cycle 92 %, other 91 % |
Running is the weak class: only 26 epochs in PAMAP2, and at 1 Hz the wrist can't see stride frequency. In the app
the strap's own step counter decides walk vs run (ActivityModel.classify): sustained cadence ≥ 140 steps/min is
running, 30–140 walking (the counter never moves for fidgets, so 30+ catches stop-and-go walking), and no steps
rules both out (then cycle / other / still by the model). Cadence is the 1.5 min centred mean. Bouts
(ActivityModel.bouts) need 10 minutes, with interruptions up to 2 minutes bridged. Pulse only suggests walks,
runs and rides; "other" bouts (housework-like movement) aren't offered as workouts.
Your strap, 29 Nov 2026 (validate_strap.py)
Two walks were recorded with Start workout that day; the detector, run afterwards on the strap's records alone, found both:
| Recorded | Detected |
|---|---|
| Walk 05:51–06:33, 3,059 steps | Walk 05:52–06:32, 3,050 steps |
| Walk 17:20–17:46, 2,163 steps | Walk 17:20–17:45, 2,153 steps |
It also found two 10-minute "other" bouts (04:26 and 19:26) with no steps, which is why "other" isn't suggested.
Limits and next data
- 9 people, all in a lab-like protocol; free-living data will be messier. PPG-DaLiA (15 people, wrist accel + PPG, daily-life activities including cycling, driving, stairs, table soccer) is the next dataset to add.
- Swimming, strength training and yoga aren't in PAMAP2; those stay manual (Start workout).
Model files
Generated by this algorithm's train.py and copied from the repository at build time. More on the Our data page.
-
model.json 207 KBalgorithms/activity/model.json
5-class boosted trees, feature list, classes and leave-one-person-out results (incl. confusion matrix)
sha256 eb20e76c6835ed96…
-
vectors.json 27 KBalgorithms/activity/vectors.json
Test vectors: synthetic, deterministic 10 min of acceleration + HR → features → class probabilities
sha256 a82504e542e3ec83…
References
- Reiss A, Stricker D. Introducing a new benchmarked dataset for activity monitoring. ISWC 2012
- PAMAP2 Physical Activity Monitoring (UCI Machine Learning Repository, CC BY 4.0)
- Reiss A et al. Deep PPG: large-scale heart rate estimation with convolutional neural networks. Sensors 19(14):3079 (2019) (PPG-DaLiA)