Add WatchSleepNet model with synthetic example and unit tests#931
Draft
T-D-X wants to merge 3 commits intosunlabuiuc:masterfrom
Draft
Add WatchSleepNet model with synthetic example and unit tests#931T-D-X wants to merge 3 commits intosunlabuiuc:masterfrom
T-D-X wants to merge 3 commits intosunlabuiuc:masterfrom
Conversation
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
This PR adds a reproducibility-oriented wearable sleep staging pipeline to PyHealth based on the WatchSleepNet paper:
WatchSleepNet: A Novel Model and Pretraining Approach for Advancing Sleep Staging with Smartwatches
The contribution includes:
DREAMTDatasetloader for DREAMT-style sleep staging dataWatchSleepNetmodelThis is a best-faith implementation intended for reproducibility and educational use. It is inspired by the paper, but it is not an exact reproduction of the full original training pipeline.
Contribution Type
Paper
https://proceedings.mlr.press/v287/wang25a.htmlWhat Was Added
1. DREAMT dataset support
Added
pyhealth/datasets/dreamt.py.Key behavior:
2. DREAMT sleep staging task
Added DREAMT-oriented task support in
pyhealth/tasks/sleep_staging.py.Task variants:
SleepStagingDREAMTSleepStagingDREAMTSeqLabel mapping:
0123. WatchSleepNet model
Added
pyhealth/models/watchsleepnet.py.Implemented components:
This is a simplified and maintainable WatchSleepNet-style architecture rather than an exact line-by-line reproduction.
4. Synthetic tests
Added fast synthetic tests:
tests/core/test_dreamt_dataset.pytests/core/test_sleep_staging_task.pytests/core/test_watchsleepnet.pyThe tests use only synthetic data and do not depend on real DREAMT data.
5. Example / ablations
Added:
examples/dreamt_sleep_staging_watchsleepnet.pyThe example demonstrates:
Reported example metrics include:
6. Documentation
Added/updated:
docs/api/datasets/pyhealth.datasets.DREAMTDataset.rstdocs/api/tasks/pyhealth.tasks.sleep_staging.rstdocs/api/models/pyhealth.models.WatchSleepNet.rstFile Guide
Dataset
pyhealth/datasets/dreamt.pyTask
pyhealth/tasks/sleep_staging.pypyhealth/tasks/__init__.pyModel
pyhealth/models/watchsleepnet.pypyhealth/models/__init__.pyTests
tests/core/test_dreamt_dataset.pytests/core/test_sleep_staging_task.pytests/core/test_watchsleepnet.pyExample
examples/dreamt_sleep_staging_watchsleepnet.pyDocs
docs/api/datasets/pyhealth.datasets.DREAMTDataset.rstdocs/api/tasks/pyhealth.tasks.sleep_staging.rstdocs/api/models/pyhealth.models.WatchSleepNet.rstHow To Run
Unit tests
Example / ablations
PYTHONPATH=. python examples/dreamt_sleep_staging_watchsleepnet.pyAssumptions and Limitations
Notes For Reviewers
Recommended review order:
Authors