Reproducing the paper#
Every paper asset maps to an entry-point module run as python -m protosleepnet.<module>. Pass --help for options; full experiment settings
(M value, seeds, datasets) are documented per script and mirrored in the
protosleepnet.
Note
Raw recordings are not redistributed here — obtain them from their sources
and preprocess with physioex (this repo
ships none of its own preprocessing). Large artifacts (predictions, embeddings,
reconstruction arrays, checkpoints) live in a backup root wired in via the
git-ignored json/ and reconstructions_bulk/ symlinks; only small
figure-source JSON is committed under data/.
Figure / table → experiment → command#
Paper asset |
Experiment |
Command |
|---|---|---|
Fig 2a; Supp §1 |
In-domain + OOD staging, per-class, confusion, stats |
|
Fig 2b; Supp §3,§8 |
M-sweep, residual/VQ robustness, VQ methods, randomization |
|
Supp §2 |
Ablation (4 component variants) + occlusion robustness |
|
Fig 4; Supp §5,§6 |
Prototype reconstruction (data/model/hybrid) + cross-dataset |
|
Fig 3; Tab 1,2; Supp §4,§6 |
Codebook summaries, band-ablation rules, coherence, local IG |
|
Supp §9 |
Seed stability |
|
Fig 5; Supp §7 |
Clinical probing (AD/PD), frozen-model LOSO |
|
Manuscript figure/table assembly (LaTeX-coupled emitters) is kept out of this repo, with the paper sources.
Repository layout#
src/protosleepnet/ # installable package (run as python -m protosleepnet.<mod>)
train.py test_*.py extract_*.py seed_*.py # staging training/eval + seed-stability
build_protosleepnet.py # shared model factory
ablation/ baselines/ # ablation & residual/mixer/dropout variants
posthoc_prototypes/ proto_reconstruction/ # VQ codebook learning + reconstruction
figure_reconstruction/ # prototype cards / rules / spectral & relevance signatures
probing/ clinical_probing/ # clinical probing (AD/PD) compute + analysis
ood_disease/ # OOD disease evaluation / transport
plot/ # portable figure scripts (from predictions)
demo/ # the interactive-demo precompute pipeline
examples/slurm/ # cluster launchers; copy env.sh.example -> env.sh
notebooks/ # global_explain.ipynb, local_explain.ipynb
data/ # small committed figure-source JSON only
tests/ # smoke tests (import graph + optional pretrained forward pass)
Smoke test#
bash reproduce.sh # load weights → forward pass → regenerate one figure
pip install -e . pytest
pytest # import-graph smoke test (no network)
pytest --runslow # also pull weights from HuggingFace and run a forward pass
The interactive demo#
The protosleepnet.demo subpackage builds the static bundle behind the
Live demo: subject selection, subsetting/anonymization, the PaCMAP atlas,
per-epoch IG, and the clinical-plausibility audit. It ships only anonymized
derived artifacts — never the source signals. See its module reference in the
protosleepnet.