sleep-edf: declare and apply microvolt input scaling (v0.2) - #58
Merged
Conversation
The scorer returned MNE's SI-unit (volt) arrays while the prompt's preprocessing contract said nothing about units, and the shape contract exemplified inputs with torch.randn (unit scale). The academic convention for EEG is microvolts (MOABB / braindecode expose µV-scale arrays), and bciciv-2a v0.2 already adopted µV — keep the bench consistent. - scale epochs to microvolts in load_subject_recording (x1e6, float32) - declare "input_unit": "microvolts" in the prompt preprocessing dict and note µV in the input shape contract - bump task version 0.1 -> 0.2 (breaking: scores not comparable to v0.1) - add preprocessing contract unit tests (label mapping, µV scaling, interface constants, training hyperparameters) and wire them into the validate workflow, mirroring bciciv-2a v0.2 - document the unit in both READMEs Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
GTC2333
approved these changes
Aug 11, 2026
GTC2333
left a comment
Collaborator
There was a problem hiding this comment.
Verified the V→µV conversion on the pinned Sleep-EDF data: epoch shape and labels remain unchanged, while amplitudes scale exactly as intended. The four new preprocessing-contract tests and all required CI checks pass. Approved for merge. Non-blocking follow-up: please align the task README header from Version 0.1 to 0.2 and explicitly note that v0.1/v0.2 scores are not comparable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
load_subject_recording(×1e6, float32), matching the academic convention for EEG (MOABB / braindecode expose µV-scale arrays) and the bciciv-2a v0.2 precedent — keeps input units consistent across the bench"input_unit": "microvolts"in the prompt's frozen preprocessing dict and note µV in the input shape contractBackground
The scorer returned MNE's SI-unit (volt) arrays while the prompt's self-contained preprocessing dict said nothing about units, and the shape contract exemplified inputs with
torch.randn(unit scale). This is not a correctness bug — the scorer trains and tests on the same pipeline, so scores stay fair and reproducible — but amplitude-sensitive architectures (fixed-eps log-power, unnormalized saturating nonlinearities) behave differently at 1e-5 scale, and an agent inspecting the raw EDFs with non-MNE tooling sees µV (the EDF physical unit), which contradicts what the scorer actually feeds the model.Validation
(841, 1, 3000)float32, label distribution 188/58/250/220/125 (W/N1/N2/N3/REM) unchanged, std = 22.88 µV (was 2.29e-5 V), abs max 192 µVbp-bench validate sleep-edf, docs smoke, and the 208-test Node suite all passScore compatibility
This is a breaking scorer change. Scores produced with sleep-edf v0.1 should not be mixed with v0.2 scores. For normalization-based architectures the difference is expected to be within run-to-run noise; amplitude-sensitive architectures benefit materially.