Context Shortcuts in Free-Living Gait Models

Wearable sensors let clinicians measure how patients with Parkinson's disease actually walk at home, not just how they walk down a quiet hospital corridor. Home recordings are dominated by walking that the patient's surroundings shape. Most walks at home are short: a few steps to the kettle, a turn, a stop. How long those walks are, and how often they turn, depends on the layout of the home, the recruiting clinic, and the patient group. Our central claim is that a classifier trained on free-living data can learn to recognize this walking context rather than the disease. The problem goes beyond faulty measurement. Context differs systematically between populations and between recording sites. So a model that relies on it will look accurate on internal splits, fail on external cohorts, and fail unevenly across subgroups.

We propose a gait classifier that cannot use this shortcut, together with a test that shows whether other classifiers do. The classifier makes its decision through a small set of named gait quantities, such as cadence, stride-time variability, and spectral power. It computes these separately within fixed bins of walking context and combines them with bin weights that are the same for every patient and every site. A patient who happens to walk in longer bouts therefore does not receive a different score for that reason alone. The explanation the model offers is simply which gait quantity, in which context, moved the prediction. We treat that explanation as a falsifiable claim: shifts in those named quantities between sites should predict where external performance drops.

Why this, and not the obvious combination

The obvious idea at this intersection is to take tools already proven elsewhere and move them to wearable gait data. The candidates are a lesion-style concept bottleneck, as in FairerOPTH, which conditions ocular diagnosis on detected lesions to narrow age and sex gaps; adversarial demographic removal, as in FairPDA, where gender debiasing of voice models also improved out-of-cohort generalization; and shortcut testing, as in ShorT, which varies how strongly a network encodes age or race and checks whether its unfairness tracks that encoding. Those papers motivate the work, but each assumes the shortcut is a demographic attribute.

The evidence from free-living gait points to a different nuisance variable. The Mobilise-D validation and its multicentric technical study benchmarked signal-processing algorithms on 108 participants in six cohorts during 2.5 hours of daily life. They found three things:

  • Short bouts and speeds below 0.5 m/s consistently degraded cadence and stride-length estimates.
  • The best algorithm differed by cohort.
  • The proximal femoral fracture cohort was worst on every metric.

The Parkinson@Home study found that cadence measured at home was "highly variable and not a reliable indicator of medication state across the group."

Taken together, these results say that in this setting, population differences and site differences both travel through walking context. Adversarially stripping context from a representation would be wrong, because the ShorT "encoding is not usage" warning applies with extra force here. Walking speed is itself a symptom of Parkinson's slowness of movement. Our proposal separates the environment-shaped part of context (bout duration, turning density), which we neutralize by design, from gait quantities that carry pathology, which the model keeps and exposes.

Core Claim

We make three testable claims. First, deep classifiers trained on free-living accelerometry for Parkinson's detection and freezing-of-gait detection absorb walking-context shortcuts. Second, a context-standardized concept model transfers across cohorts with a smaller external drop and smaller subgroup gaps than those classifiers, at a modest internal cost. Third, the model's concept-level explanation predicts which subjects fail externally, which a post-hoc saliency map on a black box does not.

The decision rule is as follows. Let $c$ index context bins (bout duration crossed with turning density). Let $\bar m_{i,c}$ be the mean vector of named gait quantities over subject $i$'s bouts that fall in bin $c$. Let $w_c$ be a fixed reference weight per bin, estimated once from pooled training data and never refit per subject or site. Let $g$ be a sparse additive function. The prediction for subject $i$ is

$$p(y_i = 1) = \sigma\Big(\sum_c w_c \, g(\bar m_{i,c})\Big).$$

Here $\sigma$ is the logistic function. When a subject has no bouts in a bin, $\bar m_{i,c}$ is shrunk toward that bin's training mean. Because $w_c$ does not depend on how often the subject walks in each context, shifting a site's mix of bout lengths cannot move the score unless gait within each bin actually changes.

For $g$ we borrow the "reluctant" additive design of RAITR. That method fits a sparse linear model first and admits nonlinear spline terms only when they earn their place under a heavier penalty. RAITR was built for tabular treatment rules; we reuse its penalty structure on per-bin gait quantities.

Research Program

Automated bout pipeline. The shared front end is a fully automated bout pipeline, not manual video selection. We use gait sequence detection and step detection from the open gaitmap ecosystem, choosing the algorithms Mobilise-D found most robust. The pipeline produces bouts with duration, turn fraction, and a small concept set: cadence, step-time variability, total 0.5–10 Hz spectral power (the most medication-responsive feature in Parkinson@Home), and harmonic regularity. Stride length is included but flagged as unreliable, given Mobilise-D's absolute errors of up to 0.21 m for the best algorithm. Walking speed is reported as a concept, never as context. As a sensitivity analysis we also treat speed as context, because whether speed belongs on the pathology side or the context side is exactly the open question.

Shortcut test for context. We adapt ShorT to context. A shared 1D convolutional encoder, a network that learns local patterns in the raw signal, gets two heads: one predicts the diagnosis, and an auxiliary head predicts bout duration and turn fraction. We scale the auxiliary gradient from positive through zero to reversed, which produces a family of models that encode context to different degrees. We then measure whether external error and subgroup gaps track that encoding. As in ShorT, a correlation between context encoding and external failure is evidence of usage, not merely of encoding.

Explanations as predictions. For each external subject we compute how far each concept-by-bin input sits from the training distribution. We test whether this concept-level shift predicts the subject's error better than a matched shift score computed from gradient saliency on the black-box encoder.

Data and External Splits

