"Ask me to tell running from cycling, and my answer depends entirely on which of your limbs you strapped me to."
A Well-Located AI Agent
The Big Picture
Before a single feature is extracted or a single network is trained, two hardware decisions have already capped the accuracy you can ever reach: where on the body the sensor sits and which sensor it is. A wrist-worn accelerometer and a hip-worn one, sampling the same person walking, produce signals so different that a model trained on one will collapse on the other. Placement is not a nuisance parameter to be normalized away later; it is a design axis with the same weight as model architecture. This section gives you a physical, decision-driven way to reason about it, so that by the time you reach segmentation and personalization in the sections ahead, your raw stream is already the right raw stream. This chapter advances the infer verb, but only because someone first chose well how to measure.
We assume you are comfortable with the accelerometer, gyroscope, and magnetometer signal models from Chapter 23, and with sampling rate, aliasing, and time synchronization from Chapter 3. Where we touch data splits and cross-subject evaluation, the leakage-safe machinery from Chapter 5 is the reference.
Placement is a signal-to-activity match, not a comfort preference
What changes with placement is the mechanical bandpass between an activity and the sensor. Each body location acts as a filter: it emphasizes some motions and attenuates others. The wrist swings with large amplitude during walking but also during a thousand incidental gestures (drinking, typing, scratching), so it is rich but noisy. The hip or lower back sits near the body's center of mass, so it captures the whole-body gait cycle cleanly with little confounding limb chatter. The ankle sees ground contact and cadence directly. The chest tracks torso posture and respiration.
Why this matters is separability. A classifier can only distinguish activities whose signatures the sensor location actually preserves. Walking versus running is a cadence-and-intensity question that the hip resolves almost trivially; the wrist can too, but with more variance because the arm is not rigidly coupled to the trunk. Distinguishing hand-specific activities (eating, brushing teeth, writing) is the wrist's home turf and nearly impossible from the hip. There is no universally best location; there is only a best location for a target activity set.
How to decide, concretely: write down your label set from Section 26.1, and for each label ask which body segment carries its dominant kinematic signature. If your labels cluster on locomotion and posture, favor a trunk location (hip, lower back, chest). If they cluster on manipulation and gestures, favor the wrist. If they span both, you are looking at a multi-sensor system or an accepted accuracy ceiling on the classes that fall outside your chosen site.
Key Insight
Placement sets an accuracy ceiling that no downstream model can lift. If the ankle never observes the arm motion that separates two labels, the most powerful transformer in Chapter 15 cannot recover information the placement discarded. Spend your first modeling hour on a placement-versus-label separability table, not on architecture search.
Choosing the sensor: the accelerometer is table stakes, everything else earns its power
What you can add beyond a triaxial accelerometer: a gyroscope (angular rate, superb for rotation-heavy activities and orientation-robust features, see Chapter 24), a magnetometer (heading, but easily disturbed indoors), a barometer (floor changes, stairs-versus-elevator, sitting-to-standing altitude shifts), and physiological channels like PPG for heart-rate context (Chapter 30).
Why not always add all of them: every extra modality costs current, and current is the true currency of a wearable. A gyroscope typically draws several times the accelerometer's current and can dominate the energy budget of an always-on classifier. A barometer costs almost nothing in power and adds a dimension (vertical displacement) that accelerometers estimate poorly, which is why it is the highest value-per-milliamp add for stair and elevation activities.
How to prioritize: start with the accelerometer alone and measure. Add the gyroscope only if rotation-dominated classes (turning, certain exercises, falls with tumble) are being confused and the duty cycle permits it. Add the barometer for any altitude-linked label. Reserve the magnetometer for heading-dependent context. This ordering reflects a hard-won rule: most activity recognition value is in the accelerometer, and each additional sensor should be justified by a specific confusion it resolves, not by availability.
Sampling rate, dynamic range, and orientation: the settings that quietly decide everything
What to set: sampling rate, full-scale range, and how you handle device orientation. Human activity energy lives almost entirely below 15 Hz; walking harmonics rarely exceed 10 to 12 Hz. By the Nyquist argument from Chapter 3, a 50 Hz sample rate comfortably captures ambulation, and 100 Hz is generous headroom for sharp events like impacts and falls. Dynamic range must cover the peaks: everyday gait stays within roughly \(\pm 4g\), but foot-strike and impact events during running or a fall can exceed \(\pm 8g\), so a range set too tight silently clips exactly the samples that matter most.
Why orientation is the trap: a sensor in a trouser pocket lands in an arbitrary and changing orientation every time the garment is worn. A model that learned axis-specific patterns from a fixed lab mounting will fail in the wild. The standard defense is to compute orientation-invariant features, the simplest being the signal magnitude vector \(a = \sqrt{a_x^2 + a_y^2 + a_z^2}\), which discards the coordinate frame entirely while preserving intensity and cadence.
import numpy as np
def separability(sig_a, sig_b, fs=50):
"""Fisher-style separability of two activity windows using an
orientation-invariant magnitude feature. Higher = easier to tell apart."""
def mag_features(x): # x: (N, 3) triaxial accel in g
m = np.linalg.norm(x, axis=1) # orientation-invariant magnitude
return np.array([m.mean(), m.std(), np.ptp(m)]) # intensity, variability, span
fa, fb = mag_features(sig_a), mag_features(sig_b)
pooled = np.sqrt(0.5 * (sig_a.std(0).mean()**2 + sig_b.std(0).mean()**2)) + 1e-9
return np.abs(fa - fb).mean() / pooled
rng = np.random.default_rng(0)
t = np.arange(0, 4, 1/50)
walk = np.c_[0.3*np.sin(2*np.pi*1.9*t), 0.2*np.sin(2*np.pi*1.9*t), 1+0.1*rng.standard_normal(t.size)]
run = np.c_[0.9*np.sin(2*np.pi*3.1*t), 0.7*np.sin(2*np.pi*3.1*t), 1+0.4*rng.standard_normal(t.size)]
print(f"walk-vs-run separability: {separability(walk, run):.2f}")
How to use the probe above: run it pairwise over your confusable label pairs for each candidate placement. Low scores flag pairs that the placement physically cannot separate, telling you to either move the sensor, add a modality, or merge the labels. This is a five-minute experiment that routinely saves days of fruitless model tuning.
Practical Example: a fall-detection pendant that failed on the wrist
A clinical eldercare startup prototyped fall detection on a wrist band because users already wore watches. In the lab, accuracy looked strong. In a care home, false alarms flooded in: a hand slapping a table or dropping onto an armrest produced the same high-\(g\) spike as a fall, because the wrist reports arm impacts, not body impacts. Relocating the sensor to a waist-clip pendant, near the center of mass, changed the physics. A true fall now produced a characteristic free-fall-then-impact-then-stillness signature on the trunk that hand gestures could not mimic, and the barometer confirmed the vertical drop. Same algorithm, same sampling rate; only the placement and one cheap added modality moved. The lesson generalized across their product line: match the sensor site to the event's true mechanical origin.
Library Shortcut
You do not need to hand-roll placement-annotated data loading. Public HAR datasets such as PAMAP2 and MHEALTH ship multi-location recordings (wrist, chest, ankle) with per-location channels labeled. Loading one placement, windowing it, and extracting a magnitude feature bank is roughly 40 lines of manual NumPy and pandas parsing. With tsfresh for feature extraction plus a dataset helper, it collapses to about 6 lines, and the library handles windowing, hundreds of engineered features, and the per-channel bookkeeping so you can A/B two placements in one script. Just keep the split cross-subject to avoid the leakage traps of Chapter 5.
Placement mismatch is a distribution shift, and it is a leakage trap
What goes wrong most often in deployed HAR is not a weak model but a placement mismatch between training and use: the model learned from hip data and the user wears the device on the wrist, or the training set had the phone in a fixed pocket and users hold it in hand. Why this is dangerous is that it hides during naive evaluation. If your test split contains windows from the same recording session and same placement as training, accuracy looks excellent, then craters in the field. This is the cross-placement analogue of subject leakage.
How to guard against it: evaluate leave-one-placement-out, not just leave-one-subject-out. Report accuracy per placement, and if you claim placement robustness, prove it by training on a subset of locations and testing on a held-out one. For edge deployment where the device may drift or be re-donned, orientation-invariant features and, where power allows, a small on-device adaptation step (previewed in Chapter 59) buy real robustness. Personalization and continual adaptation, in Sections 26.4 and 26.5, then take over from there.
Exercise
Take any multi-location HAR dataset with wrist, chest, and ankle channels. (1) For the label pairs walk/run, sit/stand, and stairs-up/stairs-down, compute the separability probe above at each of the three placements. (2) Build a table of which placement wins each pair. (3) Now train one classifier on wrist and test on ankle, and report the accuracy drop. (4) Add a barometer-like altitude channel and re-check the stairs pair. Write one paragraph recommending a single placement plus modality set for a product that must detect all six activities, and state which activity you are sacrificing accuracy on and why.
Self-Check
- Why can a trunk-mounted sensor separate walking from running more reliably than a wrist-mounted one, and what class of activities does the wrist win instead?
- You have a 200 microamp always-on power budget and are confusing "turning" with "walking straight." Which single sensor do you add, and which do you deliberately not add, and why?
- Your leave-one-subject-out accuracy is 96% but the field deployment sits at 71%. Name the most likely placement-related cause and the evaluation protocol that would have caught it before shipping.
What's Next
In Section 26.3, we move from choosing where to sense to deciding when one activity ends and the next begins. Even a perfectly placed sensor delivers a continuous stream with no bracketing; segmentation and transition states are what turn that stream into labeled episodes, and, as we will see, the placement choices made here shape exactly how sharp or smeared those transitions look.