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.

4 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.

The 4 matches · 1 of them tie a paragraph to a whole file without 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 to 152 · score 0.67 · DREAMT subject, classified wake, wake epochs, wake accuracy, predicted, probability · block oscr:b:YXJ2399C1DXHF-Q · Report a mismatch
  2. [2] § Materials and methods › Cross-validation and analytical approach ↔ src/pisces2/models/weaver_lstm.py, lines 188 to 258 · score 0.57 · model checkpoint, training epochs, loss, monitored, LSTM, weights · block oscr:b:VB29RHMHN433J-T · Report a mismatch
  3. [3] § Materials and methods › Cross-validation and analytical approach ↔ src/pisces2/models/conv_models.py, lines 539 to 609 · score 0.55 · model checkpoint, training epochs, loss, monitored, weights, validation · block oscr:b:T1FAN8SFPQT15-H · Report a mismatch
  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 · block oscr:b:AAC743A801CK6-5 · Report a mismatch

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: 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 (how the code is found and 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 (medical), 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.7554/elife.79305 [code]
Open-source tools for behavioral video analysis: Setup, methods, and best practices.
Journal: eLife
In common: Keras, TensorFlow, h5py, 7 other tools, methods / tools, 1 reference
[4] doi:10.1016/j.patter.2024.101117 [code]
Neuron signal attenuation activation mechanism for deep learning.
Journal: Patterns (New York, N.Y.)
In common: Keras, TensorFlow, h5py, 6 other tools, 1 reference
[5] doi:10.7554/elife.52599 [code]
Hierarchical temporal prediction captures motion processing along the visual pathway.
Journal: eLife
In common: Keras, TensorFlow, h5py, 6 other tools, 1 reference
[6] doi:10.1371/journal.pcbi.1011792 [code]
High-performing neural network models of visual cortex benefit from high latent dimensionality.
Journal: PLoS computational biology
In common: TensorFlow, h5py, Pillow, 6 other tools, 1 reference
[7] doi:10.1038/s41467-024-45679-0 [code]
Improved modeling of human vision by incorporating robustness to blur in convolutional neural networks.
Journal: Nature communications
In common: Keras, TensorFlow, Pillow, 5 other tools, 1 reference
[8] doi:10.3389/fninf.2025.1515873 [code]
Net2Brain: a toolbox to compare artificial vision models with human brain responses.
Journal: Frontiers in neuroinformatics
In common: h5py, Pillow, seaborn, 5 other tools, methods / tools, 1 reference
[9] doi:10.1186/s44167-023-00017-5 [code]
Method for Activity Sleep Harmonization (MASH): a novel method for harmonizing data from two wearable devices to estimate 24-h sleep-wake cycles.
Journal: Journal of activity, sedentary and sleep behaviors
In common: Keras, TensorFlow, scikit-learn, 3 other tools, other, methods / tools, 1 reference
[10] doi:10.1167/jov.24.6.1 [code]
Convolutional neural network models applied to neuronal responses in macaque V1 reveal limited nonlinear processing.
Journal: Journal of vision
In common: Keras, TensorFlow, h5py, 4 other tools, 1 reference

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.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.1093/sleepadvances/zpag051.svg)](https://openscicode.org/badge/doi/10.1093/sleepadvances/zpag051)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1093/sleepadvances/zpag051.svg
   :target: https://openscicode.org/badge/doi/10.1093/sleepadvances/zpag051
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1093/sleepadvances/zpag051"><img src="https://openscicode.org/badge/doi/10.1093/sleepadvances/zpag051.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge 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: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

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