What matters beyond model choice for wearable sleep staging? How personalization, evaluation choices, and easy-to-classify wake impact performance.
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] § 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] § 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] § 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] § 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
- from datetime import timedelta
- import os
- import json
- import numpy as np
- import pandas as pd
- import matplotlib.pyplot as plt
- from pathlib import Path
- # Add src to path if needed, but assuming it's in the environment or current dir
- import sys
- sys.path.append(os.path.join(os.getcwd(), "src"))
- from pisces2.models.easy_to_classify_wake import (
- EasyToClassifyWakeClassifier,
- EasyToClassifyWakeConfig,
- )
- from pisces2.model_io import ModelIOBundle
- import pisces2.plotting as plotting
- import keras
- SECONDS_PER_MINUTE = 60
- MINUTES_PER_HOUR = 60
- def main():
- ROOT_DIR = Path(__file__).parent.parent
- # 1. Load the cached data
- data_path = (
- ROOT_DIR / "feature_cache/frequency_sum/32.0Hz/dreamt_subject_S003_features.npz"
- )
- data = ModelIOBundle.from_npz(data_path)
- X = data.X
- y = data.y
- # Squeeze to handle batch dimension
- X_subj = np.squeeze(X, axis=0) # (T_x, 1)
- y_true = np.squeeze(y, axis=0) # (T_y)
- # 2. Instantiate ETC classifier
- config_path = ROOT_DIR / "config/models/etc_model.json"
- with open(config_path, "r") as f:
- config_dict = json.load(f)
- # Extract model_config from the full config if necessary
- if "model_config" in config_dict:
- model_config_dict = config_dict["model_config"]
- model_config_dict.pop("name")
- else:
- model_config_dict = config_dict
- config = EasyToClassifyWakeConfig.from_dict(model_config_dict)
- model = EasyToClassifyWakeClassifier(config=config)
- # 3. Evaluate the ETC classifier
- # model.infer(X) returns logits of shape (B, T_y, num_classes)
- logits = model.infer(X)
- # Convert to probabilities using softmax
- probs = keras.activations.softmax(logits).numpy()
- # Class 0 is wake, Class 1 is sleep
- sleep_probs = probs[0, :, 1]
- # 4. Load results and get metrics for S003
- results_path = ROOT_DIR / "results/ETC-wake/cv_results.csv"
- results_df = pd.read_csv(results_path)
- s003_row = results_df[results_df["subject_id"] == "S003"].iloc[0]
- val_thresh = s003_row["val_threshold"]
- test_thresh = s003_row["test_threshold"]
- auroc = s003_row["auroc"]
- sleep_val_acc = s003_row["sleep_accuracy_val_threshold"]
- wake_val_acc = s003_row["wake_accuracy_val_threshold"]
- sleep_test_acc = s003_row["sleep_accuracy_test_threshold"]
- wake_test_acc = s003_row["wake_accuracy_test_threshold"]
- # Predictions based on val_threshold
- pred_sleep = sleep_probs >= val_thresh
- # 5. Create the plot
- fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(15, 8), sharex=True)
- # Time axes
- y_dt_minutes = 30 / SECONDS_PER_MINUTE
- x_y_ratio = float(np.ceil(len(X_subj) / len(y_true)))
- x_dt_minutes = y_dt_minutes / x_y_ratio
- y_dt_hours = y_dt_minutes / MINUTES_PER_HOUR
- x_dt_hours = x_dt_minutes / MINUTES_PER_HOUR
- time_x = np.arange(len(X_subj), dtype=float)
- time_y = np.arange(len(y_true), dtype=float)
- time_x *= x_dt_hours
- time_y *= y_dt_hours
- # we want to scale the values displayed by time_x
- # Top Row: Activity
- ax1.plot(time_x, X_subj, color="black", linewidth=0.5)
- title = (
- f"DREAMT: S003\n"
- f"ETC AUROC: {auroc:.3f}\n"
- f"Sleep: {100 * sleep_val_acc:.1f}% Wake: {100 * wake_val_acc:.1f}%\n"
- f"Sleep: {100 * sleep_test_acc:.1f}% Wake: {100 * wake_test_acc:.1f}%"
- )
- ax1.set_title(title)
- ax1.set_ylabel("Activity")
- # Middle Row: True sleep stages
- # y=0 is wake, y=1 is sleep.
- ax2.step(
- time_y,
- np.where(y_true > 0, 1, y_true),
- where="post",
- color="black",
- alpha=0.7,
- linewidth=2,
- label="True Sleep Stage",
- )
- ax2.set_ylabel("Sleep State")
- ax2.set_yticks([0, 1])
- ax2.set_yticklabels(["Wake", "Sleep"])
- ax2.set_ylim(-0.1, 1.1)
- # Shading for true wake epochs
- # We need to align time_y epochs.
- for i in range(len(y_true)):
- segment_arr = np.array([i, i + 1]) * y_dt_hours
- if y_true[i] == 0: # True Wake
- is_pred_wake = not pred_sleep[i]
- color = "green" if is_pred_wake else "tab:red"
- ax2.fill_between(segment_arr, 0, 1, color=color, alpha=0.3)
- if y_true[i] < 0: # Missing data
- ax2.fill_between(segment_arr, 0, 1, color="gray", alpha=0.5)
- ax1.set_xlim(time_x[0], time_x[-1])
- ax2.set_xlim(time_y[0], time_y[-1])
- ax2.grid(True, "major", "x")
- ax2.set_xlabel("Time (hours)")
- # Labeling
- plotting.make_plot_pretty(ax1)
- plotting.make_plot_pretty(ax2)
- plt.tight_layout()
- # Save the output
- output_dir = ROOT_DIR / "final_figures"
- output_dir.mkdir(parents=True, exist_ok=True)
- save_path = output_dir / "high_etc_example.png"
- plt.savefig(save_path, dpi=300)
- print(f"Plot saved to {save_path}")
- if __name__ == "__main__":
- main()
high_etc_example.py at commit f6b70fe, under MIT · at the source
Overview
- Arcascope Inc., Arlington, VA, United States
- Henry Ford Health + Michigan State University, Sleep Disorders and Research Center, Detroit, MI, United States
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
f6b70fe17e1e2b8a818762fd9eac3e2a40e40260, 17 June 2026Availability: 1 check, the latest on 28 September 2026: the link answers
- 28 September 2026: the link answers
91 files
- build_docker.sh, Shell, 19 lines
- build_jax.sh, Shell, 19 lines
- combine_shards.py, Python, 212 lines
- deep_kernel_analysis.py, Python, 667 lines
- feature_cache_plot.py, Python, 430 lines
- feature_stats.py, Python, 191 lines
- final_figures/
etc_demo.py , Python, 234 lines - final_figures/
high_etc_example.py , Python, 156 lines, 1 match - fresh_start.sh, Shell, 16 lines
- hard_reset.sh, Shell, 15 lines
- local_run.sh, Shell, 18 lines
- lp.py, Python, 5 lines
- make_all_plots.sh, Shell, 81 lines, 1 match
- make_mape.sh, Shell, 14 lines
- mape_plots.py, Python, 576 lines
- notebooks/
combine_multiple_experim , Jupyter, 189 linesents.ipynb - notebooks/
dreamt_eda.ipynb , Jupyter, 75 lines - notebooks/
easy_wake_vs_auroc.ipynb , Jupyter, 469 lines - notebooks/
inter_run_variance.ipynb , Jupyter, 73 lines - notebooks/
scratch.ipynb , Jupyter, 56 lines - notebooks/
seed.ipynb , Jupyter, 31 lines - notebooks/
senpy.ipynb , Jupyter, 813 lines - run_config.py, Python, 544 lines
- run_cpu.sh, Shell, 61 lines
- run_lstm.sh, Shell, 15 lines
- scripts/
accelerometer_report.py , Python, 163 lines - scripts/
convert_timestamps.py , Python, 183 lines - src/
pisces2/ , Python, 1 line__about__.py - src/
pisces2/ , Python, 1 line__init__.py - src/
pisces2/ , Python, 257 linesarcana.py - src/
pisces2/ , Python, 50 linesconfiguration/ __init__.py - src/
pisces2/ , Python, 252 linesconfiguration/ config_loader.py - src/
pisces2/ , Python, 111 linesconfiguration/ cv_configuration.py - src/
pisces2/ , Python, 50 linesconfiguration/ model_configuration.py - src/
pisces2/ , Python, 382 linesconfiguration/ processing_configuration .py - src/
pisces2/ , Python, 31 linesconfiguration/ training_configuration.p y - src/
pisces2/ , Python, 137 linesconstants.py - src/
pisces2/ , Python, 913 linescross_validation.py - src/
pisces2/ , Python, 155 linescsv_analysis.py - src/
pisces2/ , Python, 394 linescv_orchestrator.py - src/
pisces2/ , Python, 717 linescv_scorer.py - src/
pisces2/ , Python, 230 linesdata_pipeline.py - src/
pisces2/ , Python, 87 linesdata_sets/ __init__.py - src/
pisces2/ , Python, 66 linesdata_sets/ data_loading.py - src/
pisces2/ , Python, 240 linesdata_sets/ data_processing.py - src/
pisces2/ , Python, 422 linesdata_sets/ data_set_object.py - src/
pisces2/ , Python, 381 linesfeatures.py - src/
pisces2/ , Python, 1,920 lineskernel_analysis.py - src/
pisces2/ , Python, 3,063 lineslive_plotting.py - src/
pisces2/ , Python, 173 linesmasked_metrics.py - src/
pisces2/ , Python, 277 linesmodel_io.py - src/
pisces2/ , Python, 116 linesmodels/ __init__.py - src/
pisces2/ , Python, 624 lines, 1 matchmodels/ conv_models.py - src/
pisces2/ , Python, 114 linesmodels/ cv_keras_wrapper.py - src/
pisces2/ , Python, 136 linesmodels/ cv_model.py - src/
pisces2/ , Python, 492 linesmodels/ easy_to_classify_wake.py - src/
pisces2/ , Python, 443 linesmodels/ gp_kl.py - src/
pisces2/ , Python, 279 linesmodels/ logistic_regression.py - src/
pisces2/ , Python, 47 linesmodels/ model_analyzer.py - src/
pisces2/ , Python, 295 linesmodels/ random_forests.py - src/
pisces2/ , Python, 130 linesmodels/ regularizers.py - src/
pisces2/ , Python, 784 linesmodels/ spectral_unet_transforme r.py - src/
pisces2/ , Python, 685 linesmodels/ transformer_model.py - src/
pisces2/ , Python, 274 lines, 1 matchmodels/ weaver_lstm.py - src/
pisces2/ , Python, 2,228 linesplotting.py - src/
pisces2/ , Python, 665 linesprocessing.py - src/
pisces2/ , Python, 263 linesroc_analysis.py - src/
pisces2/ , Python, 3 linessaving/ __init__.py - src/
pisces2/ , Python, 110 linessaving/ pisces_archive.py - src/
pisces2/ , Python, 859 linesscoring.py - src/
pisces2/ , Python, 8 linesstats.py - src/
pisces2/ , Python, 208 linesutils.py - tests/
__init__.py , Python, 1 line - tests/
conftest.py , Python, 36 lines - tests/
test_configuration.py , Python, 110 lines - tests/
test_cv_scorer.py , Python, 365 lines - tests/
test_features.py , Python, 70 lines - tests/
test_integration.py , Python, 177 lines - tests/
test_kernel_analysis_sim , Python, 70 linesple.py - tests/
test_model_io.py , Python, 188 lines - tests/
test_model_serialization , Python, 443 lines.py - tests/
test_processing.py , Python, 174 lines - tests/
test_processing_configur , Python, 47 linesation.py - tests/
test_regularizers.py , Python, 68 lines - tests/
test_scoring.py , Python, 515 lines - tests/
test_spectral_unet_trans , Python, 176 linesformer.py - tests/
test_trunet_savez_roundt , Python, 346 linesrip.py - tests/
test_utils.py , Python, 105 lines - warning_grep.sh, Shell, 2 lines
- LICENSE, License, 21 lines
- README.md, Text, 194 lines
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
- doi:10.13026/
7r9r-7r24 , at the source; found in the references - doi:10.13026/
hmhs-py35 , at the source; found in the references - github.com/
ojwalch/ , at github.com; found in the text, “Data collection”sleep_accel
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://
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/
url = {https://
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/
VL - 7
IS - 2
SP - zpag051
SN - 2632-5012
PB - Oxford University Press
DO - 10.1093/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1093/
"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":
"volume": "7",
"issue": "2",
"page": "zpag051",
"DOI": "10.1093/
"PMID": "42333378",
"PMCID": "PMC13283449",
"ISSN": "2632-5012",
"publisher": "Oxford University Press",
"URL": "https://
"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 reportsIn 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 scenesJournal: n/aIn 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 methodsIn 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 controlJournal: eLifeIn 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 expressIn 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 neuroscienceIn 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 communicationsIn 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. MedicineIn 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 psychologyIn 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 neurologyIn 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.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 89 scripts, and 4 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:5f487dbb1b3f2264…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
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.
