Repository navigation
[BTY-64] SleepKD on ISRUC-III with a sequence sleep staging task - #1503
Conversation
Test CoverageTotal: 84.96% (39757 / 46796 lines)
|
216d484 to
bf15c4e
Compare
|
/review |
| sleepkd_ta 67.0 (6.2) 61.4 (5.5) | ||
| sleepkd 65.0 (5.6) 59.0 (5.6) paper 83.29 77.29 | ||
|
|
||
| Every method is about 15 points of accuracy below the paper and no distilled |
There was a problem hiding this comment.
[low] ISRUC results gap to the paper is stated but unexplained
The docstring reports every method about 15 points of accuracy below the paper (the table gives 15 to 18 points, with sleepkd the largest at 18.3). The gap is far larger than the Sleep-EDF gap, which the author says is in range, so it may point to an ISRUC-specific pipeline difference rather than split noise alone. Non-blocking, but either note the likely causes or say what was checked (for example, the expert annotator, channel, resampling or label mapping) so readers know the ISRUC numbers are not a reproduction.
| Attributes: | ||
| task_name (str): The name of the task, "SleepStagingSequenceISRUC". | ||
| input_schema (dict[str, str]): ``{"signal": "tensor"}``, a float array | ||
| of shape ``(seq_len, 1, 30 * sfreq)``. |
There was a problem hiding this comment.
[low] Attributes shape ignores sfreq=None
The Attributes section says the signal shape is (seq_len, 1, 30 * sfreq), but sfreq can be None, which keeps the recording's rate (200 Hz), so the shape is then (seq_len, 1, 6000). Write the shape as 30 * sfreq samples, where sfreq is the rate in Hz (200 when sfreq=None).
There was a problem hiding this comment.
AI Review
suggestion: approve
decision: approve
Thank you for this contribution. It adds SleepStagingSequenceISRUC, a 20-epoch single-channel sequence task for ISRUC-III. It also adds a --dataset isruc / --fold k option to the SleepKD example, plus a docs page and tests. It looks ready to merge.
- The task subclasses SleepStagingISRUC and reuses its
read_recordingand_samples_from_event. The description says it builds on the ISRUC port from #1486, so that link is explained. - Coverage meets the bar.
sleep_staging_isruc.pyis at 100% andtasks/__init__.pyat 97.3%. The whole repository is at 84.96%. - The tests cover windowing, dropped-epoch gaps, stride, resampling, a missing channel, invalid arguments and
set_task. - The docs match the code.
Optional suggestions:
- The ISRUC results are about 15 points of accuracy below the paper for every method. You state this clearly and it doesn't make the code wrong. If you find a cause later, a short note in the docstring would help readers.
- The
sfreq=Nonecase isn't shown in the docstring's output shape. In that case the signal length is 30 × the recording's rate, which is 6000 at 200 Hz. One extra line would make that clear. - The default
--outis shared across folds, so runs from different folds can overwrite each other. Consider making the default include the fold, or warning when--foldis given without a custom--out.
Reviewed commit bf15c4e
|
/merge |
Contributor: Sameh Aissa
Contribution Type: Task and example, bounty BTY-64
Description:
The ISRUC-III half of BTY-64 on top of #1518 which added SleepKD and the Sleep-EDF part, so together they cover both datasets the bounty names.
SleepStagingSequenceISRUCbuilds on the ISRUC port from #1486 and gives 20 epoch windows of one EEG channel with a stage per epoch likeSleepStagingSequenceSleepEDF. It uses F3-A2 resampled from 200 to 100 Hz as in the paper and a window never spans a dropped epoch.The example now takes
--dataset isrucand--fold kfor a subject-wise cross validation since ISRUC-III has only 10 subjects. I ran all nine runs on the 10 folds with the paper's settings of 300 epochs, lr 1e-5 and batch 20. Mean (std) of accuracy and macro-F1 next to the paper's Table 3.Every method is about 15 points of accuracy below the paper and no distilled student beats the student trained alone on average. Each fold tests on one subject so the spread between folds is larger than the gaps between methods, like #1518 found on Sleep-EDF. The table is also in the example's docstring.
Files to Review:
pyhealth/tasks/sleep_staging_isruc.pythe sequence taskexamples/eeg/sleep_staging/sleepkd_deepsleepnet.pyrenamed fromsleepkd_sleepedf_deepsleepnet.pywith--dataset,--foldand the ISRUC resultstests/core/test_isruc.pytests for the sequence task on synthetic recordingsdocs/api/tasks/pyhealth.tasks.SleepStagingSequenceISRUC.rstanddocs/api/tasks.rstthe docs pageTesting:
pytest tests/core/test_isruc.py33 passed with 100% coverage onsleep_staging_isruc.pyandtools/check_pr_rules.pypasses. The results come from the example on a local RTX 5050.