Skip to content

Add SleepWakeClassification task for DREAMT#892

Open
diegofariasc wants to merge 28 commits intosunlabuiuc:masterfrom
diegofariasc:diegof4/dreamt_sleep_tracking
Open

Add SleepWakeClassification task for DREAMT#892
diegofariasc wants to merge 28 commits intosunlabuiuc:masterfrom
diegofariasc:diegof4/dreamt_sleep_tracking

Conversation

@diegofariasc
Copy link

Contributor: Diego Farias Castro (diegof4@illinois.edu)
Type of contribution:
task
Link to original paper: https://proceedings.mlr.press/v248/wang24a.html

High-level description:
This PR adds a new standalone task, SleepWakeClassification, on top of the existing DREAMTDataset. The task supports epoch-level sleep-vs-wake prediction from multimodal wrist-worn wearable signals. It turns each DREAMT record into fixed-length epochs, extracts features from accelerometer, temperature, blood volume pulse, and electrodermal activity signals, adds temporal context features, and assigns a binary sleep/wake label to each epoch.

Implementation summary:

  • Adds SleepWakeClassification in pyhealth/tasks/sleep_wake_classification.py
  • Exports the task in pyhealth/tasks/__init__.py
  • Adds task API documentation in docs/api/tasks/pyhealth.tasks.sleep_wake_classification.rst
  • Registers the task page in docs/api/tasks.rst
  • Includes an example ablation script in examples/dreamt_sleep_wake_classification_lightgbm.py
  • Includes task tests in tests/core/test_sleep_wake_classification.py

Reproducibility scope:
This PR focuses on the task side of the paper. It makes the sleep-wake prediction setting available inside PyHealth so the generated samples can be used in new experiments and ablation studies.

Task behavior:

  • Input: wearable records from the existing DREAMTDataset
  • Output: epoch-level samples with patient_id, record_id, epoch_index,
    features, and binary label
  • Labels: wake maps to 1; sleep stages (REM, N1, N2, N3) map to 0
  • Features: accelerometer summaries, temperature summaries, BVP-based HRV
    features, and EDA-based SCR features
  • Temporal context: Gaussian smoothing, temporal derivative, and rolling
    variance for each base feature

File guide:

  • pyhealth/tasks/sleep_wake_classification.py: task implementation
  • pyhealth/tasks/__init__.py: public task export
  • docs/api/tasks/pyhealth.tasks.sleep_wake_classification.rst: task docs
  • docs/api/tasks.rst: task index update
  • examples/dreamt_sleep_wake_classification_lightgbm.py: example and ablation workflow
  • tests/core/test_sleep_wake_classification.py: task unit tests

diegofariasc and others added 28 commits March 8, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant