AnySleep: a channel-agnostic deep learning system for high-resolution sleep staging in multi-center cohorts.
The 20 matches
- [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] § 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] § 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] § 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] § 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] § 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] § 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] § 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] § 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] § 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] § 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] § 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] § 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] § 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] § 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] § 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] § 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] § 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] § 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] § 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
- # %% [markdown]
- # # Arousal Detection Evaluation using High-Frequency Sleep Staging
- #
- # This notebook evaluates arousal detection performance by treating short wake episodes
- # predicted by high-frequency sleep staging models as arousal events.
- #
- # ## Overview
- #
- # Arousals are brief awakenings during sleep that disrupt sleep architecture. This notebook
- # tests whether high-frequency sleep stage predictions (with temporal resolution finer than
- # 30 seconds) can detect these events by identifying short wake periods.
- #
- # ## Method
- #
- # 1. **Load ground truth arousals** from MASS dataset annotation files (EDF format)
- # - Uses timing offsets from `mass_offsets.py` to align annotations with trimmed PSG data
- #
- # 2. **Load sleep stage predictions** from high-frequency model sweep
- # - Multiple temporal resolutions tested (1-3840 predictions per 30s epoch)
- #
- # 3. **Convert wake predictions to arousal events**
- # - Find continuous wake periods (sleep stage = 0)
- # - Merge nearby events (within 10% of merged duration, max 15s total)
- # - Filter by duration: 3-15 seconds (AASM arousal criteria)
- # - Require ≥10s of sleep before each arousal
- #
- # 4. **Evaluate using IoU-based metrics**
- # - Calculate Intersection over Union between predicted and ground truth arousals
- # - Compute precision, recall, F1 at multiple IoU thresholds (0.0 to 1.0)
- #
- # ## Outputs
- #
- # - `arousals_aasm_merged.json`: Predicted arousal events per model/resolution/subject
- # - `arousals_iou_scores_aasm_merged.json`: Precision/recall/F1 scores at each IoU threshold
- #
- # ## Dependencies
- #
- # - High-frequency prediction files from `predict-high-freq.py` sweep
- # %%
- import gc
- import glob
- import json
- from os.path import dirname
- import mne
- import numpy as np
- from scripts.arousals.mass_offsets import offsets
- def load_arousals(ann_file):
- # <Event channel="EEG C4-LER" groupName="MicroArousal" name="CARSM expert" scoringType="expert"/>
- data = mne.io.read_raw_edf(ann_file, verbose=False)
- s_id = ann_file.split("/")[-1].split(" ")[0]
- arousals = [
- (ann["onset"], ann["onset"] + ann["duration"])
- for ann in data.annotations
- if "MicroArousal" in ann["description"]
- ]
- channels = [
- ann["description"][ann["description"].find("channel") + 9:ann["description"].find("groupName") - 2]
- for ann in data.annotations
- if "MicroArousal" in ann["description"]
- ]
- if len(arousals) == 0:
- return arousals
- arousals = np.array([list(ar) + [ch] for ar, ch in zip(arousals, channels) if ch.startswith("EEG")])
- arousals[:, :2] = arousals[:, :2].astype(float) - offsets[f"mass-c{s_id.split('-')[1][1]}"][s_id]
- return arousals
- def load_hf_sleep_stages(sweep_folder):
- labels_glob = f"{sweep_folder}/*/labels.npz"
- preds_glob = f"{sweep_folder}/*/predictions.npz"
- labels_files = sorted(glob.glob(labels_glob), key=lambda x: int(x.split("/")[-2]))
- preds_files = sorted(glob.glob(preds_glob), key=lambda x: int(x.split("/")[-2]))
- labels_per_sr_per_model = {}
- preds_per_sr_per_model = {}
- for label_file, pred_file in zip(labels_files, preds_files):
- with open(dirname(label_file) + "/predict-high-freq.log") as f:
- lines = f.readlines()
- sr_line = [line for line in lines if "sleep_stage_frequency" in line][0]
- sleep_stage_sr = int(sr_line.split("=")[1])
- model_line = [line for line in lines if "model.path" in line][0]
- model = model_line.split("=")[1]
- if model not in labels_per_sr_per_model:
- labels_per_sr_per_model[model] = {}
- preds_per_sr_per_model[model] = {}
- labels_per_sr_per_model[model][sleep_stage_sr] = np.load(label_file)
- preds_per_sr_per_model[model][sleep_stage_sr] = np.load(pred_file)
- return labels_per_sr_per_model, preds_per_sr_per_model
- # TODO: replace with path to MASS data
- arousal_files = glob.glob("path/to/MASS/*Annotations.edf")
- all_arousals = {}
- for af in arousal_files:
- s_id = af.split('/')[-1].split(' ')[0]
- print(f"Processing {s_id}")
- arousals = load_arousals(af)
- all_arousals[s_id] = arousals
- if len(arousals) == 0:
- print(f"No arousals found in {af}")
- continue
- # check if theres overlap between arousals
- arousals = arousals[np.argsort(arousals[:, 0].astype(float))]
- overlap_mask = (arousals[1:, 0].astype(float) < arousals[:-1, 1].astype(float))
- if np.any(overlap_mask):
- print(f"Overlapping arousals found in {af}")
- print(arousals[np.r_[overlap_mask, False]])
- print(arousals[np.r_[False, overlap_mask]])
- gc.collect()
- # %%
- def merge_arousals(arousals, max_after_merge_dur=15, max_merge_dist_perc=0.1):
- if len(arousals) == 0:
- return np.array(arousals)
- # Sort events by start time to ensure "consecutive" logic is correct.
- sorted_events = sorted(arousals, key=lambda x: x[0])
- merged_events = [sorted_events[0]]
- n_merges = 0
- for current_event in sorted_events[1:]:
- last_merged_event = merged_events[-1]
- merged_duration = current_event[1] - last_merged_event[0]
- distance = current_event[0] - last_merged_event[1]
- if (merged_duration <= max_after_merge_dur and
- distance <= merged_duration * max_merge_dist_perc):
- merged_events[-1][1] = current_event[1]
- n_merges += 1
- else:
- merged_events.append(current_event)
- print(f"Merged {n_merges} arousals, remaining {len(merged_events)}")
- return np.array(merged_events)
- # %%
- pred_arousals = {}
- # {sleep_stage_sr: {wake_length: {s_id: arousals}}}
- hf_ss_sweep_folder = "../../logs/exp002/exp002a/sweep-2025-07-28_19-56-55_mass/"
- _, hf_ss = load_hf_sleep_stages(hf_ss_sweep_folder)
- for model in hf_ss.keys():
- pred_arousals[model] = {}
- for ss_sr in hf_ss[model].keys():
- pred_arousals[model][ss_sr] = {}
- lower_wake_length = 3
- upper_wake_length = 15
- pred_arousals[model][ss_sr] = {}
- print(f"Processing {ss_sr} {lower_wake_length} {upper_wake_length}")
- for s_id_ss in hf_ss[model][ss_sr].keys():
- hf_ss_sr = hf_ss[model][ss_sr][s_id_ss]
- # get continuous wake sleep stages of at least lower_wake_length and at most upper_wake_length
- wake_mask = hf_ss_sr == 0
- wake_borders = np.diff(wake_mask, prepend=0, append=0)
- wake_starts = np.where(wake_borders == 1)[0]
- wake_ends = np.where(wake_borders == -1)[0]
- assert len(wake_starts) == len(wake_ends)
- if len(wake_starts) == 0:
- continue
- arousals = np.column_stack((wake_starts, wake_ends)) / ss_sr * 30
- arousals = merge_arousals(arousals)
- # remove wake events with less than 10s of sleep before
- sleep_before_lengths = (arousals[:, 0] - np.r_[0, arousals[:-1, 1]])
- arousals = arousals[sleep_before_lengths >= 10]
- wake_lengths = arousals[:, 1] - arousals[:, 0]
- arousals = arousals[(lower_wake_length <= wake_lengths) & (wake_lengths <= upper_wake_length)]
- pred_arousals[model][ss_sr][s_id_ss] = arousals
- # %%
- # JSON serializer for numpy arrays
- class NumpyArrayEncoder(json.JSONEncoder):
- def default(self, obj):
- if isinstance(obj, np.ndarray):
- return obj.tolist()
- return super(NumpyArrayEncoder, self).default(obj)
- with open('arousals_aasm_merged.json', 'w') as f:
- json.dump(pred_arousals, f, cls=NumpyArrayEncoder)
- # %%
- def calc_tp_fp_fn(gt_arousals, pred_arousals, overlap_thresholds):
- tp, fp = [0] * len(overlap_thresholds), [0] * len(overlap_thresholds)
- if len(gt_arousals) > 0:
- gt_arousals = gt_arousals[:, :2].astype(float)
- used_gt_ar = [np.zeros(len(gt_arousals))] * len(overlap_thresholds)
- gt_start = 0
- for pred_s in pred_arousals:
- intersects = [0] * len(gt_arousals)
- unions = [0] * len(gt_arousals)
- for gt_i in range(gt_start, len(gt_arousals)):
- gt_s = gt_arousals[gt_i]
- if pred_s[1] < gt_s[0]:
- break
- if pred_s[0] > gt_s[1]:
- gt_start = gt_i + 1
- continue
- intersects[gt_i] = min(gt_s[1], pred_s[1]) - max(gt_s[0], pred_s[0])
- unions[gt_i] = max(gt_s[1], pred_s[1]) - min(gt_s[0], pred_s[0])
- ious = [intersects[i] / unions[i] if unions[i] > 0 else 0
- for i in range(len(intersects))]
- for i, ovt in enumerate(overlap_thresholds):
- if len(ious) > 0 and max(ious) > ovt:
- tp[i] += 1
- used_gt_ar[i][np.argmax(ious)] = 1
- else:
- fp[i] += 1
- fn = [len(gt_arousals) - np.sum(used_gt_ar[i]) for i in range(len(overlap_thresholds))]
- return np.array(tp), np.array(fp), np.array(fn)
- # %%
- overlap_thresholds = np.linspace(0, 1, 11)
- scores = {}
- for model in pred_arousals.keys():
- scores[model] = {}
- for ss_sr in pred_arousals[model].keys():
- scores[model][ss_sr] = {}
- lower_wake_length = 3
- upper_wake_length = 15
- print(f"Processing {ss_sr} {lower_wake_length} {upper_wake_length}")
- for s_id_ss in pred_arousals[model][ss_sr].keys():
- pred_ar = pred_arousals[model][ss_sr][s_id_ss]
- gt_ar = all_arousals[s_id_ss.split('_')[1]]
- tp, fp, fn = calc_tp_fp_fn(gt_ar, pred_ar, overlap_thresholds)
- prec = [tp[i] / (tp[i] + fp[i]) if tp[i] + fp[i] > 0 else 0 for i in range(len(overlap_thresholds))]
- rec = [tp[i] / (tp[i] + fn[i]) if tp[i] + fn[i] > 0 else 0 for i in range(len(overlap_thresholds))]
- f1 = [2 * tp[i] / (2 * tp[i] + fp[i] + fn[i]) if tp[i] + fp[i] + fn[i] > 0 else 0
- for i in range(len(overlap_thresholds))]
- scores[model][ss_sr][s_id_ss] = {"prec": prec, "rec": rec, "f1": f1}
- # %%
- # save f1s to json
- with open('arousals_iou_scores_aasm_merged.json', 'w') as f:
- json.dump(scores, f)
predict_arousals_iou_f1_aasm_merged.ipynb at commit bf32fa7, under MIT · at the source
Overview
- Department of Medical Engineering and Technomathematics, FH Aachen University of Applied Sciences, Jülich, Germany
- Department of Information and Computing Sciences, Utrecht University, Utrecht, The Netherlands
- Institute for Data-Driven Technologies, FH Aachen University of Applied Sciences, Jülich, Germany
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
bf32fa7cd1b9a3aef9bcc54d5d82c109da5b2de9, 30 October 2026Availability: 1 check, the latest on 1 November 2026: the link answers
- 1 November 2026: the link answers
96 files
- base/
__init__.py , Python, 1 line - base/
config.py , Python, 81 lines - base/
data/ , Python, 1 line__init__.py - base/
data/ , Python, 278 linesanysleep_eval_dataset.py - base/
data/ , Python, 305 lines, 1 matchanysleep_train_dataset.p y - base/
data/ , Python, 198 linesbase_dataset.py - base/
data/ , Python, 56 linesdata_loader.py - base/
data/ , Python, 193 linesusleep_eval_dataset.py - base/
data/ , Python, 232 lines, 1 matchusleep_train_dataset.py - base/
evaluation/ , Python, 1 line__init__.py - base/
evaluation/ , Python, 39 linesbase_evaluator.py - base/
evaluation/ , Python, 108 linesclas_evaluator.py - base/
model/ , Python, 1 line__init__.py - base/
model/ , Python, 259 lines, 1 matchanysleep.py - base/
model/ , Python, 260 lines, 1 matchanysleep_early_fusion.py - base/
model/ , Python, 278 lines, 2 matchesanysleep_late_fusion.py - base/
model/ , Python, 172 linesbase_model.py - base/
model/ , Python, 148 lines, 1 matchusleep.py - base/
model/ , Python, 157 linesusleep_base_components.p y - base/
model/ , Python, 42 linesutilities.py - base/
results/ , Python, 1 line__init__.py - base/
results/ , Python, 87 linesanysleep_nchannels_ss_tr acker.py - base/
results/ , Python, 147 linesbase_result_tracker.py - base/
results/ , Python, 58 linesfast_sleep_stage_tracker .py - base/
results/ , Python, 41 linesjson_utils.py - base/
results/ , Python, 298 linessleep_stage_tracker.py - base/
results/ , Python, 232 linesusleep_nchannels_ss_trac ker.py - base/
training/ , Python, 1 line__init__.py - base/
training/ , Python, 253 lines, 1 matchclas_trainer.py - base/
training/ , Python, 185 lineslr_scheduler.py - base/
training/ , Jupyter, 150 lineslr_scheduler_example.ipy nb - base/
utils.py , Python, 115 lines - examples/
anphy/ , Python, 285 linesanysleep_no_hydra.py - examples/
anphy/ , Python, 340 linespredict_anphy.py - examples/
anphy/ , Python, 403 linespredict_anphy_usleep.py - examples/
anphy/ , Python, 241 lines, 1 matchusleep_no_hydra.py - examples/
anysleep_no_hydra.py , Python, 285 lines - examples/
cap/ , Python, 285 linesanysleep_no_hydra.py - examples/
cap/ , Python, 225 linespredict_cap.py - examples/
cnc/ , Python, 285 linesanysleep_no_hydra.py - examples/
cnc/ , Python, 198 linespredict_cnc.py - examples/
dhc/ , Python, 285 linesanysleep_no_hydra.py - examples/
dhc/ , Python, 177 linespredict_dhc.py - examples/
fhc/ , Python, 285 linesanysleep_no_hydra.py - examples/
fhc/ , Python, 186 linespredict_fhc.py - examples/
ihc/ , Python, 285 linesanysleep_no_hydra.py - examples/
ihc/ , Python, 178 linespredict_ihc.py - examples/
khc/ , Python, 285 linesanysleep_no_hydra.py - examples/
khc/ , Python, 176 linespredict_khc.py - examples/
predict_edf_file_logits_ , Python, 201 linesplain.py - examples/
ssc/ , Python, 285 linesanysleep_no_hydra.py - examples/
ssc/ , Python, 198 linespredict_ssc.py - examples/
usleep_no_hydra.py , Python, 241 lines - scripts/
arousals/ , Jupyter, 210 linesarousals_per_ss.ipynb - scripts/
arousals/ , Python, 150 linesmass_offsets.py - scripts/
arousals/ , Jupyter, 264 lines, 3 matchespredict_arousals_iou_f1_ aasm_merged.ipynb - scripts/
evaluate.py , Python, 73 lines - scripts/
final-figures/ , Jupyter, 418 linesfig_1a.ipynb - scripts/
final-figures/ , Jupyter, 138 linesfig_1b.ipynb - scripts/
final-figures/ , Python, 621 lines, 1 matchfig_2.py - scripts/
final-figures/ , Jupyter, 126 lines, 2 matchesfig_3.ipynb - scripts/
final-figures/ , Jupyter, 138 linesfig_4.ipynb - scripts/
final-figures/ , Jupyter, 115 lines, 1 matchfig_6.ipynb - scripts/
final-figures/ , Jupyter, 190 linesfig_s2.ipynb - scripts/
final-figures/ , Jupyter, 70 linesfig_s3.ipynb - scripts/
final-figures/ , Jupyter, 222 linesfig_s4.ipynb - scripts/
final-figures/ , Jupyter, 160 linesfig_s5.ipynb - scripts/
final-figures/ , Python, 6,469 lines, 2 matcheshf_scores.py - scripts/
final-figures/ , Jupyter, 41 linesisruc-info/ extract_lights_events.ip ynb - scripts/
final-figures/ , Jupyter, 193 linestable_1.ipynb - scripts/
final-figures/ , Jupyter, 431 linestable_s1_s2-fig_s1.ipynb - scripts/
final-figures/ , Jupyter, 164 linestable_s4a.ipynb - scripts/
final-figures/ , Jupyter, 66 linestable_s4a_anysleep_metri cs.ipynb - scripts/
final-figures/ , Jupyter, 66 linestable_s4a_usleep_metrics .ipynb - scripts/
final-figures/ , Jupyter, 142 linestable_s4b.ipynb - scripts/
final-figures/ , Jupyter, 308 linestable_s4b_anysleep_metri cs.ipynb - scripts/
final-figures/ , Jupyter, 308 linestable_s4b_usleep_metrics .ipynb - scripts/
final-figures/ , Jupyter, 175 linestable_s5.ipynb - scripts/
high-freq/ , Jupyter, 89 linesanalyze_cap_ins_sfs.ipyn b - scripts/
high-freq/ , Jupyter, 89 linesanalyze_dod_sfs.ipynb - scripts/
high-freq/ , Jupyter, 89 linesanalyze_mnc_nt1_sfs.ipyn b - scripts/
high-freq/ , Jupyter, 206 linesanysleep_cap_insomnia.ip ynb - scripts/
high-freq/ , Jupyter, 311 lines, 1 matchanysleep_cap_insomnia_sf s.ipynb - scripts/
high-freq/ , Jupyter, 192 linesanysleep_dodo_vs_dodh.ip ynb - scripts/
high-freq/ , Jupyter, 309 linesanysleep_dodo_vs_dodh_sf s.ipynb - scripts/
high-freq/ , Jupyter, 221 linesanysleep_isruc_age.ipynb - scripts/
high-freq/ , Jupyter, 223 linesanysleep_isruc_sex.ipynb - scripts/
high-freq/ , Jupyter, 218 linesanysleep_mnc_nt1.ipynb - scripts/
high-freq/ , Jupyter, 343 lines, 1 matchanysleep_mnc_nt1_sfs.ipy nb - scripts/
predict-30s-from-high-fr , Python, 102 lineseq.py - scripts/
predict-confusion-matrix , Python, 88 lines.py - scripts/
predict-high-freq.py , Python, 103 lines - scripts/
predict-high-freq_full_l , Python, 92 linesogits.py - scripts/
train.py , Python, 75 lines - LICENSE, License, 21 lines
- README.md, Text, 357 lines
Zenodo 23764134
Availability: 1 check, the latest on 1 November 2026: the link answers (HTTP 200)
- 1 November 2026: the link answers (HTTP 200)
Zenodo 23764135
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://
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
- doi:10.13026/
6phb-r450 , at the source; found in “Data availability” - doi:10.13026/
c26c7d , at the source; found in the references - doi:10.13026/
c2vc79 , at the source; found in “Data availability” - doi:10.13026/
c2x676 , at the source; found in “Data availability”
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://
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://
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://
BibTeX
@article{grieger2026anys
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/
url = {https://
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/
VL - 9
IS - 1
SP - 829
SN - 2398-6352
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"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":
"volume": "9",
"issue": "1",
"page": "829",
"DOI": "10.1038/
"PMID": "42963354",
"PMCID": "PMC13722680",
"ISSN": "2398-6352",
"publisher": "Nature Publishing Group",
"URL": "https://
"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 medicineIn 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 medicineIn 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 neuroscienceIn 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 medicineIn 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 sleepIn 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 researchIn 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 reportsIn 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 biologyIn 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 physiologyIn 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.
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: 3 repositories of the authors' code, each at its verified commit and with its license, 94 scripts, and 20 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:72258d108308d150…
Add the badge to the code's README
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 -->
[](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:endHTML
<!-- 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.
