OSCR

AnySleep: a channel-agnostic deep learning system for high-resolution sleep staging in multi-center cohorts.

Code ↔ Paper

20 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 20 matches
  1. [1] § Methods › High-frequency sleep stages › Analysis of subject characteristics ↔ scripts/high-freq/anysleep_mnc_nt1_sfs.ipynb, lines 121 to 241 · score 0.94 · RandomForestClassifier, class_weight, max_features, max_tree_depth, min_samples_leaf, min_samples_split · Report a mismatch
  2. [2] § Methods › High-frequency sleep stages › Analysis of subject characteristics ↔ scripts/high-freq/anysleep_cap_insomnia_sfs.ipynb, lines 105 to 224 · score 0.94 · RandomForestClassifier, class_weight, max_features, max_tree_depth, min_samples_leaf, min_samples_split · Report a mismatch
  3. [3] § Methods › Model ↔ scripts/final-figures/fig_6.ipynb, lines 1 to 76 · score 0.90 · channel encoder, network component, computational requirements, computational cost, late fusion, early fusion · Report a mismatch
  4. [4] § Methods › Model ↔ base/model/usleep.py, lines 37 to 148 · score 0.89 · style encoder decoder, skip connections, decoder block, encoder blocks, segment classifier, sleep stage predictions · Report a mismatch
  5. [5] § Methods › Model ↔ examples/anphy/usleep_no_hydra.py, lines 41 to 143 · score 0.89 · style encoder decoder, skip connections, decoder block, encoder blocks, segment classifier, sleep stage predictions · Report a mismatch
  6. [6] § Methods › Model ↔ base/model/anysleep_late_fusion.py, lines 182 to 278 · score 0.88 · weighted sum, hidden layer, channel attention module, feature map, attention weights, multi channel · Report a mismatch
  7. [7] § Methods › Model ↔ base/model/anysleep_late_fusion.py, lines 49 to 179 · score 0.87 · virtual channels, late fusion, channel attention modules, decoder block, encoder block, feature maps · Report a mismatch
  8. [8] § Methods › Model ↔ base/model/anysleep.py, lines 168 to 259 · score 0.86 · ReLU, weighted sum, hidden layer, attention weights, multi channel, MLP · Report a mismatch
  9. [9] § Results › High-frequency sleep staging capabilities ↔ scripts/arousals/predict_arousals_iou_f1_aasm_merged.ipynb, lines 1 to 120 · score 0.83 · IoU F1, 3–15 s, IoU scores, predicted arousals, short Wake, High frequency sleep · Report a mismatch
  10. [10] § Results › High-frequency sleep staging capabilities ↔ scripts/final-figures/hf_scores.py, lines 1 to 43 · score 0.83 · sleep stage transition, healthy controls, random forest, predict subject, High frequency sleep, sleep stage predictions · Report a mismatch
  11. [11] § Methods › Training ↔ base/training/clas_trainer.py, lines 20 to 48 · score 0.76 · cross entropy loss, macro F1 score, training epoch, gradient, Optimization, validation · Report a mismatch
  12. [12] § Methods › Model ↔ base/model/anysleep_early_fusion.py, lines 1 to 42 · score 0.71 · computational cost, early fusion, segment classifier, channel attention, variants, decoder · Report a mismatch
  13. [13] § Methods › High-frequency sleep stages › Arousal prediction ↔ scripts/arousals/predict_arousals_iou_f1_aasm_merged.ipynb, lines 1 to 120 · score 0.70 · continuous Wake predictions, 3–15 s, high frequency predictions, High frequency sleep, 3 s, arousals · Report a mismatch
  14. [14] § Results › High-frequency sleep staging capabilities ↔ scripts/final-figures/fig_2.py, lines 397 to 440 · score 0.68 · C4 CLE, class probabilities, raw EEG, minute, spectrogram, MASS · Report a mismatch
  15. [15] § Methods › High-frequency sleep stages › Arousal prediction ↔ scripts/arousals/predict_arousals_iou_f1_aasm_merged.ipynb, lines 202 to 233 · score 0.57 · Predicted arousals, IoU F1, Intersection, Union, overlapped · Report a mismatch
  16. [16] § Methods › Training ↔ base/data/anysleep_train_dataset.py, lines 234 to 290 · score 0.54 · random position, uniformly sampled, class, epoch, Training, sleep · Report a mismatch
  17. [17] § Methods › Training ↔ base/data/usleep_train_dataset.py, lines 161 to 217 · score 0.54 · random position, uniformly sampled, class, epoch, Training, sleep · Report a mismatch
  18. [18] § Methods › High-frequency sleep stages › Analysis of subject characteristics ↔ scripts/final-figures/fig_3.ipynb, lines 51 to 126 · score 0.53 · obstructive sleep apnea, narcolepsy, CAP, DODH, timescale, DODO · Report a mismatch
  19. [19] § Results › High-frequency sleep staging capabilities ↔ scripts/final-figures/fig_3.ipynb, lines 51 to 126 · score 0.51 · obstructive sleep apnea, narcolepsy, CAP, OSA, healthy, DODH · Report a mismatch
  20. [20] § Methods › High-frequency sleep stages › Analysis of subject characteristics ↔ scripts/final-figures/hf_scores.py, lines 1 to 43 · score 0.50 · temporal resolutions, predicted sleep stages, transitions, narcolepsy, CAP, triplets · 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

