What is YASA?
YASA is a command-line sleep analysis toolbox for Python created and maintained by Raphael Vallat. Besides automatic sleep staging, it detects sleep spindles, slow waves and rapid eye movements, rejects artefacts, and computes spectral and hypnogram statistics. (YASA (opens in a new tab))
What does YASA need to stage sleep?
| Item | Details |
|---|---|
| EEG | Required: one EEG channel (for example a central derivation) |
| EOG | Optional, recommended: one eye-movement channel |
| EMG | Optional: one chin-muscle channel |
| Age and sex | Optional metadata used by the full model |
| Units | EEG in microvolts |
| Output | A stage for every 30-second epoch, plus a probability for each stage |
The authors report that a model using only one EEG and one EOG was about 0.5% lower in median accuracy than the full model with EEG, EOG, EMG, age and sex. (Vallat & Walker, 2021 (opens in a new tab))
How was YASA trained and tested?
- Training: 3,163 full-night PSG recordings (more than 31,000 hours) from seven datasets in the National Sleep Research Resource: CCSHS, CFS, CHAT, HomePAP, MESA, MrOS and SHHS.
- Testing: 585 held-out nights from the same sources, plus separate datasets of healthy adults and patients, one of which was scored by five registered sleep technicians to provide a consensus reference.
- Model: features calculated per 30-second epoch, with smoothed context features, classified by LightGBM.
Source: Vallat & Walker, 2021 (opens in a new tab).
How accurate is YASA?
The YASA documentation summarises its accuracy as about 85% against expert consensus scoring, comparable to agreement between human scorers. (YASA FAQ (opens in a new tab)) The published paper gives more detail: median accuracy varied by dataset, from 83.99% (MESA) to 90.44% on the best-performing test set, and N1 was by far the weakest stage. (Vallat & Walker, 2021 (opens in a new tab))
These are the YASA authors' results on their test datasets. They are not a validation of any particular installation, recording setup or service, including InEpoch's.
What are YASA's limitations?
- N1 is hard: sensitivity 45.4% in the published evaluation, consistent with low human agreement on N1.
- Accuracy drops around stage transitions (69.15% vs 94.08% in stable periods) and on fragmented nights.
- It stages sleep only. It does not score respiratory events, arousals or limb movements.
- The YASA documentation recommends that a trained scorer check its predictions, especially low-confidence and N1 epochs.
Sources: Vallat & Walker, 2021 (opens in a new tab); YASA FAQ (opens in a new tab).
Can YASA be used commercially?
YASA's source code is released under the BSD-3-Clause license. (GitHub (opens in a new tab)) Rights to use the distributed pretrained classifiers, and the data they were trained on, in paid clinical services are a separate question that should be reviewed before clinical deployment.
How does InEpoch use YASA?
InEpoch deploys a desktop application that runs YASA's pretrained classifier locally on the workstation's CPU. The team imports an EDF or EDF+ recording, confirms the EEG and optional EOG and EMG channels, runs staging, reviews every epoch with per-epoch probabilities and correction history, and exports a per-epoch CSV and a PDF report. InEpoch installs and configures it and trains technicians to use it. InEpoch is not affiliated with or endorsed by the YASA project. See the InEpoch workflow.
Frequently asked questions
Is YASA free?
YASA's source code is free and open source under the BSD-3-Clause license. Use of its pretrained models in paid clinical services should be reviewed separately.
What channels does YASA need?
One EEG channel is required. One EOG and one EMG channel are optional, and age and sex can be supplied as metadata.
Does YASA score sleep apnea?
No. YASA's classifier stages sleep (Wake, N1, N2, N3, REM). It does not score respiratory events or compute an apnea-hypopnea index.