OSCR

Fully-automated sleep staging for Parkinson's disease and isolated REM sleep behavior disorder.

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 · 2 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
  1. [1] § Methods › Sleep staging ↔ csdp_training/lightning_models/base.py, the whole file · a weak match · score 0.69 · cross entropy loss, Adam, hyperparameters, Optimizer, training, batch
  2. [2] § Methods › Sleep staging ↔ csdp_training/lightning_models/factories/lightning_model_factory.py, lines 21–87 · score 0.62 · EOG channel, Sleep model, depth, loss, class, batch
  3. [3] § Methods › Sleep staging ↔ csdp_training/experiments/cv.py, lines 20–87 · score 0.57 · mini batches, validation subjects, fold, split, epoch, models
  4. [4] § Methods › Sleep staging ↔ csdp_pipeline/pipeline_elements/bids_predictor.py, the whole file · a weak match · score 0.56 · majority vote, sleep stage prediction, batches, epoch, models

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 · 145 lines · 5 KB · no license · 1 match

  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Thu Feb 2 13:40:59 2023
  4. @author: repse
  5. """
  6. import torch
  7. import torch.nn as nn
  8. import pytorch_lightning as pl
  9. from csdp_training.utility import kappa, acc, f1
  10. class Base_Lightning(pl.LightningModule):
  11. def __init__(
  12. self,
  13. model,
  14. lr,
  15. batch_size,
  16. lr_patience,
  17. lr_factor,
  18. lr_minimum,
  19. loss_weights
  20. ):
  21. super().__init__()
  22. self.model = model
  23. self.lr = lr
  24. self.batch_size = batch_size
  25. self.lr_patience = lr_patience
  26. self.lr_factor = lr_factor
  27. self.lr_minimum = lr_minimum
  28. self.loss_weights = loss_weights
  29. self.training_step_outputs = []
  30. self.validation_step_loss = []
  31. self.validation_step_acc = []
  32. self.validation_step_kap = []
  33. self.validation_step_f1 = []
  34. self.validation_preds = []
  35. self.validation_labels = []
  36. weights = torch.tensor(loss_weights) if loss_weights != None else None
  37. self.loss = nn.CrossEntropyLoss(weight=weights,
  38. ignore_index=5)
  39. self.save_hyperparameters(ignore=['model'])
  40. self.log_to_progress_bar=False
  41. def forward(self, x):
  42. return self.model(x.float())
  43. def configure_optimizers(self):
  44. optimizer = torch.optim.Adam(self.parameters(), lr=self.lr)
  45. scheduler=torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer,
  46. mode='max',
  47. factor=self.lr_factor,
  48. patience=self.lr_patience,
  49. threshold=1e-4,
  50. threshold_mode='rel',
  51. cooldown=0,
  52. min_lr=self.lr_minimum,
  53. eps=1e-8,
  54. verbose=True)
  55. return {
  56. 'optimizer': optimizer,
  57. 'monitor': 'valKap',
  58. 'lr_scheduler': scheduler
  59. }
  60. def compute_train_metrics(self, y_pred, y_true):
  61. y_pred = torch.swapdims(y_pred, 1, 2)
  62. y_pred = torch.reshape(y_pred, (-1, 5))
  63. y_true = torch.flatten(y_true)
  64. loss = self.loss(y_pred, y_true.long())
  65. y_pred = torch.argmax(y_pred, dim=1)
  66. try:
  67. accu = acc(y_pred, y_true)
  68. kap = kappa(y_pred, y_true, 5)
  69. f1_score = f1(y_pred, y_true, average=False)
  70. except:
  71. accu = None
  72. kap = None
  73. f1_score = None
  74. return loss, accu, kap, f1_score
  75. def compute_test_metrics(self, y_pred, y_true):
  76. y_true = torch.flatten(y_true)
  77. accu = acc(y_pred, y_true)
  78. kap = kappa(y_pred, y_true, 5)
  79. f1_score = f1(y_pred, y_true, average=False)
  80. return accu, kap, f1_score
  81. def on_train_epoch_end(self):
  82. all_outputs = self.training_step_outputs
  83. mean_loss = torch.mean(torch.stack(all_outputs, dim=0))
  84. self.log('trainLoss', mean_loss, batch_size=self.batch_size, rank_zero_only=True)
  85. self.training_step_outputs.clear()
  86. def on_validation_epoch_end(self):
  87. all_losses = self.validation_step_loss
  88. all_acc = self.validation_step_acc
  89. all_kap = self.validation_step_kap
  90. all_f1 = self.validation_step_f1
  91. mean_loss = torch.mean(torch.stack(all_losses, dim=0))
  92. mean_acc = torch.mean(torch.stack(all_acc, dim=0))
  93. mean_kap = torch.mean(torch.stack(all_kap, dim=0))
  94. mean_f1c0 = torch.mean(torch.stack(all_f1, dim=1)[0])
  95. mean_f1c1 = torch.mean(torch.stack(all_f1, dim=1)[1])
  96. mean_f1c2 = torch.mean(torch.stack(all_f1, dim=1)[2])
  97. mean_f1c3 = torch.mean(torch.stack(all_f1, dim=1)[3])
  98. mean_f1c4 = torch.mean(torch.stack(all_f1, dim=1)[4])
  99. batch_size=1
  100. self.log('valLoss', mean_loss, batch_size=batch_size, rank_zero_only=True)
  101. self.log('valAcc', mean_acc, batch_size=batch_size, rank_zero_only=True)
  102. self.log('valKap', mean_kap, batch_size=batch_size, rank_zero_only=True, prog_bar=self.log_to_progress_bar)
  103. self.log('val_f1_c0', mean_f1c0, batch_size=batch_size, rank_zero_only=True)
  104. self.log('val_f1_c1', mean_f1c1, batch_size=batch_size, rank_zero_only=True)
  105. self.log('val_f1_c2', mean_f1c2, batch_size=batch_size, rank_zero_only=True)
  106. self.log('val_f1_c3', mean_f1c3, batch_size=batch_size, rank_zero_only=True)
  107. self.log('val_f1_c4', mean_f1c4, batch_size=batch_size, rank_zero_only=True)
  108. self.validation_step_loss.clear()
  109. self.validation_step_acc.clear()
  110. self.validation_step_kap.clear()
  111. self.validation_step_f1.clear()
  112. self.validation_labels.clear()
  113. self.validation_preds.clear()

base.py at commit 19e72b6, no license · at the source

Overview

Authors: Jesper Strøm1, Casper Skjærbæk2,3, Natasha Becker Bertelsen2,3, Steffen Torpe Simonsen1, Niels Okkels4,5, David Bertram6,7,8, Sinah Röttgen9,10,11, Konstantin Kufer11,12, Kaare B Mikkelsen1, Marit Otto4, Poul Jørgen Jennum13, Per Borghammer2,3, Michael Sommerauer9,10,11,12, Preben Kidmose1
13 affiliations
  1. Department of Electrical and Computer Engineering, Aarhus University, Aarhus, Denmark
  2. Department of Nuclear Medicine, Aarhus University Hospital, Aarhus, Denmark
  3. Lundbeck Foundation Parkinson’s Disease Research Center (PACE), Aarhus University, Aarhus, Denmark
  4. Department of Neurology, Aarhus University Hospital, Aarhus, Denmark
  5. Department of Clinical Medicine, Aarhus University, Aarhus, Denmark
  6. Faculty of Mathematics and Natural Sciences, University of Cologne, Cologne, Germany
  7. Institute for Biomedical Informatics, Faculty of Medicine and University Hospital Cologne, Cologne, Germany
  8. Center for Molecular Medicine Cologne (CMMC), Faculty of Medicine and University Hospital Cologne, Cologne, Germany
  9. Cognitive Neuroscience, Institute for Neuroscience and Medicine, INM-3, Research Center Juelich, Juelich, Germany
  10. Department of Neurology, Faculty of Medicine and University Hospital Cologne, University of Cologne, Cologne, Germany
  11. Center of Neurology, Department of Parkinson, Sleep and Movement Disorders, University Hospital Bonn, University of Bonn, Bonn, Germany
  12. German Center for Neurodegenerative Diseases (DZNE), Bonn, Germany
  13. Danish Center for Sleep Medicine, Rigshospitalet, Glostrup, Denmark
Journal: NPJ digital medicine, volume 9, issue 1, article 629
Dates: received 11 February 2026; accepted 21 June 2026; published online 11 August 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1038/s41746-026-02946-2 · PMID 42601395 · PMCID PMC13476445 · OpenAlex W7202212196
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: human (organism), Parkinson's (population), sleep disorders (population)
Methods: Connectivity, Statistics, Machine learning, Preprocessing, Evoked potentials
Keywords: Diseases, Medical research, Neurology, Neuroscience
Topic: Parkinson's Disease Mechanisms and Treatments (Neurology, Medicine), according to OpenAlex
Funding: Michael J. Fox Foundation for Parkinson's Research (MJFF‐022856); Innovation Fund Denmark; Lundbeckfonden (R359-2020-2533); H. Lundbeck A/S; HORIZON EUROPE Framework Programme (101095426); European Research Council
Citations: cited by 1 paper (Europe PMC); 43 references in the paper

Abstract

Isolated REM sleep behavior disorder (iRBD) is a key prodromal marker of Parkinson’s disease (PD). Video-polysomnography (vPSG) remains the diagnostic gold standard, but manual sleep staging is particularly time-consuming and challenging in neurodegenerative disease. We adapted U-Sleep, a deep neural network, for automated sleep staging in PD and iRBD. A pretrained model (PUB, 19,236 PSGs), was finetuned on multicenter datasets (PACE, CBC: 112 PD, 138 iRBD, 89 controls) and evaluated on a clinical hold-out (DCSM: 81 PD, 36 iRBD, 87 controls). Predictors of staging agreement were analyzed, and low-agreement recordings were blindly rescored. Confidence-based thresholds were applied to enhance REM detection. The pretrained model achieved κ = 0.66 in PACE/CBC, improving to κ = 0.74 after finetuning (p < 0.001). In the hold-out, mean κ increased from 0.60 to 0.64 (p < 0.001). Site-specific finetuning provided minimal benefit. Confidence was a significant predictor of Cohen’s κ (p < 0.001). Recordings with low model agreement also showed low human interrater agreement. Applying a confidence threshold increased REM precision from 85 to 95.6%, preserving sufficient REM sleep in 96% of subjects. This publicly available model achieves human-level agreement enabling scalable, standardized PSG analysis with model-derived confidence as a tool for further refinements.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

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

jesperstroem/U-Sleep-for-RBD-PD

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 19e72b632b1bd87650f7d560f42aa32d47bd9a9b, 4 June 2026
Languages: Python (46), Jupyter (1)
Size: 51 files, 47 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README, environment (setup.py), 1 notebook
Not found: license file, CITATION.cff, tests, continuous integration, documentation
Tools: PyTorch (26 files), NumPy (9 files), h5py (6 files), scikit-learn (5 files), PyTorch Lightning (4 files), SciPy (4 files), Matplotlib (2 files), MNE-Python (2 files), MNE-BIDS (2 files), pandas (1 file), WFDB Python (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
48 files

Code availability

The underlying code for the U-Sleep model is available at https://github.com/jesperstroem/U-Sleep-for-RBD-PD. The repository contains a detailed guide on how to set up and use the pipeline to sleep-stage various types of files containing PSG data using Python (PyTorch and PyTorch Lightning packages). The installation process is done in a few steps through a command line, and there are code examples available, such that only a few lines need to be adapted before use, meaning it requires only minimal Python experience to set up. Once set up, it is possible to use either the Pretrained Model or the Generalized model. Additionally, it is possible to customize which PSG channels are used for classification.

Reproduced under the paper's license (CC BY), from the paper cited above.

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;
  • 47 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

No dataset and no data link were found in the paper.

Data availability

The datasets used in the current study are not publicly available because they contain personal health data protected by local ethics and data-protection regulations. Access requires specific approvals, including data sharing agreements. Fully anonymized, processed data may be shared on reasonable requests, subject to necessary regulatory and contractual agreements.

Reproduced under the paper's license (CC BY), from the paper cited above.

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 3, 28 September 2026

  • Funding: added Michael J. Fox Foundation for Parkinson's Research: MJFF‐022856; Innovationsfonden; Lundbeckfonden: R359-2020-2533; H. Lundbeck A/S; HORIZON EUROPE Framework Programme: 101095426; European Research Council

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 14 authors, 4 keywords, 41 references.

Cite

This paper

Strøm, J., Skjærbæk, C., Bertelsen, N. B., Simonsen, S. T., Okkels, N., Bertram, D., Röttgen, S., Kufer, K., Mikkelsen, K. B., Otto, M., Jennum, P. J., Borghammer, P., Sommerauer, M., & Kidmose, P. (2026). Fully-automated sleep staging for Parkinson's disease and isolated REM sleep behavior disorder. NPJ digital medicine, 9(1), 629. https://doi.org/10.1038/s41746-026-02946-2

BibTeX

@article{strm2026fully,
author = {Strøm, Jesper and Skjærbæk, Casper and Bertelsen, Natasha Becker and Simonsen, Steffen Torpe and Okkels, Niels and Bertram, David and Röttgen, Sinah and Kufer, Konstantin and Mikkelsen, Kaare B and Otto, Marit and Jennum, Poul Jørgen and Borghammer, Per and Sommerauer, Michael and Kidmose, Preben},
title = {{Fully-automated sleep staging for Parkinson's disease and isolated REM sleep behavior disorder}},
journal = {NPJ digital medicine},
year = {2026},
month = aug,
volume = {9},
number = {1},
pages = {629},
publisher = {Nature Publishing Group},
issn = {2398-6352},
doi = {10.1038/s41746-026-02946-2},
url = {https://doi.org/10.1038/s41746-026-02946-2},
pmid = {42601395},
pmcid = {PMC13476445}
}

RIS

TY - JOUR
AU - Strøm, Jesper
AU - Skjærbæk, Casper
AU - Bertelsen, Natasha Becker
AU - Simonsen, Steffen Torpe
AU - Okkels, Niels
AU - Bertram, David
AU - Röttgen, Sinah
AU - Kufer, Konstantin
AU - Mikkelsen, Kaare B
AU - Otto, Marit
AU - Jennum, Poul Jørgen
AU - Borghammer, Per
AU - Sommerauer, Michael
AU - Kidmose, Preben
TI - Fully-automated sleep staging for Parkinson's disease and isolated REM sleep behavior disorder
T2 - NPJ digital medicine
J2 - NPJ Digit Med
PY - 2026
DA - 2026/08/11
VL - 9
IS - 1
SP - 629
SN - 2398-6352
PB - Nature Publishing Group
DO - 10.1038/s41746-026-02946-2
UR - https://doi.org/10.1038/s41746-026-02946-2
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41746-026-02946-2",
"type": "article-journal",
"title": "Fully-automated sleep staging for Parkinson's disease and isolated REM sleep behavior disorder",
"container-title": "NPJ digital medicine",
"author": [
{
"family": "Strøm",
"given": "Jesper"
},
{
"family": "Skjærbæk",
"given": "Casper"
},
{
"family": "Bertelsen",
"given": "Natasha Becker"
},
{
"family": "Simonsen",
"given": "Steffen Torpe"
},
{
"family": "Okkels",
"given": "Niels"
},
{
"family": "Bertram",
"given": "David"
},
{
"family": "Röttgen",
"given": "Sinah"
},
{
"family": "Kufer",
"given": "Konstantin"
},
{
"family": "Mikkelsen",
"given": "Kaare B"
},
{
"family": "Otto",
"given": "Marit"
},
{
"family": "Jennum",
"given": "Poul Jørgen"
},
{
"family": "Borghammer",
"given": "Per"
},
{
"family": "Sommerauer",
"given": "Michael"
},
{
"family": "Kidmose",
"given": "Preben"
}
],
"container-title-short": "NPJ Digit Med",
"volume": "9",
"issue": "1",
"page": "629",
"DOI": "10.1038/s41746-026-02946-2",
"PMID": "42601395",
"PMCID": "PMC13476445",
"ISSN": "2398-6352",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41746-026-02946-2",
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
11
]
]
}
}

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.1002/mds.70265 [code]
Differential Progression of Neuroinflammation in Patients with Isolated Rapid-Eye-Movement Sleep Behavior Disorder.
Journal: Movement disorders : official journal of the Movement Disorder Society
In common: sleep disorders, Parkinson's, 2 references, 2 authors
[2] doi:10.1007/s12021-026-09803-3 [code]
NeuroFusion: A Unified Framework for Generalized Visual Stimulus Decoding from fMRI Across Datasets and Subjects.
Journal: Neuroinformatics
In common: MNE-BIDS, PyTorch Lightning, MNE-Python, 7 other tools
[3] doi:10.7554/elife.100605 [code]
Age-related changes in ‘cortical’ 1/f dynamics are linked to cardiac activity
Journal: n/a
In common: WFDB Python, MNE-BIDS, MNE-Python, 6 other tools
[4] doi:10.7554/elife.106543 [code]
Stimulus dependencies-rather than next-word prediction-can explain pre-onset brain encoding in naturalistic listening designs.
Journal: eLife
In common: MNE-BIDS, MNE-Python, h5py, 6 other tools
[5] 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: MNE-BIDS, MNE-Python, h5py, 6 other tools
[6] doi:10.1038/s42003-026-10957-8 [code]
Brain defence by the extracellular matrix protein Cochlin.
Journal: Communications biology
In common: WFDB Python, PyTorch Lightning, PyTorch, 5 other tools
[7] doi:10.1038/s41531-026-01412-w [code]
Network based statistics associates increased connectivity to REM sleep disorder and hallucinations in early DLB.
Journal: NPJ Parkinson's disease
In common: MNE-BIDS, MNE-Python, scikit-learn, 4 other tools, sleep disorders, Parkinson's
[8] doi:10.1093/bioinformatics/btag169 [code]
Bidirectional Mamba-2 boosts EEG super-resolution via regression and diffusion.
Journal: Bioinformatics (Oxford, England)
In common: PyTorch Lightning, MNE-Python, PyTorch, 5 other tools
[9] doi:10.1162/imag.a.1207 [code]
Investigating the temporal dynamics and modeling of mid-level feature representations in humans.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: PyTorch Lightning, MNE-Python, PyTorch, 5 other tools
[10] doi:10.1038/s41531-026-01380-1 [code]
Identifying maximal beta power from directional subthalamic local field potentials in Parkinson's disease.
Journal: NPJ Parkinson's disease
In common: MNE-BIDS, MNE-Python, scikit-learn, 4 other tools, Parkinson's

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.