Jupyter notebook · 264 lines · 9.8 KB · MIT · 3 matches

  1. # %% [markdown]
  2. # # Arousal Detection Evaluation using High-Frequency Sleep Staging
  3. #
  4. # This notebook evaluates arousal detection performance by treating short wake episodes
  5. # predicted by high-frequency sleep staging models as arousal events.
  6. #
  7. # ## Overview
  8. #
  9. # Arousals are brief awakenings during sleep that disrupt sleep architecture. This notebook
  10. # tests whether high-frequency sleep stage predictions (with temporal resolution finer than
  11. # 30 seconds) can detect these events by identifying short wake periods.
  12. #
  13. # ## Method
  14. #
  15. # 1. **Load ground truth arousals** from MASS dataset annotation files (EDF format)
  16. # - Uses timing offsets from `mass_offsets.py` to align annotations with trimmed PSG data
  17. #
  18. # 2. **Load sleep stage predictions** from high-frequency model sweep
  19. # - Multiple temporal resolutions tested (1-3840 predictions per 30s epoch)
  20. #
  21. # 3. **Convert wake predictions to arousal events**
  22. # - Find continuous wake periods (sleep stage = 0)
  23. # - Merge nearby events (within 10% of merged duration, max 15s total)
  24. # - Filter by duration: 3-15 seconds (AASM arousal criteria)
  25. # - Require ≥10s of sleep before each arousal
  26. #
  27. # 4. **Evaluate using IoU-based metrics**
  28. # - Calculate Intersection over Union between predicted and ground truth arousals
  29. # - Compute precision, recall, F1 at multiple IoU thresholds (0.0 to 1.0)
  30. #
  31. # ## Outputs
  32. #
  33. # - `arousals_aasm_merged.json`: Predicted arousal events per model/resolution/subject
  34. # - `arousals_iou_scores_aasm_merged.json`: Precision/recall/F1 scores at each IoU threshold
  35. #
  36. # ## Dependencies
  37. #
  38. # - High-frequency prediction files from `predict-high-freq.py` sweep
  39. # %%
  40. import gc
  41. import glob
  42. import json
  43. from os.path import dirname
  44. import mne
  45. import numpy as np
  46. from scripts.arousals.mass_offsets import offsets
  47. def load_arousals(ann_file):
  48. # <Event channel="EEG C4-LER" groupName="MicroArousal" name="CARSM expert" scoringType="expert"/>
  49. data = mne.io.read_raw_edf(ann_file, verbose=False)
  50. s_id = ann_file.split("/")[-1].split(" ")[0]
  51. arousals = [
  52. (ann["onset"], ann["onset"] + ann["duration"])
  53. for ann in data.annotations
  54. if "MicroArousal" in ann["description"]
  55. ]
  56. channels = [
  57. ann["description"][ann["description"].find("channel") + 9:ann["description"].find("groupName") - 2]
  58. for ann in data.annotations
  59. if "MicroArousal" in ann["description"]
  60. ]
  61. if len(arousals) == 0:
  62. return arousals
  63. arousals = np.array([list(ar) + [ch] for ar, ch in zip(arousals, channels) if ch.startswith("EEG")])
  64. arousals[:, :2] = arousals[:, :2].astype(float) - offsets[f"mass-c{s_id.split('-')[1][1]}"][s_id]
  65. return arousals
  66. def load_hf_sleep_stages(sweep_folder):
  67. labels_glob = f"{sweep_folder}/*/labels.npz"
  68. preds_glob = f"{sweep_folder}/*/predictions.npz"
  69. labels_files = sorted(glob.glob(labels_glob), key=lambda x: int(x.split("/")[-2]))
  70. preds_files = sorted(glob.glob(preds_glob), key=lambda x: int(x.split("/")[-2]))
  71. labels_per_sr_per_model = {}
  72. preds_per_sr_per_model = {}
  73. for label_file, pred_file in zip(labels_files, preds_files):
  74. with open(dirname(label_file) + "/predict-high-freq.log") as f:
  75. lines = f.readlines()
  76. sr_line = [line for line in lines if "sleep_stage_frequency" in line][0]
  77. sleep_stage_sr = int(sr_line.split("=")[1])
  78. model_line = [line for line in lines if "model.path" in line][0]
  79. model = model_line.split("=")[1]
  80. if model not in labels_per_sr_per_model:
  81. labels_per_sr_per_model[model] = {}
  82. preds_per_sr_per_model[model] = {}
  83. labels_per_sr_per_model[model][sleep_stage_sr] = np.load(label_file)
  84. preds_per_sr_per_model[model][sleep_stage_sr] = np.load(pred_file)
  85. return labels_per_sr_per_model, preds_per_sr_per_model
  86. # TODO: replace with path to MASS data
  87. arousal_files = glob.glob("path/to/MASS/*Annotations.edf")
  88. all_arousals = {}
  89. for af in arousal_files:
  90. s_id = af.split('/')[-1].split(' ')[0]
  91. print(f"Processing {s_id}")
  92. arousals = load_arousals(af)
  93. all_arousals[s_id] = arousals
  94. if len(arousals) == 0:
  95. print(f"No arousals found in {af}")
  96. continue
  97. # check if theres overlap between arousals
  98. arousals = arousals[np.argsort(arousals[:, 0].astype(float))]
  99. overlap_mask = (arousals[1:, 0].astype(float) < arousals[:-1, 1].astype(float))
  100. if np.any(overlap_mask):
  101. print(f"Overlapping arousals found in {af}")
  102. print(arousals[np.r_[overlap_mask, False]])
  103. print(arousals[np.r_[False, overlap_mask]])
  104. gc.collect()
  105. # %%
  106. def merge_arousals(arousals, max_after_merge_dur=15, max_merge_dist_perc=0.1):
  107. if len(arousals) == 0:
  108. return np.array(arousals)
  109. # Sort events by start time to ensure "consecutive" logic is correct.
  110. sorted_events = sorted(arousals, key=lambda x: x[0])
  111. merged_events = [sorted_events[0]]
  112. n_merges = 0
  113. for current_event in sorted_events[1:]:
  114. last_merged_event = merged_events[-1]
  115. merged_duration = current_event[1] - last_merged_event[0]
  116. distance = current_event[0] - last_merged_event[1]
  117. if (merged_duration <= max_after_merge_dur and
  118. distance <= merged_duration * max_merge_dist_perc):
  119. merged_events[-1][1] = current_event[1]
  120. n_merges += 1
  121. else:
  122. merged_events.append(current_event)
  123. print(f"Merged {n_merges} arousals, remaining {len(merged_events)}")
  124. return np.array(merged_events)
  125. # %%
  126. pred_arousals = {}
  127. # {sleep_stage_sr: {wake_length: {s_id: arousals}}}
  128. hf_ss_sweep_folder = "../../logs/exp002/exp002a/sweep-2025-07-28_19-56-55_mass/"
  129. _, hf_ss = load_hf_sleep_stages(hf_ss_sweep_folder)
  130. for model in hf_ss.keys():
  131. pred_arousals[model] = {}
  132. for ss_sr in hf_ss[model].keys():
  133. pred_arousals[model][ss_sr] = {}
  134. lower_wake_length = 3
  135. upper_wake_length = 15
  136. pred_arousals[model][ss_sr] = {}
  137. print(f"Processing {ss_sr} {lower_wake_length} {upper_wake_length}")
  138. for s_id_ss in hf_ss[model][ss_sr].keys():
  139. hf_ss_sr = hf_ss[model][ss_sr][s_id_ss]
  140. # get continuous wake sleep stages of at least lower_wake_length and at most upper_wake_length
  141. wake_mask = hf_ss_sr == 0
  142. wake_borders = np.diff(wake_mask, prepend=0, append=0)
  143. wake_starts = np.where(wake_borders == 1)[0]
  144. wake_ends = np.where(wake_borders == -1)[0]
  145. assert len(wake_starts) == len(wake_ends)
  146. if len(wake_starts) == 0:
  147. continue
  148. arousals = np.column_stack((wake_starts, wake_ends)) / ss_sr * 30
  149. arousals = merge_arousals(arousals)
  150. # remove wake events with less than 10s of sleep before
  151. sleep_before_lengths = (arousals[:, 0] - np.r_[0, arousals[:-1, 1]])
  152. arousals = arousals[sleep_before_lengths >= 10]
  153. wake_lengths = arousals[:, 1] - arousals[:, 0]
  154. arousals = arousals[(lower_wake_length <= wake_lengths) & (wake_lengths <= upper_wake_length)]
  155. pred_arousals[model][ss_sr][s_id_ss] = arousals
  156. # %%
  157. # JSON serializer for numpy arrays
  158. class NumpyArrayEncoder(json.JSONEncoder):
  159. def default(self, obj):
  160. if isinstance(obj, np.ndarray):
  161. return obj.tolist()
  162. return super(NumpyArrayEncoder, self).default(obj)
  163. with open('arousals_aasm_merged.json', 'w') as f:
  164. json.dump(pred_arousals, f, cls=NumpyArrayEncoder)
  165. # %%
  166. def calc_tp_fp_fn(gt_arousals, pred_arousals, overlap_thresholds):
  167. tp, fp = [0] * len(overlap_thresholds), [0] * len(overlap_thresholds)
  168. if len(gt_arousals) > 0:
  169. gt_arousals = gt_arousals[:, :2].astype(float)
  170. used_gt_ar = [np.zeros(len(gt_arousals))] * len(overlap_thresholds)
  171. gt_start = 0
  172. for pred_s in pred_arousals:
  173. intersects = [0] * len(gt_arousals)
  174. unions = [0] * len(gt_arousals)
  175. for gt_i in range(gt_start, len(gt_arousals)):
  176. gt_s = gt_arousals[gt_i]
  177. if pred_s[1] < gt_s[0]:
  178. break
  179. if pred_s[0] > gt_s[1]:
  180. gt_start = gt_i + 1
  181. continue
  182. intersects[gt_i] = min(gt_s[1], pred_s[1]) - max(gt_s[0], pred_s[0])
  183. unions[gt_i] = max(gt_s[1], pred_s[1]) - min(gt_s[0], pred_s[0])
  184. ious = [intersects[i] / unions[i] if unions[i] > 0 else 0
  185. for i in range(len(intersects))]
  186. for i, ovt in enumerate(overlap_thresholds):
  187. if len(ious) > 0 and max(ious) > ovt:
  188. tp[i] += 1
  189. used_gt_ar[i][np.argmax(ious)] = 1
  190. else:
  191. fp[i] += 1
  192. fn = [len(gt_arousals) - np.sum(used_gt_ar[i]) for i in range(len(overlap_thresholds))]
  193. return np.array(tp), np.array(fp), np.array(fn)
  194. # %%
  195. overlap_thresholds = np.linspace(0, 1, 11)
  196. scores = {}
  197. for model in pred_arousals.keys():
  198. scores[model] = {}
  199. for ss_sr in pred_arousals[model].keys():
  200. scores[model][ss_sr] = {}
  201. lower_wake_length = 3
  202. upper_wake_length = 15
  203. print(f"Processing {ss_sr} {lower_wake_length} {upper_wake_length}")
  204. for s_id_ss in pred_arousals[model][ss_sr].keys():
  205. pred_ar = pred_arousals[model][ss_sr][s_id_ss]
  206. gt_ar = all_arousals[s_id_ss.split('_')[1]]
  207. tp, fp, fn = calc_tp_fp_fn(gt_ar, pred_ar, overlap_thresholds)
  208. prec = [tp[i] / (tp[i] + fp[i]) if tp[i] + fp[i] > 0 else 0 for i in range(len(overlap_thresholds))]
  209. rec = [tp[i] / (tp[i] + fn[i]) if tp[i] + fn[i] > 0 else 0 for i in range(len(overlap_thresholds))]
  210. f1 = [2 * tp[i] / (2 * tp[i] + fp[i] + fn[i]) if tp[i] + fp[i] + fn[i] > 0 else 0
  211. for i in range(len(overlap_thresholds))]
  212. scores[model][ss_sr][s_id_ss] = {"prec": prec, "rec": rec, "f1": f1}
  213. # %%
  214. # save f1s to json
  215. with open('arousals_iou_scores_aasm_merged.json', 'w') as f:
  216. json.dump(scores, f)