All data come from resources described in the file. The main cross-cohort pair is lower-back accelerometry. Mobilise-D provides 20 Parkinson's patients and 20 healthy older adults, plus four other cohorts used for subgroup analysis. Parkinson@Home provides 18 usable patients and 24 controls, with a lower-back sensor among its six. We train on one cohort and test on the other in both directions, and run leave-one-site-out within Mobilise-D if site labels are released. The Parkinson@Home on/off medication task gives a within-patient check.

The freezing-of-gait pair crosses ecology and site. REMPARK home recordings come from a single waist IMU in 21 patients. Daphnet is lab-directed walking with a lower-back accelerometer in 10 patients. Both are resampled to a common rate.

The lab-only PhysioNet force-plate data used by the parallel 1D-ConvNet and the convolutional transformer do not use inertial sensors. We use them only to illustrate how internal cross-validation inflates accuracy: 98.7% detection and 87.89% staging on pooled 10-fold splits.

These cohorts are small. All inference is at the subject level, with subject-bootstrap confidence intervals. Access to Parkinson@Home and REMPARK must be confirmed before the study starts; if either is unavailable, its pair is dropped and not substituted.

Baselines

Naive references. The do-nothing reference is the majority-class predictor. The more telling naive reference is a context-only classifier: logistic regression on each subject's distribution of bout durations and turn fractions, with no gait quantities at all. If this classifier approaches the deep models on internal splits, the shortcut is present. The proposed model should sit near chance when its concepts are replaced by context alone.

Strongest existing method for Parkinson's detection and medication state. This is the Parkinson@Home pipeline: logistic LASSO on Welch spectral features with leave-one-subject-out validation. It reports a mean AUC of 0.82 for medication state from the most-affected ankle and 0.79 from the wrist. No reported result was found on Lacuna for its lower-back sensor, or for any cross-cohort evaluation. We rerun it on our automated bouts with the same subject splits and the same nested tuning budget. It is the strongest competitor because it is already sparse, interpretable, and ecologically recorded. Beating it means a smaller external AUC drop with overlapping internal AUC, not a higher internal AUC.

Deep black boxes. These are a 1D-ConvNet in the style of El Maachi et al. adapted to inertial input, and, for freezing of gait, the REMPARK 1D-ConvNet with spectral window stacking. The latter reports a geometric mean of 90.6% and sensitivity of 91.9% on its internal 13/4/4 split. The Daphnet deep network reports an equal error rate of 12.5% under leave-one-subject-out. We reimplement both with the same tuning budget per model, then report internal and cross-dataset numbers side by side. Beating them means lower cross-dataset equal error rate or higher geometric mean, not higher internal scores.

Adversarial debiasing. This is FairPDA-style gradient reversal against sex and against context, on the same encoder. It is the strongest fairness competitor.

Ablations. Two ablations isolate the key ingredient. The first keeps the concept model but drops context standardization, pooling bouts with the subject's own proportions. The second keeps context-stratified aggregation with fixed weights but puts the black-box encoder in place of the named concepts.

Why not just…?

Why not just use standard gait features with LASSO, as Parkinson@Home did? This is the most serious threat, and our model is close kin to it. The difference is only the fixed-weight context stratification. If plain LASSO on pooled bouts matches our external drop, the stratification adds nothing, and we will report that. The first ablation is exactly this comparison. The controlled experiment below is designed to separate them: pooled features inherit whatever bout-length mix a site has, and stratified ones do not. The deep-versus-handcrafted gaps reported on PhysioNet (SVM 75.60% vs. 87.89%) come from internal splits on lab data, so they do not settle the matter in either direction.

Why not just add bout length and turning as input covariates? A covariate is something the model can use. When context correlates with diagnosis in training, the model will use it, and that is the shortcut. Covariate adjustment and standardization agree only when the context distribution matches across sites. The reversed-correlation experiment below is where they should diverge.

Why not just remove context or demographics adversarially, as FairPDA does? In voice data this worked as a regularizer. But ShorT shows that removing an encoded attribute helps only when that attribute is actually used as a shortcut. In gait, speed and bout structure partly are the disease. The shortcut-test sweep will show whether reversal improves external error, or whether it degrades detection in slow cohorts such as proximal femoral fracture patients. We treat this as an open empirical question, not a foregone loss.

Why not just recalibrate locally at each site? The local-validation argument says models are inherently local. Local recalibration of any baseline on a small labeled fraction of the target cohort is therefore a real alternative. We run it for every model at 10% and 25% target labels. If recalibration closes the gap for the black box as well as our design does without labels, the practical case narrows to settings where target labels are unavailable. We would say so.

Decisive Experiments

Controlled shortcut injection. Within Mobilise-D we subsample bouts so that Parkinson's patients contribute mostly long bouts and controls mostly short ones in training, then reverse this at test time. The design uses no new data. Any model that uses context should flip toward error, while the standardized concept model should be unchanged within noise. How far each baseline degrades as the injected correlation grows is the cleanest single measurement of context usage.

Real cross-cohort transfer. The Mobilise-D↔Parkinson@Home and REMPARK↔Daphnet pairs are evaluated with external AUC, balanced accuracy, and Matthews correlation. Subgroup gaps are reported by sex, age tertile, and slow versus normal walkers. The primary endpoint is the internal-minus-external drop, with subject-bootstrap intervals.

Explanation-predicts-failure test. We report rank correlation between each external subject's concept-level shift and their error, compared against the saliency-based shift from the black box.

The proposal is falsified if either of two things happens: plain pooled LASSO matches the standardized model on the reversed-correlation test, or concept shift predicts error no better than saliency. In either case, the claim that context is the operative shortcut in free-living gait would not hold.