Expand description
Sensor signal normalisation and denormalisation.
The raw sensor values captured by wearable devices span very different physical scales (e.g. heart rate ≈ 60–180 bpm vs. LF power ≈ 0–10 000). Before feeding data into the ViT encoder every channel is z-score normalised using population-level statistics.
§Normalisation formula
z[t, c] = (x[t, c] - mean[c]) / std[c]§Denormalisation (used in caption generation)
x[t, c] = z[t, c] * std[c] + mean[c]After denormalisation certain channels are clamped to be non-negative
(e.g. steps, sleep_coefficient).
Structs§
- Channel
Stats - Per-channel normalisation statistics resolved from
NORM_PARAMS.
Functions§
- apply_
mask - Apply a missingness mask, replacing imputed values with
NaN. - average_
downsample_ ct - Average-pool a
(C, T)array down to(C, target_t)time-steps. - channel_
name - Return the human-readable name for a channel index.
- channel_
stats - Compute
(mean, max, min, std)for every channel in a(T, C)array. - denormalize
- Reverse a previous call to
normalize. - denormalized
- Denormalise without mutating: returns a new owned array.
- f32_
slice_ to_ normalised - Convert a flat
Vec<f32>(row-major, shape[T, C]) into an ndarray after normalising. - normalize
- Z-score normalise a
(T, C)raw sensor array in-place. - normalized
- Z-score normalise a raw sensor array and return a new array.