OSCR

What matters beyond model choice for wearable sleep staging? How personalization, evaluation choices, and easy-to-classify wake impact performance.

Code ↔ Paper

4 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 4 matches · 1 of them tie a paragraph to a whole file, not to given lines: a weak match, whose lines are not tinted
  1. [1] § Results › The fraction of “easy-to-classify” wake in a testing dataset can dominate model performance ↔ final_figures/high_etc_example.py, lines 26–152 · score 0.67 · DREAMT subject, classified wake, wake epochs, wake accuracy, predicted, probability
  2. [2] § Materials and methods › Cross-validation and analytical approach ↔ src/pisces2/models/weaver_lstm.py, lines 188–258 · score 0.57 · model checkpoint, training epochs, loss, monitored, LSTM, weights
  3. [3] § Materials and methods › Cross-validation and analytical approach ↔ src/pisces2/models/conv_models.py, lines 539–609 · score 0.55 · model checkpoint, training epochs, loss, monitored, weights, validation
  4. [4] § Results › Models trained exclusively on people with a sleep disorder yields best performance for people across ages with suspected sleep disorders ↔ make_all_plots.sh, the whole file · a weak match · score 0.53 · Logistic regression, Random forest, DREAMT subjects, ROC, healthy, LSTM

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

Python · 156 lines · 4.7 KB · MIT · 1 match

  1. from datetime import timedelta
  2. import os
  3. import json
  4. import numpy as np
  5. import pandas as pd
  6. import matplotlib.pyplot as plt
  7. from pathlib import Path
  8. # Add src to path if needed, but assuming it's in the environment or current dir
  9. import sys
  10. sys.path.append(os.path.join(os.getcwd(), "src"))
  11. from pisces2.models.easy_to_classify_wake import (
  12. EasyToClassifyWakeClassifier,
  13. EasyToClassifyWakeConfig,
  14. )
  15. from pisces2.model_io import ModelIOBundle
  16. import pisces2.plotting as plotting
  17. import keras
  18. SECONDS_PER_MINUTE = 60
  19. MINUTES_PER_HOUR = 60
  20. def main():
  21. ROOT_DIR = Path(__file__).parent.parent
  22. # 1. Load the cached data
  23. data_path = (
  24. ROOT_DIR / "feature_cache/frequency_sum/32.0Hz/dreamt_subject_S003_features.npz"
  25. )
  26. data = ModelIOBundle.from_npz(data_path)
  27. X = data.X
  28. y = data.y
  29. # Squeeze to handle batch dimension
  30. X_subj = np.squeeze(X, axis=0) # (T_x, 1)
  31. y_true = np.squeeze(y, axis=0) # (T_y)
  32. # 2. Instantiate ETC classifier
  33. config_path = ROOT_DIR / "config/models/etc_model.json"
  34. with open(config_path, "r") as f:
  35. config_dict = json.load(f)
  36. # Extract model_config from the full config if necessary
  37. if "model_config" in config_dict:
  38. model_config_dict = config_dict["model_config"]
  39. model_config_dict.pop("name")
  40. else:
  41. model_config_dict = config_dict
  42. config = EasyToClassifyWakeConfig.from_dict(model_config_dict)
  43. model = EasyToClassifyWakeClassifier(config=config)
  44. # 3. Evaluate the ETC classifier
  45. # model.infer(X) returns logits of shape (B, T_y, num_classes)
  46. logits = model.infer(X)
  47. # Convert to probabilities using softmax
  48. probs = keras.activations.softmax(logits).numpy()
  49. # Class 0 is wake, Class 1 is sleep
  50. sleep_probs = probs[0, :, 1]
  51. # 4. Load results and get metrics for S003
  52. results_path = ROOT_DIR / "results/ETC-wake/cv_results.csv"
  53. results_df = pd.read_csv(results_path)
  54. s003_row = results_df[results_df["subject_id"] == "S003"].iloc[0]
  55. val_thresh = s003_row["val_threshold"]
  56. test_thresh = s003_row["test_threshold"]
  57. auroc = s003_row["auroc"]
  58. sleep_val_acc = s003_row["sleep_accuracy_val_threshold"]
  59. wake_val_acc = s003_row["wake_accuracy_val_threshold"]
  60. sleep_test_acc = s003_row["sleep_accuracy_test_threshold"]
  61. wake_test_acc = s003_row["wake_accuracy_test_threshold"]
  62. # Predictions based on val_threshold
  63. pred_sleep = sleep_probs >= val_thresh
  64. # 5. Create the plot
  65. fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(15, 8), sharex=True)
  66. # Time axes
  67. y_dt_minutes = 30 / SECONDS_PER_MINUTE
  68. x_y_ratio = float(np.ceil(len(X_subj) / len(y_true)))
  69. x_dt_minutes = y_dt_minutes / x_y_ratio
  70. y_dt_hours = y_dt_minutes / MINUTES_PER_HOUR
  71. x_dt_hours = x_dt_minutes / MINUTES_PER_HOUR
  72. time_x = np.arange(len(X_subj), dtype=float)
  73. time_y = np.arange(len(y_true), dtype=float)
  74. time_x *= x_dt_hours
  75. time_y *= y_dt_hours
  76. # we want to scale the values displayed by time_x
  77. # Top Row: Activity
  78. ax1.plot(time_x, X_subj, color="black", linewidth=0.5)
  79. title = (
  80. f"DREAMT: S003\n"
  81. f"ETC AUROC: {auroc:.3f}\n"
  82. f"Sleep: {100 * sleep_val_acc:.1f}% Wake: {100 * wake_val_acc:.1f}%\n"
  83. f"Sleep: {100 * sleep_test_acc:.1f}% Wake: {100 * wake_test_acc:.1f}%"
  84. )
  85. ax1.set_title(title)
  86. ax1.set_ylabel("Activity")
  87. # Middle Row: True sleep stages
  88. # y=0 is wake, y=1 is sleep.
  89. ax2.step(
  90. time_y,
  91. np.where(y_true > 0, 1, y_true),
  92. where="post",
  93. color="black",
  94. alpha=0.7,
  95. linewidth=2,
  96. label="True Sleep Stage",
  97. )
  98. ax2.set_ylabel("Sleep State")
  99. ax2.set_yticks([0, 1])
  100. ax2.set_yticklabels(["Wake", "Sleep"])
  101. ax2.set_ylim(-0.1, 1.1)
  102. # Shading for true wake epochs
  103. # We need to align time_y epochs.
  104. for i in range(len(y_true)):
  105. segment_arr = np.array([i, i + 1]) * y_dt_hours
  106. if y_true[i] == 0: # True Wake
  107. is_pred_wake = not pred_sleep[i]
  108. color = "green" if is_pred_wake else "tab:red"
  109. ax2.fill_between(segment_arr, 0, 1, color=color, alpha=0.3)
  110. if y_true[i] < 0: # Missing data
  111. ax2.fill_between(segment_arr, 0, 1, color="gray", alpha=0.5)
  112. ax1.set_xlim(time_x[0], time_x[-1])
  113. ax2.set_xlim(time_y[0], time_y[-1])
  114. ax2.grid(True, "major", "x")
  115. ax2.set_xlabel("Time (hours)")
  116. # Labeling
  117. plotting.make_plot_pretty(ax1)
  118. plotting.make_plot_pretty(ax2)
  119. plt.tight_layout()
  120. # Save the output
  121. output_dir = ROOT_DIR / "final_figures"
  122. output_dir.mkdir(parents=True, exist_ok=True)
  123. save_path = output_dir / "high_etc_example.png"
  124. plt.savefig(save_path, dpi=300)
  125. print(f"Plot saved to {save_path}")
  126. if __name__ == "__main__":
  127. main()

