REST-a deep learning tool for automated mouse sleep stage classification.
The 5 matches
- [1] § Materials and methods › REST model design and training ↔ Training.py, lines 106–145 · score 0.83 · AdamW, weight decay, Focal loss, class weights, optimizer, Training
- [2] § Materials and methods › REST model design and training ↔ RESTCORE.py, lines 27–84 · score 0.76 · ReLU, Transformer encoder, positional encoding, layer normalization, logits, linearly
- [3] § Materials and methods › REST model design and training ↔ RESTutils.py, lines 219–271 · score 0.76 · bandpass filter, EEG STFT, EMG epoch, EEG epoch, spectrum, memory
- [4] § Materials and methods › REST model design and training ↔ RESTCORE.py, lines 27–84 · score 0.75 · ReLU, Transformer encoder, positional encoding, dropout, Linear, layers
- [5] § Materials and methods › REST model design and training ↔ RESTutils.py, lines 164–204 · score 0.64 · notch filter, bandpass filtered, EMG signals, 250 Hz, 30 Hz, 0.1 Hz
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 · 84 lines · 3.1 KB · MIT · 2 matches
- import torch
- import torch.nn as nn
- import math
- # -- Positional encoding ------------------------------------------------------
- class PositionalEncoding(nn.Module):
- def __init__(self, d_model, max_len=500):
- super().__init__()
- pe = torch.zeros(max_len, d_model)
- pos = torch.arange(0, max_len).unsqueeze(1)
- div = torch.exp(torch.arange(0, d_model, 2) * (-math.log(10000.0) / d_model))
- pe[:, 0::2] = torch.sin(pos * div)
- pe[:, 1::2] = torch.cos(pos * div)
- self.register_buffer("pe", pe.unsqueeze(0)) # [1, max_len, d_model]
- def forward(self, x): # x:[B, L, D]
- return x + self.pe[:, :x.size(1)]
- # -- Attention pooling --------------------------------------------------------
- class AttnPool(nn.Module):
- def __init__(self, d_model):
- super().__init__()
- self.q = nn.Linear(d_model, 1)
- def forward(self, x): # x:[B, L, D]
- w = torch.softmax(self.q(x).squeeze(-1), dim=1) # [B, L]
- return torch.sum(w.unsqueeze(-1) * x, dim=1) # [B, D]
- class REST(nn.Module):
- def __init__(self, in_feat, n_classes, win_len,
- d_model=256, nhead=8, nlayers_epoch=4, nlayers_seq=4,
- ff=512, fc_hidden1=128,fc_hidden2=64, dropout=0.1, use_layernorm=True):
- super().__init__()
- self.use_layernorm = use_layernorm
- if self.use_layernorm:
- self.input_norm = nn.LayerNorm(in_feat)
- # Epoch-level encoding
- self.epoch_in_proj = nn.Linear(in_feat, d_model)
- self.epoch_pos_enc = PositionalEncoding(d_model, max_len=10)
- epoch_layer = nn.TransformerEncoderLayer(d_model, nhead, ff, dropout, batch_first=True)
- self.epoch_transformer = nn.TransformerEncoder(epoch_layer, nlayers_epoch)
- self.epoch_pool = AttnPool(d_model)
- # Sequence-level encoding
- self.seq_pos_enc = PositionalEncoding(d_model, max_len=win_len)
- seq_layer = nn.TransformerEncoderLayer(d_model, nhead, ff, dropout, batch_first=True)
- self.seq_transformer = nn.TransformerEncoder(seq_layer, nlayers_seq)
- # Final classifier
- self.fc = nn.Sequential(
- nn.Linear(d_model, fc_hidden1),
- nn.ReLU(),
- nn.Dropout(dropout),
- nn.Linear(fc_hidden1, fc_hidden2),
- nn.ReLU(),
- nn.Dropout(dropout),
- nn.Linear(fc_hidden2, n_classes)
- )
- def forward(self, x): # x: [B, win_len, frames, feat]
- B, W, F, C = x.shape
- # Flatten batch and window
- x = x.view(B * W, F, C)
- if self.use_layernorm:
- x = self.input_norm(x) # [B*W, F, C] — LayerNorm over last dim (C)
- # Epoch-level transformer
- x = self.epoch_in_proj(x)
- x = self.epoch_pos_enc(x)
- x = self.epoch_transformer(x)
- x = self.epoch_pool(x) # [B*W, d_model]
- # Reshape back to sequence form
- x = x.view(B, W, -1)
- # Sequence-level transformer
- x = self.seq_pos_enc(x)
- x = self.seq_transformer(x)
- # Classification
- logits = self.fc(x) # [B, W, n_classes]
- return logits
RESTCORE.py at commit 1b267c4, under MIT · at the source
Overview
- Department of Neurology, University of Wisconsin-Madison School of Medicine and Public Health, Madison, Wisconsin, United States
- Department of Neuroscience, University of Wisconsin-Madison School of Medicine and Public Health, Madison, Wisconsin, 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 5 matches between paragraphs and lines of code.
SukiyakiP/REST
1b267c4c47023e797f0a28c45afdd56e12785a91, 26 May 2026Availability: 1 check, the latest on 29 September 2026: the link answers
- 29 September 2026: the link answers
15 files
- ArtifactFilter.py, Python, 259 lines
- ArtifactInjection.py, Python, 280 lines
- Data_compile.py, Python, 408 lines
- Inference.py, Python, 236 lines
- Inference_GUI.py, Python, 633 lines
- Inference_GUI_CPU.py, Python, 617 lines
- RESTCORE.py, Python, 84 lines, 2 matches
- RESTutils.py, Python, 735 lines, 2 matches
- SleepDataset.py, Python, 218 lines
- Test_EDF.py, Python, 393 lines
- Training.py, Python, 349 lines, 1 match
- rthook_torch_dll.py, Python, 48 lines
- tune_artifact_filter.py, Python, 443 lines
- LICENSE, License, 21 lines
- README.md, Text, 262 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;
- 13 scripts, each with its path and the digest of its content;
- 5 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.
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:
- it points to the authors' code: SukiyakiP/
REST - it says that the data are available on request
Read it in the paper: doi.org/10.1093/sleepadvances/zpag044.
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, 29 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 5 authors, 6 keywords, 1 funder, 31 references.
Cite
This paper
Wang, J., Osting, S., Goforth, A., Jones, M. V., & Maganti, R. (2026). REST-a deep learning tool for automated mouse sleep stage classification. Sleep advances : a journal of the Sleep Research Society, 7(2), zpag044. https://
BibTeX
@article{wang2026rest,
author = {Wang, Jun and Osting, Sue and Goforth, Anna and Jones, Mathew V and Maganti, Rama},
title = {{REST-a deep learning tool for automated mouse sleep stage classification}},
journal = {Sleep advances : a journal of the Sleep Research Society},
year = {2026},
month = apr,
volume = {7},
number = {2},
pages = {zpag044},
publisher = {Oxford University Press},
issn = {2632-5012},
doi = {10.1093/
url = {https://
pmid = {42169976},
pmcid = {PMC13189165}
}
RIS
TY - JOUR
AU - Wang, Jun
AU - Osting, Sue
AU - Goforth, Anna
AU - Jones, Mathew V
AU - Maganti, Rama
TI - REST-a deep learning tool for automated mouse sleep stage classification
T2 - Sleep advances : a journal of the Sleep Research Society
J2 - Sleep Adv
PY - 2026
DA - 2026/
VL - 7
IS - 2
SP - zpag044
SN - 2632-5012
PB - Oxford University Press
DO - 10.1093/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1093/
"type": "article-journal",
"title": "REST-a deep learning tool for automated mouse sleep stage classification",
"container-title": "Sleep advances : a journal of the Sleep Research Society",
"author": [
{
"family": "Wang",
"given": "Jun"
},
{
"family": "Osting",
"given": "Sue"
},
{
"family": "Goforth",
"given": "Anna"
},
{
"family": "Jones",
"given": "Mathew V"
},
{
"family": "Maganti",
"given": "Rama"
}
],
"container-title-short":
"volume": "7",
"issue": "2",
"page": "zpag044",
"DOI": "10.1093/
"PMID": "42169976",
"PMCID": "PMC13189165",
"ISSN": "2632-5012",
"publisher": "Oxford University Press",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
15
]
]
}
}
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.1371/journal.pone.0346294
- Neural network architectures and normalization techniques for automated sleep stage classification using rodent EEG and EMG signals.Journal: PloS oneIn common: EEG, 6 references
- [2] doi:10.1371/journal.pone.0351872 [code]
- Decoding visual object recognition from EEG signals.Journal: PloS oneIn common: MNE-Python, Pillow, PyTorch, 5 other tools, EEG
- [3] 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: MNE-Python, Pillow, PyTorch, 5 other tools, EEG
- [4] doi:10.1002/hbm.70528 [code]
- Explainable AI Insights Into EEG Classification and Its Alignment to Neural Correlates.Journal: Human brain mappingIn common: MNE-Python, Pillow, PyTorch, 5 other tools, EEG
- [5] doi:10.1038/s41597-025-05174-7 [code]
- A large-scale MEG and EEG dataset for object recognition in naturalistic scenesJournal: n/aIn common: MNE-Python, Pillow, PyTorch, 5 other tools, EEG
- [6] doi:10.1098/rstb.2024.0461 [code]
- Shallow recurrent decoders for neural and behavioural dynamics.Journal: Philosophical transactions of the Royal Society of London. Series B, Biological sciencesIn common: MNE-Python, Pillow, PyTorch, 5 other tools, mouse
- [7] doi:10.1007/s12021-026-09803-3 [code]
- NeuroFusion: A Unified Framework for Generalized Visual Stimulus Decoding from fMRI Across Datasets and Subjects.Journal: NeuroinformaticsIn common: MNE-Python, Pillow, PyTorch, 5 other tools
- [8] doi:10.1038/s41593-026-02285-1 [code]
- Fixation duration on natural scenes is explained by memory encoding not processing demand.Journal: Nature neuroscienceIn common: MNE-Python, Pillow, PyTorch, 5 other tools
- [9] doi:10.1038/s41598-026-50475-5 [code]
- Segmentation and classification of hippocampal subregions using multi-task generative adversarial networks.Journal: Scientific reportsIn common: Pillow, PyTorch, scikit-learn, 3 other tools, mouse, 1 reference
- [10] doi:10.3389/fncom.2026.1786996 [code]
- Schumann-anchored golden ratio organization of human neural oscillations.Journal: Frontiers in computational neuroscienceIn common: MNE-Python, Pillow, scikit-learn, 4 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, 13 scripts, and 5 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:c3280d1604736dae…
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.
