| --- |
| language: en |
| license: apache-2.0 |
| tags: |
| - sleep-staging |
| - eeg |
| - embeddings |
| - physioex |
| - sleeptransformer |
| pretty_name: SleepTransformer-Phan Embeddings |
| size_categories: |
| - 10K<n<100K |
| --- |
| |
| # SleepTransformer-Phan Embeddings |
|
|
| Pre-extracted contextualized per-epoch embeddings from **SleepTransformer** (Phan et al. 2022), |
| trained on SHHS via [PhysioEx](https://github.com/guidogagl/physioex). |
|
|
| Each subject directory contains: |
| - `embeddings.npy` — `(n_epochs, 128)` contextualized epoch embeddings (bfloat16) |
| - `labels.npy` — `(n_epochs,)` AASM sleep stage labels |
|
|
| ## Usage |
|
|
| ```python |
| from physioex.models import load_embeddings |
| path = load_embeddings("sleeptransformer-phan", "hmc", verbose=True) |
| ``` |
|
|
| ## Linear Probe Results (5-fold subject-wise CV) |
|
|
| | Dataset | Subjects | ACC | MF1 | κ | F1-W | F1-N1 | F1-N2 | F1-N3 | F1-REM | |
| |---|---|---|---|---|---|---|---|---|---| |
| | shhs_visit1 | 5793 | **0.8861** | **0.8197** | **0.8380** | 0.92 | 0.51 | 0.90 | 0.85 | 0.91 | |
| | shhs_visit2 | 2651 | 0.8824 | 0.8068 | 0.8336 | 0.92 | 0.47 | 0.90 | 0.85 | 0.90 | |
| | dcsm | 255 | 0.8767 | 0.7855 | 0.8202 | 0.95 | 0.45 | 0.84 | 0.83 | 0.85 | |
| | mass_ss05 | 26 | 0.8750 | 0.8138 | 0.8183 | 0.85 | 0.55 | 0.90 | 0.87 | 0.89 | |
| | mass_ss02 | 19 | 0.8714 | 0.8065 | 0.8111 | 0.83 | 0.55 | 0.92 | 0.87 | 0.87 | |
| | mass_ss04 | 40 | 0.8638 | 0.8124 | 0.8048 | 0.85 | 0.58 | 0.91 | 0.85 | 0.88 | |
| | mass_ss03 | 62 | 0.8596 | 0.8063 | 0.7918 | 0.86 | 0.56 | 0.90 | 0.82 | 0.89 | |
| | sleepedf | 153 | 0.8394 | 0.7828 | 0.7770 | 0.93 | 0.50 | 0.86 | 0.81 | 0.82 | |
| | mass_ss01 | 53 | 0.8234 | 0.7741 | 0.7503 | 0.91 | 0.53 | 0.87 | 0.70 | 0.87 | |
| | stages_GSDV | 232 | 0.8167 | 0.6701 | 0.7015 | 0.84 | 0.24 | 0.87 | 0.58 | 0.82 | |
| | hpap | 247 | 0.8150 | 0.7755 | 0.7476 | 0.88 | 0.48 | 0.84 | 0.80 | 0.87 | |
| | stages_GSBB | 30 | 0.8124 | 0.7168 | 0.7149 | 0.90 | 0.37 | 0.85 | 0.66 | 0.81 | |
| | stages_MSMI | 63 | 0.7974 | 0.7276 | 0.6967 | 0.83 | 0.37 | 0.85 | 0.75 | 0.84 | |
| | stages_GSSW | 105 | 0.7908 | 0.6312 | 0.6617 | 0.79 | 0.18 | 0.86 | 0.50 | 0.83 | |
| | stages_GSLH | 45 | 0.7902 | 0.6714 | 0.6688 | 0.85 | 0.36 | 0.85 | 0.54 | 0.77 | |
| | stages_MSQW | 153 | 0.7839 | 0.7064 | 0.6817 | 0.82 | 0.47 | 0.85 | 0.56 | 0.83 | |
| | hmc | 151 | 0.7836 | 0.7532 | 0.7141 | 0.84 | 0.46 | 0.80 | 0.83 | 0.83 | |
| | mesa | 2056 | 0.7772 | 0.6932 | 0.6810 | 0.84 | 0.40 | 0.82 | 0.61 | 0.79 | |
| | stages_GSSA | 26 | 0.7767 | 0.5691 | 0.6179 | 0.75 | 0.10 | 0.84 | 0.38 | 0.77 | |
| | stages_STLK | 158 | 0.7737 | 0.6601 | 0.6563 | 0.80 | 0.33 | 0.83 | 0.52 | 0.82 | |
| | stages_STNF | 460 | 0.6409 | 0.5803 | 0.5182 | 0.71 | 0.18 | 0.65 | 0.74 | 0.61 | |
| | stages_MSTR | 285 | 0.5862 | 0.4573 | 0.3601 | 0.51 | 0.05 | 0.69 | 0.52 | 0.51 | |
| | stages_MSNF | 38 | 0.5448 | 0.4035 | 0.2983 | 0.55 | 0.10 | 0.66 | 0.38 | 0.33 | |
| | stages_BOGN | 85 | 0.5311 | 0.4027 | 0.2819 | 0.49 | 0.14 | 0.64 | 0.34 | 0.39 | |
| | stages_MSTH | 31 | 0.4917 | 0.2057 | 0.0492 | 0.22 | 0.00 | 0.66 | 0.09 | 0.06 | |
|
|
| ## Model Details |
|
|
| - **Architecture**: SleepTransformer (Phan et al. 2022) — epoch transformer + sequence transformer |
| - **Training data**: SHHS visit 1 (5793 subjects, single EEG channel) |
| - **Pipeline**: `seqsleepnet` (STFT spectrogram, T=29, F=129) |
| - **Sequence length**: L=21 epochs |
| - **Embedding dim**: 128 |
|
|
| ## Datasets |
|
|
| | Dataset | Source | URL | |
| |---|---|---| |
| | Sleep-EDF | PhysioNet | https://physionet.org/content/sleep-edfx/1.0.0/ | |
| | HMC | PhysioNet | https://physionet.org/content/hmc-sleep-staging/1.1/ | |
| | DCSM | ERDA/KU | https://erda.ku.dk/public/archives/db553715ecbe1f3ac66c1dc569826eef/published-archive.html | |
| | SHHS | NSRR | https://sleepdata.org/datasets/shhs | |
| | MESA | NSRR | https://sleepdata.org/datasets/mesa | |
| | HomePAP | NSRR | https://sleepdata.org/datasets/homepap | |
| | STAGES | NSRR | https://sleepdata.org/datasets/stages | |
| | MASS | CEAMS | http://ceams-carsm.ca/mass/ | |
|
|
| ## Citations |
|
|
| ```bibtex |
| @article{gagliardi2025physioex, |
| author={Gagliardi, Guido and Alfeo, Luca and Cimino, Mario G C A and Valenza, Gaetano and De Vos, Maarten}, |
| title={PhysioEx, a new Python library for explainable sleep staging through deep learning}, |
| journal={Physiological Measurement}, |
| url={http://iopscience.iop.org/article/10.1088/1361-6579/adaf73}, |
| year={2025}, |
| } |
| |
| @article{phan2022sleeptransformer, |
| title={SleepTransformer: Automatic Sleep Staging with Interpretability and Uncertainty Quantification}, |
| author={Phan, Huy and Mikkelsen, Kaare and Ch\'en, Oliver Y and Koch, Philipp and Mertins, Alfred and De Vos, Maarten}, |
| journal={IEEE Transactions on Biomedical Engineering}, |
| year={2022}, |
| } |
| ``` |
|
|