high_etc_example.py at commit f6b70fe, under MIT · at the source

Overview

Authors: Eric Canton1, Franco Tavella1, Christopher Drake2, Olivia Walch1, Philip Cheng2
  1. Arcascope Inc., Arlington, VA, United States
  2. Henry Ford Health + Michigan State University, Sleep Disorders and Research Center, Detroit, MI, United States
Journal: Sleep advances : a journal of the Sleep Research Society, volume 7, issue 2, article zpag051
Dates: received 6 October 2025; accepted 15 April 2026; published online 26 May 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1093/sleepadvances/zpag051 · PMID 42333378 · PMCID PMC13283449 · OpenAlex W7162425698
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: EEG (modality), other (modality), sleep disorders (population), methods / tools (subfield)
Methods: Connectivity, Machine learning, Preprocessing, Spectral & time-frequency
Keywords: actigraphy, sleep classification, wearables, machine learning, sleep apnea, personalized medicine, benchmark datasets, polysomnography, consumer sleep technology
Topic: Obstructive Sleep Apnea Research (Physiology, Medicine), according to OpenAlex
Funding: National Institutes of Health (K23 HL138166)
Citations: not cited yet (Europe PMC); 32 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repository

Its files are read in the Code ↔ Paper reader above, with 4 matches between paragraphs and lines of code.

arcascope/pisces2