predict_arousals_iou_f1_aasm_merged.ipynb at commit bf32fa7, under MIT · at the source

Overview

Authors: Niklas Grieger1,2,3, Jannik Raskob1,3, Siamak Mehrkanoon2, Stephan Bialonski1,3
  1. Department of Medical Engineering and Technomathematics, FH Aachen University of Applied Sciences, Jülich, Germany
  2. Department of Information and Computing Sciences, Utrecht University, Utrecht, The Netherlands
  3. Institute for Data-Driven Technologies, FH Aachen University of Applied Sciences, Jülich, Germany
Institutions: Utrecht University (Netherlands); FH Aachen (Germany)
Journal: NPJ digital medicine, volume 9, issue 1, article 829
Dates: received 17 December 2025; accepted 3 October 2026; published online 30 October 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1038/s41746-026-03406-7 · PMID 42963354 · PMCID PMC13722680 · OpenAlex W4417473717
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: EEG (modality), human (organism), sleep disorders (population)
Methods: Spectral & time-frequency, Connectivity, Machine learning, Physiology & signal measures
Keywords: Biomarkers, Computational biology and bioinformatics, Engineering, Neuroscience
Topic: EEG and Brain-Computer Interfaces (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: American Sleep Medicine Foundation (38-PM-07); University of Minnesota (U01HL64360, U01HL53941, U01HL53940, 75N92019R002, U01HL539 31, U01HL53938, U01HL53934, R24 HL114473, U01HL53937, U01HL63463, U01HL53916); University of Washington (U01HL53941, U01HL53938, 75N92019R002, U01HL53940, U01HL63463, U01HL53916, R24 HL114473, U01HL53931, U01HL53934); Johns Hopkins University (U01-HL53938, U01HL53937, R24 HL114473, U01HL53916, U01HL63463, U01HL53941, U01HL64360, 75N92019R002, N01-HC-95162, U01HL53931, U01HL53940, U01HL53934); Case Western Reserve University (U01HL63463, UL1RR024989, U01HL53934, U01HL53931, U01HL53916, U01HL53938, U01HL53940, 75N92019R002, R24 HL114473, U01HL53941); York University; National Institutes of Health (UL1TR001420, N01-HC- 95166, RO1‐46380, N01-HC9-5168, N01-HC- 95159, UL1TR001079, HHSN268201500003I, 75N92019R002, UL1TR000040, UL1-TR, N01‐HC‐95161, N01- HC-95163, N01- HC-95165, N01‐HC‐95160, N01 HC95164, N01-HC-95167, N01-HC95162, N01‐HC‐95169, M01 RR00080- 39, AG05407, U01HL53940, U01HL53934, HL40489, RR024989, AG05394); University of California, Davis (U01HL53941, U01HL53931, R24 HL114473, 75N92019R002, U01HL53940, U01HL53938, U01HL53916, U01HL63463, U01HL53934); National Institute on Aging (R01AG005394, R01AG021918, R01AG008415, R01AG027576, R01AG026720); National Heart, Lung, and Blood Institute (U01 HL 53940, U01HL53938, N01 HC-95159, N01-HC-95160, R01HL070847, R01HL098433, N01 HC-95168, U01HL053941, R01HL070839, N01 HC95167, (N01-HC-95163, U01HL053938, U01 HL53934, R24HL114473, N01 HC-95161, U01HL083129, N01 HC95165, N01HC95164, U01HL053937, R01HL046380, U01 HL 53941, U01 HL53916, U01HL053931, HL098433, HL114473, T32HL007567, U01HL064360, U01HL053916, HHSN26820150 0003I, U01 HL53931, R01HL070838, N01‐HC‐95166, U01HL64360, R01HL070841, R01HL070848, R01HL071194, R01HL106410, U01HL083075, R01HL070837, N01 HC-95162, HL070848, K24HL127307, R01HL070842, HL070839, 75N 92019R002, U01HL63463, U01-HL53937, N01 HC95169); National Institute of Arthritis and Musculoskeletal and Skin Diseases (R01AR035584, R01AR035582, R01AR035583); National Center for Advancing Translational Sciences (M01RR000080, UL1RR024989, UL1RR024134, RR024989, N01-HC-95161, U01HL64360, N01-HC-95168, U01HL53916, UL1-TR, N01-HC-95162, N01-HC-95159, U01HL53938, U01HL53937, N01-HC-95160, HHSN268201500003I, N01-HC-95166, N01-HC-95169, N01-HC-95163, U01HL53931, N01-HC-95167, N01-HC-95165, U01HL53934, N01-HC-95164, U01HL53941, U01HL53940)
Citations: not cited yet (Europe PMC); 85 references in the paper

Abstract

Sleep is essential for health, yet studying its dynamics requires manual sleep staging, a labor-intensive step in research and clinical care. Across centers, polysomnography (PSG) recordings are traditionally scored in 30-s epochs for pragmatic, not physiological, reasons and vary in electrode count, montage, and subject characteristics. These constraints challenge harmonized multi-center studies and the discovery of robust biomarkers on shorter timescales. We present AnySleep, a deep neural network that scores sleep from any electroencephalography (EEG) or electrooculography (EOG) data at adjustable temporal resolutions. We trained and validated the model on over 20,000 overnight recordings (>200,000 h of EEG and EOG) from 28 datasets across multiple clinics to promote robust generalization across sites. The model attains state-of-the-art performance and surpasses or equals established baselines at 30-s epochs. Performance improves with more channels, yet remains strong when EOG is absent, or only EOG or single EEG derivations (frontal, central, or occipital) are available. On sub-30-s timescales, the model captures short wake intrusions consistent with arousals and improves the prediction of pathophysiological conditions (obstructive sleep apnea, narcolepsy type 1, insomnia) over 30-s scoring. We make the model publicly available to facilitate large-scale studies with heterogeneous electrode setups and accelerate biomarker discovery in sleep.

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

Repositories

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

dslaborg/AnySleep

License: MIT
State: the link answers, verified on 1 November 2026
Evidence: files inventoried
Commit: bf32fa7cd1b9a3aef9bcc54d5d82c109da5b2de9, 30 October 2026
Languages: Python (61), Jupyter (33)
Size: 1,801 files, 94 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README, license file, environment (requirements.txt), 33 notebooks
Not found: CITATION.cff, tests, continuous integration, documentation
Tools: NumPy (77 files), PyTorch (41 files), Matplotlib (25 files), scikit-learn (25 files), SciPy (15 files), MNE-Python (12 files), pandas (5 files), h5py (1 file), seaborn (1 file)
Availability: 1 check, the latest on 1 November 2026: the link answers
  • 1 November 2026: the link answers
96 files

Zenodo 23764134

License: MIT
State: the link answers, verified on 1 November 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: DataCite
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 1 November 2026: the link answers (HTTP 200)
  • 1 November 2026: the link answers (HTTP 200)

Zenodo 23764135

License: MIT
State: the link answers, verified on 1 November 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: DataCite
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 1 November 2026: the link answers (HTTP 200)
  • 1 November 2026: the link answers (HTTP 200)

Code availability

The underlying code, trained model files, and training, validation, and test data splits for this study are available on GitHub and can be accessed via this link: https://github.com/dslaborg/AnySleep. Further instructions on how to reproduce our main experiments and evaluate our trained models on custom datasets are also provided there. The software is based on PyTorch (version 2.5.1, https://pytorch.org/). All models were trained on an NVIDIA DGX A100 workstation equipped with eight NVIDIA A100 GPUs.

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:

  • 3 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 94 scripts, each with its path and the digest of its content;
  • 20 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

Data Availability Statement

All datasets analyzed during the current study are publicly available. In the following, we list the datasets and the URLs to access them: ABC (https://doi.org/10.25822/nx52-bc11), CCSHS (https://doi.org/10.25822/cg2n-4y91), CFS (https://doi.org/10.25822/jmyx-mz90), CHAT (https://doi.org/10.25822/d68d-8g03), DCSM (https://doi.org/10.17894/ucph.282d3c1e-9b98-4c1e-886e-704afdfa9179), HPAP (https://doi.org/10.25822/xmwv-yz91), MESA (https://doi.org/10.25822/n7hq-c406), MrOS (https://doi.org/10.25822/kc27-0425), Phys (https://doi.org/10.13026/6phb-r450), SEDF-ST and SEDF-SC (https://doi.org/10.13026/C2X676), SHHS (https://doi.org/10.25822/ghy8-ks59), SOF (https://doi.org/10.25822/e1cf-rx65), DODO and DODH (https://doi.org/10.5281/zenodo.15900394), ISRUC SG 1–3 (https://sleeptight.isr.uc.pt/), MASS C1 and C3 (https://doi.org/10.5683/SP3/OVISPE and https://doi.org/10.5683/SP3/9MYUCS), SVUH (https://doi.org/10.13026/C26C7D), CNC, DHC, FHC, IHC, KHC, and SSC (https://stanfordmedicine.app.box.com/s/r9e92ygq0erf7hn5re6j51aaggf50jly), CAP (https://doi.org/10.13026/C2VC79), ANPHY (used in the Supplementary Materials; https://doi.org/10.17605/OSF.IO/R26FH). Information about excluded recordings and the used data split is provided in our GitHub repository: https://github.com/dslaborg/AnySleep.

The underlying code, trained model files, and training, validation, and test data splits for this study are available on GitHub and can be accessed via this link: https://github.com/dslaborg/AnySleep. Further instructions on how to reproduce our main experiments and evaluate our trained models on custom datasets are also provided there. The software is based on PyTorch (version 2.5.1, https://pytorch.org/). All models were trained on an NVIDIA DGX A100 workstation equipped with eight NVIDIA A100 GPUs.

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 1, 1 November 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 4 keywords, 12 funders, 79 references.

Cite

This paper

Grieger, N., Raskob, J., Mehrkanoon, S., & Bialonski, S. (2026). AnySleep: a channel-agnostic deep learning system for high-resolution sleep staging in multi-center cohorts. NPJ digital medicine, 9(1), 829. https://doi.org/10.1038/s41746-026-03406-7

BibTeX

@article{grieger2026anysleep,
author = {Grieger, Niklas and Raskob, Jannik and Mehrkanoon, Siamak and Bialonski, Stephan},
title = {{AnySleep: a channel-agnostic deep learning system for high-resolution sleep staging in multi-center cohorts}},
journal = {NPJ digital medicine},
year = {2026},
month = oct,
volume = {9},
number = {1},
pages = {829},
publisher = {Nature Publishing Group},
issn = {2398-6352},
doi = {10.1038/s41746-026-03406-7},
url = {https://doi.org/10.1038/s41746-026-03406-7},
pmid = {42963354},
pmcid = {PMC13722680}
}

RIS

TY - JOUR
AU - Grieger, Niklas
AU - Raskob, Jannik
AU - Mehrkanoon, Siamak
AU - Bialonski, Stephan
TI - AnySleep: a channel-agnostic deep learning system for high-resolution sleep staging in multi-center cohorts
T2 - NPJ digital medicine
J2 - NPJ Digit Med
PY - 2026
DA - 2026/10/30
VL - 9
IS - 1
SP - 829
SN - 2398-6352
PB - Nature Publishing Group
DO - 10.1038/s41746-026-03406-7
UR - https://doi.org/10.1038/s41746-026-03406-7
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41746-026-03406-7",
"type": "article-journal",
"title": "AnySleep: a channel-agnostic deep learning system for high-resolution sleep staging in multi-center cohorts",
"container-title": "NPJ digital medicine",
"author": [
{
"family": "Grieger",
"given": "Niklas"
},
{
"family": "Raskob",
"given": "Jannik"
},
{
"family": "Mehrkanoon",
"given": "Siamak"
},
{
"family": "Bialonski",
"given": "Stephan"
}
],
"container-title-short": "NPJ Digit Med",
"volume": "9",
"issue": "1",
"page": "829",
"DOI": "10.1038/s41746-026-03406-7",
"PMID": "42963354",
"PMCID": "PMC13722680",
"ISSN": "2398-6352",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41746-026-03406-7",
"language": "en",
"issued": {
"date-parts": [
[
2026,
10,
30
]
]
}
}

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/s41746-025-02237-2 [code]
SLEEPYLAND: trust begins with fair evaluation of automatic sleep staging models.
Journal: NPJ digital medicine
In common: MNE-Python, h5py, scikit-learn, 4 other tools, 21 references
[2] doi:10.1038/s41746-023-00784-0 [code]
U-Sleep's resilience to AASM guidelines.
Journal: NPJ digital medicine
In common: h5py, scikit-learn, pandas, 3 other tools, 19 references
[3] doi:10.3389/fnins.2023.1176551 [code]
A two-branch trade-off neural network for balanced scoring sleep stages on multiple cohorts.
Journal: Frontiers in neuroscience
In common: MNE-Python, h5py, PyTorch, 6 other tools, 13 references
[4] doi:10.1038/s41746-022-00630-9 [code]
Age estimation from sleep studies using deep learning predicts life expectancy.
Journal: NPJ digital medicine
In common: h5py, PyTorch, seaborn, 5 other tools, 10 references
[5] doi:10.2147/nss.s463495 [code]
Brain Age Estimation from Overnight Sleep Electroencephalography with Multi-Flow Sequence Learning.
Journal: Nature and science of sleep
In common: MNE-Python, PyTorch, scikit-learn, 2 other tools, EEG, 10 references
[6] doi:10.1111/jsr.14362 [code]
Retrospective validation of automatic sleep analysis with grey areas model for human-in-the-loop scoring approach.
Journal: Journal of sleep research
In common: h5py, pandas, SciPy, 1 other tool, EEG, 11 references
[7] doi:10.1038/s41598-023-50736-7 [code]
A robust deep learning detector for sleep spindles and K-complexes: towards population norms.
Journal: Scientific reports
In common: pandas, SciPy, Matplotlib, 1 other tool, EEG, 11 references
[8] doi:10.1371/journal.pcbi.1011793 [code]
Somnotate: A probabilistic sleep stage classifier for studying vigilance state transitions.
Journal: PLoS computational biology
In common: scikit-learn, pandas, SciPy, 2 other tools, EEG, 10 references
[9] doi:10.1016/j.patter.2025.101367 [code]
AISleep: Automated and interpretable sleep staging from single-channel EEG data.
Journal: Patterns (New York, N.Y.)
In common: MNE-Python, scikit-learn, pandas, 3 other tools, DOI 10.13026/c2x676, EEG, 6 references
[10] doi:10.3389/fphys.2023.1287342 [code]
Deep transfer learning for automated single-lead EEG sleep staging with channel and population mismatches.
Journal: Frontiers in physiology
In common: MNE-Python, scikit-learn, pandas, 2 other tools, sleep disorders, EEG, 7 references

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.1038/s41746-026-03406-7.svg)](https://openscicode.org/badge/doi/10.1038/s41746-026-03406-7)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1038/s41746-026-03406-7.svg
   :target: https://openscicode.org/badge/doi/10.1038/s41746-026-03406-7
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s41746-026-03406-7"><img src="https://openscicode.org/badge/doi/10.1038/s41746-026-03406-7.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

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.