3.1. Dataset
We use the publicly released WearGait-PD dataset [
15], comprising older adults with and without Parkinson’s disease instrumented with thirteen Xsens DOT IMUs (Movella Inc., Henderson, NV, USA) sampled at 100 Hz by the original data providers. After cache reconstruction and subject-level filtering, our experiments use 181 subjects (100 PD, 81 controls). The cohort’s demographic and clinical characteristics are summarized in
Figure 1 and
Table 2: the two groups are broadly comparable in body weight, differ moderately in gender composition (PD 65/35 vs. control 35/46 M/F), and differ in age: PD subjects are on average younger than controls (67.0 ± 8.3 years vs. 74.7 ± 8.6 years) and span a wide range of disease durations (7.5 ± 5.9 years) and severities (modified Hoehn and Yahr stages 1.0–4.0, with the majority at stage 2.0). Although the dataset providers describe the controls as age-matched at the full-release level, in the 181-subject subset analyzed here, the control group is, on average, approximately seven years older than the PD group; age is therefore a potential confound. We address it directly rather than only in the Limitations:
Section 4.4 reports a 1:1 age-matched analysis, age-stratified subgroups, and within-class probability-age correlations, together with a per-gender evaluation for the gender imbalance, and finds that discrimination is preserved under matching and across both genders.
Each subject performs up to five short clinical tasks: self-paced walking, the TUG test, hurried-pace walking, tandem gait, and quiet-standing balance. The 13 inertial measurement units are distributed over the head, trunk and both limbs; their anatomical placement and the per-sensor coordinate frame are shown in
Figure 2. Each sensor produces nine channels per sample (3-axis free acceleration, 3-axis raw acceleration, and 3-axis angular velocity). Task coverage in our cohort is summarized in
Table 3.
The WearGait-PD dataset was selected because it is a public, openly documented dataset, collected with institutional review board approval by its original providers, that pairs a standardized thirteen-IMU body-worn array with a multi-task protocol covering 98–100% of subjects per task properties well matched to the multi-task, whole-body representation studied here. Its adequacy is nonetheless bounded: 181 subjects are modest for deep learning, and the release contains a single visit per subject from a single recording site, with a binary PD-versus-control labeling and no disease-severity or differential-diagnosis information.
3.2. Preprocessing and Windowing
Raw IMU signals were segmented per task into fixed-length 2 s windows (200 samples at the native 100 Hz rate), each carrying per-sensor validity flags; the 2 s duration matches the spectrogram baseline. The full nine-channel representation was retained at the cache stage. No band-pass filtering, drift correction, or magnetometer-based orientation correction was applied: the encoder consumes gravity-removed free acceleration, which addresses the dominant low-frequency component, and its rotation-invariant pretraining makes further orientation correction unnecessary. Missing tasks are handled through the binary validity mask, which zero-fills absent tokens and excludes them from both the standardizer and the downstream attention, so no imputation is performed. Feature standardization is applied per fold: a per-feature standardizer fitted only on non-zero training tokens is applied to held-out subjects, with the mask reapplied so absent tokens remain exactly zero (
Section 3.4, Equations (2) and (3)). Resampling from 100 Hz to the encoder’s native 20 Hz (Fourier-based, with wrap-padding to 200 frames) was performed only when feeding the frozen backbone, leaving the cached full-rate signals available to the baselines. Subject identifiers were preserved end-to-end so that 5-fold cross-validation operated at the subject level rather than the window level [
35], eliminating leakage from the same-subject windows appearing in both the training and test sets.
3.3. Token Construction
The proposed model represents each subject by five task-level tokens, one per clinical task, each a 512-dimensional motion embedding from the frozen encoder, along with a length-5 binary validity mask that flags the tasks performed. The representation has no sensor axis: the encoder fuses the thirteen body-worn sensors into a single whole-body embedding at its joint-pooling stage, so a task-by-sensor representation could only be formed by replicating the task embedding across sensors, adding no sensor-specific signal. The model, therefore, aggregates the five task tokens directly.
Task-level motion embedding (512 d). For each task, all valid windows are passed through a frozen pretrained skeletal-motion graph encoder following the ST-GCN architecture [
18,
21]. The pretrained backbone is the publicly released UniMTS encoder [
21], obtained from the authors’ repository (
https://github.com/xiyuanzh/UniMTS, accessed on 20 February 2026); the released pretrained checkpoint was used without modification. The encoder operates on a fixed 22-joint skeletal graph; this topology is intrinsic to the pretrained backbone, since the graph adjacency and learned edge-importance weights are defined over exactly 22 joints, and is not a free design choice. Because WearGait-PD provides 13 IMUs rather than a full optical skeleton, we adopt the sparse-skeleton input scheme for which this encoder class is designed: each sensor is mapped to its anatomically closest joint (
Table 4), the corresponding joint channels are populated, and the remaining 9 joints are zero-filled in every window. This is the encoder’s intended usage rather than a limitation of our pipeline: the same backbone is pretrained and evaluated on configurations that populate as few as one joint; the spatial graph convolution propagates information from populated joints across the skeleton via the adjacency; and the edge-importance weighting attenuates inactive edges. Windows are resampled from 100 Hz to 20 Hz and wrap-padded to 200 samples. The encoder yields one 512-dimensional embedding per window, then mean-pools across the task’s valid windows to produce one task-level embedding per subject. The encoder’s internal structure is detailed in
Figure 3.
Channel-to-coordinate mapping and its caveat. The encoder ingests a three-coordinate tensor per joint, X ∈ ℝ (P × J × 3), the same three-channel-per-joint input format that the encoder consumes during pretraining. The UniMTS encoder [
21] is pretrained not on raw 3D joint positions but on physics-simulated inertial signals derived from motion-capture skeletons, using rotation-invariant augmentation that makes it agnostic to device-mounting orientation; the measured IMU streams are therefore well matched to its pretraining input. Each unit reports tri-axial free acceleration, tri-axial raw acceleration, and tri-axial angular velocity in its own local sensor frame, and in this work, the three per-joint input channels are populated with the 3-axis free-acceleration channels of the mapped sensor, since free acceleration (gravity removed) most directly reflects the joint’s motion; the remaining six channels per sensor (tri-axial raw acceleration and tri-axial angular velocity) are not consumed by the present model, which uses only the three free-acceleration channels per sensor as the encoder input.
This use of the encoder is a substitution rather than a calibrated kinematic model: it serves as a fixed, transferable feature extractor, and two mismatches relative to its pretraining persist, the local sensor frame of each IMU, only partly absorbed by the encoder’s rotation-invariant pretraining, and the use of only the three free-acceleration channels rather than the full inertial set. The substantial drop in performance when the pretrained weights are removed indicates that the resulting embedding is nonetheless discriminative. The magnitude of this residual frame-and-channel mismatch, and whether populating all available inertial channels (raw acceleration and angular velocity) would improve transfer, cannot be resolved from the present experiments and is identified as future work.
Mean-pooling the encoder output at the task level, rather than per sensor, follows from the encoder’s design: it operates on the full skeleton in each forward pass and pools globally over time and joints, so its output is already a whole-body representation conditioned on the task, with the thirteen sensors fused inside the encoder rather than downstream of it. Consequently, a representation indexed jointly by task and sensor could only be obtained by replicating this whole-body embedding across the sensors present for each task; the resulting sensor axis would record which body locations contributed to a recording, through the validity mask and a sensor positional embedding, but would carry no sensor-specific signal. The model, therefore, aggregates the five task-level tokens directly, and absent tasks are represented by zero tokens with zeroed validity-mask entries so that downstream attention ignores them. A genuinely sensor-specific representation would require per-sensor encoding rather than a replicated whole-body embedding; this is identified as future work (
Section 5.4) and is also the route through which a physical sensor-reduction study could be pursued.
3.4. Mathematical Formulation
The proposed model maps each subject’s set of five task-level tokens to a binary prediction through the components defined below; we also specify the three component ablations and the classical-baseline pipeline evaluated against it. Throughout, i indexes subjects, clinical tasks, and the valid windows of task t for subject i. The encoder input dimension is and the Transformer working dimension is d = 128.
Task-level motion embedding: Each IMU window is remapped onto the
J-joint skeleton by the sensor-to-joint assignment of
Section 3.3, producing a sparse skeleton-frame tensor
after resampling to 20 Hz and zero-pad-with-wrap to
P = 200 frames. The frozen encoder
maps each window to a 512-dimensional vector, and the task-level embedding is the mean over the
valid windows of task
t:
If subject
i has no valid window for task
t,
is set to the zero vector and the corresponding validity-mask entries are zero, so downstream attention ignores them.
Subject representation: Because the frozen encoder returns one whole-body embedding per task (Equation (1)), the complete representation of subject
i is the ordered set of its five task-level embeddings {z
i,1, …, z
i,T}, for which we write u
i(
t) ≡ z
i,t in the equations of
Section 3.4, together with a length-
T binary validity mask m
i whose entry m
i(
t) is 1 when subject
i performed task
t and 0 otherwise. The model, therefore, aggregates the five task tokens directly; it does not form a task-by-sensor grid, since the encoder has already fused the thirteen sensors into each whole-body embedding at its joint-pooling stage (
Section 3.3), so a replicated sensor axis would carry no sensor-specific signal.
Per-fold standardization: For cross-validation fold
k, let
be its training subjects. A per-feature standardizer is fitted only on the non-zero training tokens:
and applied to every token of every subject in fold:
where
is element-wise division. The multiplicative mask in Equation (3) keeps absent task tokens exactly zero after standardization, so attention is not biased by the standardizer’s offset on those positions.
Token projection and positional encoding: Each standardized token is projected to the Transformer working dimension
by a LayerNorm–Linear–GELU–Dropout block, with learned task-indexed positional embeddings added:
where
,
, and
is the encoder output dimensions, and the learned task-embedding matrix
supplies the row
.
Validity-mask token weighting: Tokens corresponding to tasks the subject did not perform are down-weighted to zero by a normalized validity weight before they enter the Transformer:
This weighting carries no learnable parameter and makes the marginal contribution of the present tokens independent of how many tasks are missing for that subject.
Cross-token Transformer encoder: Let
be the row-stacked matrix of weighted projected tokens, and let
be a learnable subject-shared CLS token. The encoder input is
with a binary key-padding mask
defined by
and
for
, so absent tokens cannot be attended to. The encoder consists of
pre-norm Transformer blocks with
heads each. Block
updates the representation as
where MHSA is multi-head self-attention with key-padding mask
, and MLP is the standard two-layer feed-forward block with GELU activation, expansion factor four, and dropout 0.3. The CLS embedding is the final row 0 of the last block:
Classification head and loss: A two-layer MLP head produces logits over the two classes:
with
and
. The model is trained with class-weighted softmax cross-entropy:
where N is the number of training subjects, Nb the batch size, and the class weights
are computed once per training fold from the training labels.
Cross-token attention extraction: The model also admits an attention-based interpretability readout: the CLS row of the post-softmax attention matrix is averaged across the
heads and the
encoder layers, and renormalized over the present tasks. For layer
l:
so that
and
for every subject i. Equations (12) and (13) define the attention map as a byproduct available from the trained model; a population-level map can be obtained by averaging
over the held-out subjects of each fold and then across folds. A clinical interpretation of this map, relating attention weight to specific clinical tasks and to known PD motor signatures, is deferred to future work, since a credible interpretation requires the repeated-seed runs described there to establish that the attention pattern is stable across resampling rather than an artifact of a single split.
3.5. Proposed Model Architecture
The proposed model passes each of the five task tokens through a LayerNorm–Linear–GELU–Dropout projection that maps 512 dimensions to 128, then adds a learned task-position embedding of size 128 (5 entries). Tokens are scaled by a normalized validity weight so that absent tasks contribute zero to subsequent attention, and present tasks are weighted uniformly. A learnable CLS token is prepended, and the resulting six tokens are passed through a three-layer Transformer encoder [
24,
44] with four attention heads, an inner feed-forward dimension of 512, GELU activation, pre-LayerNorm, and dropout 0.3. These settings follow standard small-Transformer practice and keep the trainable head small (~0.68 M parameters) for the 181-subject cohort, thereby limiting overfitting. Because the positional-embedding and attention ablations move balanced accuracy by amounts within the fold-to-fold noise (
Section 4), no hyperparameter search was performed; at this cohort size, such a search would risk overfitting the evaluation, so the head is presented as parameter-efficient rather than tuned. A padding mask derived from the validity mask is supplied, preventing zero tokens from contaminating attention.
Figure 4.
Overview of the proposed pipeline. Raw IMU windows from 13 body-worn sensors across five clinical tasks are processed by mapping each sensor to its closest skeletal joint and passing the windows through the frozen pretrained ST-GCN encoder (
Figure 3) to yield a task-level motion embedding. The five resulting task-level embeddings, together with a binary validity mask flagging which tasks the subject performed, are aggregated by a three-layer Transformer with a learnable CLS token into a subject-level embedding for binary classification.
Figure 4.
Overview of the proposed pipeline. Raw IMU windows from 13 body-worn sensors across five clinical tasks are processed by mapping each sensor to its closest skeletal joint and passing the windows through the frozen pretrained ST-GCN encoder (
Figure 3) to yield a task-level motion embedding. The five resulting task-level embeddings, together with a binary validity mask flagging which tasks the subject performed, are aggregated by a three-layer Transformer with a learnable CLS token into a subject-level embedding for binary classification.
The CLS token aggregates information from the five task tokens and is fed to a small MLP head (LayerNorm → Linear 128 → 64 → GELU → Dropout → Linear 64 → 2) producing logits over {control, PD}. The model contains approximately 0.68 million trainable parameters above the frozen 5.18-million-parameter encoder. The complete end-to-end pipeline, from raw IMU windows through the five task-level tokens to the final classification head, is summarized in
Figure 4. We describe the model as parameter-efficient only in the sense that few parameters are updated during training; the effective model that must be stored and run at inference comprises the full 5.86 million parameters of encoder plus aggregator, and the train–test gap reported shows that the trainable head is nonetheless large enough to overfit a cohort of this size.
3.9. Evaluation Protocol
All experiments use stratified 5-fold cross-validation at the subject level, repeated over five independent random seeds, yielding 25 held-out estimates per model (15 for the two end-to-end models, which are more costly and are run over three seeds). For each fold, training tokens are standardized with a StandardScaler fitted only on training subjects; the scaler is applied to the held-out fold, and the validity mask is reapplied so that absent tokens remain exactly zero. Model selection is nested and leakage-free: within each training fold, a stratified inner validation partition (15% of the training subjects, disjoint from the test fold) is held out, early stopping is performed on the inner-validation balanced accuracy, and the test fold is used only once, for final reporting. This removes the coupling between model selection and the reported estimate. We report four metrics: balanced accuracy (primary, robust to the mild class imbalance) [
48], accuracy, macro-F1, and ROC-AUC, all computed at the subject level on each held-out fold. Balanced accuracy is the mean of the per-class recalls; accuracy is the overall fraction of correctly classified subjects; macro-F1 is the unweighted mean of the per-class F1 scores; and ROC-AUC is the area under the receiver operating characteristic curve computed from the predicted PD probabilities. Means and standard deviations are computed across all seed × fold estimates. Because repeated cross-validation produces correlated estimates (folds share training data), we assess differences between the proposed model and every other model with the Nadeau–Bengio corrected resampled paired
t-test, which inflates the variance by a factor accounting for the train/test overlap and is our headline test; we additionally report an across-seed paired
t-test (each seed contributing one fold-averaged estimate) and, for reference only, the naive paired
t-test and Wilcoxon signed-rank test, which are anti-conservative on correlated folds and should not be read as the primary inference. Statistical significance is reported at the 0.05 level on the corrected test. The classical baselines are unaffected by the model-selection change, as they use fixed hyperparameters and no early stopping.