License: MIT
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: f6b70fe17e1e2b8a818762fd9eac3e2a40e40260, 17 June 2026
Languages: Python (72), Shell (10), Jupyter (7)
Size: 150 files, 89 scripts
Software Heritage: not archived
Found in: the text, “Data preprocessing, feature selection, and model”
Holds: README, license file, environment (Dockerfile, Dockerfile.jax, pyproject.toml), tests, continuous integration, documentation, 7 notebooks
Not found: CITATION.cff
Tools: NumPy (57 files), pandas (23 files), Matplotlib (19 files), TensorFlow (17 files), Keras (16 files), scikit-learn (13 files), SciPy (11 files), seaborn (8 files), h5py (1 file), Pillow (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
91 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 89 scripts, each with its path and the digest of its content;
  • 4 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Code and data availability statement

The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

  • no repository, dataset or request procedure was recognized in it

Read it in the paper: doi.org/10.1093/sleepadvances/zpag051.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 2, 28 September 2026

  • Funding: added National Institutes of Health: K23 HL138166

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 5 authors, 9 keywords, 26 references.

Cite

This paper

Canton, E., Tavella, F., Drake, C., Walch, O., & Cheng, P. (2026). What matters beyond model choice for wearable sleep staging? How personalization, evaluation choices, and easy-to-classify wake impact performance. Sleep advances : a journal of the Sleep Research Society, 7(2), zpag051. https://doi.org/10.1093/sleepadvances/zpag051

BibTeX

@article{canton2026what,
author = {Canton, Eric and Tavella, Franco and Drake, Christopher and Walch, Olivia and Cheng, Philip},
title = {{What matters beyond model choice for wearable sleep staging? How personalization, evaluation choices, and easy-to-classify wake impact performance}},
journal = {Sleep advances : a journal of the Sleep Research Society},
year = {2026},
month = may,
volume = {7},
number = {2},
pages = {zpag051},
publisher = {Oxford University Press},
issn = {2632-5012},
doi = {10.1093/sleepadvances/zpag051},
url = {https://doi.org/10.1093/sleepadvances/zpag051},
pmid = {42333378},
pmcid = {PMC13283449}
}

RIS

TY - JOUR
AU - Canton, Eric
AU - Tavella, Franco
AU - Drake, Christopher
AU - Walch, Olivia
AU - Cheng, Philip
TI - What matters beyond model choice for wearable sleep staging? How personalization, evaluation choices, and easy-to-classify wake impact performance
T2 - Sleep advances : a journal of the Sleep Research Society
J2 - Sleep Adv
PY - 2026
DA - 2026/05/26
VL - 7
IS - 2
SP - zpag051
SN - 2632-5012
PB - Oxford University Press
DO - 10.1093/sleepadvances/zpag051
UR - https://doi.org/10.1093/sleepadvances/zpag051
LA - en
ER -

CSL-JSON

{
"id": "10.1093/sleepadvances/zpag051",
"type": "article-journal",
"title": "What matters beyond model choice for wearable sleep staging? How personalization, evaluation choices, and easy-to-classify wake impact performance",
"container-title": "Sleep advances : a journal of the Sleep Research Society",
"author": [
{
"family": "Canton",
"given": "Eric"
},
{
"family": "Tavella",
"given": "Franco"
},
{
"family": "Drake",
"given": "Christopher"
},
{
"family": "Walch",
"given": "Olivia"
},
{
"family": "Cheng",
"given": "Philip"
}
],
"container-title-short": "Sleep Adv",
"volume": "7",
"issue": "2",
"page": "zpag051",
"DOI": "10.1093/sleepadvances/zpag051",
"PMID": "42333378",
"PMCID": "PMC13283449",
"ISSN": "2632-5012",
"publisher": "Oxford University Press",
"URL": "https://doi.org/10.1093/sleepadvances/zpag051",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
26
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1038/s41598-026-42310-8 [code]
Sleep awake detection from leg-worn wearables using deep sensor fusion.
Journal: Scientific reports
In common: Keras, TensorFlow, seaborn, 5 other tools, other, methods / tools, 3 references
[2] doi:10.1038/s41597-025-05174-7 [code]
A large-scale MEG and EEG dataset for object recognition in naturalistic scenes
Journal: n/a
In common: Keras, TensorFlow, h5py, 7 other tools, methods / tools, EEG, 1 reference
[3] doi:10.1038/s41592-026-03057-2 [code]
CREsted: modeling genomic and synthetic cell-type-specific enhancers across tissues and species.
Journal: Nature methods
In common: Keras, TensorFlow, h5py, 7 other tools, methods / tools
[4] doi: [code]
Real-time closed-loop feedback system for mouse mesoscale cortical signal and movement control
Journal: eLife
In common: Keras, TensorFlow, h5py, 7 other tools
[5] doi:10.1364/boe.605322 [code]
Generalized plaque digitization framework for multi-dimensional mesoscopic images.
Journal: Biomedical optics express
In common: Keras, TensorFlow, h5py, 7 other tools
[6] doi:10.3389/fnsys.2026.1822122 [code]
Convergence-divergence circuits for multimodal integration of innate and learned opponent valences.
Journal: Frontiers in systems neuroscience
In common: Keras, TensorFlow, h5py, 7 other tools
[7] doi:10.1038/s41467-026-72057-9 [code]
Sex-specific behavioral feedback modulates sensorimotor processing and drives flexible social behavior.
Journal: Nature communications
In common: Keras, TensorFlow, h5py, 7 other tools
[8] doi:10.1016/j.xcrm.2026.102766 [code]
A longitudinal single-cell and spatial multiomic atlas of pediatric high-grade glioma.
Journal: Cell reports. Medicine
In common: Keras, TensorFlow, h5py, 7 other tools
[9] doi:10.3389/fpsyg.2026.1774068 [code]
Analysis of cognitive mechanisms in phoneme perception and pronunciation errors among Korean language learners.
Journal: Frontiers in psychology
In common: Keras, TensorFlow, h5py, 6 other tools, EEG
[10] doi:10.1002/ana.78203 [code]
AI-Driven Mapping of Seizure Spread Patterns.
Journal: Annals of neurology
In common: Keras, TensorFlow, Pillow, 6 other tools, EEG

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.