> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neuroencoder.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Neuroencoder is a hosted EEG embeddings API (https://api.neuroencoder.com/v1). The model runs only on its servers. Python package `neuroencoder` on PyPI: client and command line tool; it does not contain the model. Precomputed real outputs need no key: GET https://api.neuroencoder.com/v1/samples lists two samples from the public Sleep-EDF data (ODC-By 1.0, attribution required): a full night's embeddings with scored sleep stages, and a 10-minute EDF with its embeddings. An instant key needs no email: POST /v1/signup with {"instant": true, "accept_terms": true} accepts the API terms (https://docs.neuroencoder.com/terms) and returns a provisional key at once (2 h of EEG, 20 requests/min, at most 120 windows per request or job, 7 days) and a claim_url that a person can open to turn the same key into a trial key. GET /v1/models also needs no key. From nothing to your own file in five commands: https://docs.neuroencoder.com/quickstart. A trial key also comes from `neuroencoder login --email <address>` or the HTTP device flow (POST /v1/signup with "device": true, then POST /v1/signup/token); a person ticks the terms boxes and approves the emailed link once. Data use (https://docs.neuroencoder.com/data-use): a response with "data_use": "contribute" stored a de-identified copy of the signal that may train our models; a response without data_use, or with "zero_retention", kept no copy (jobs keep their upload until they end and their result for 7 days). Terms: https://docs.neuroencoder.com/terms. Privacy: https://docs.neuroencoder.com/privacy. Security and vulnerability reports (security@neuroencoder.com): https://docs.neuroencoder.com/security. Main endpoint: POST /v1/embeddings with an EDF, BDF, FIF or NPY file or a JSON array; any montage, any sampling rate; one 768-dimensional vector per window. Errors are JSON with a `fix` field. Versions (https://docs.neuroencoder.com/versioning): `neuroencoder-eeg` is an alias, `neuroencoder-eeg-2026-11` a dated snapshot that never changes; pin with `model` or the Neuroencoder-Model header; responses carry model, model_snapshot and pipeline_version; deprecations get at least 6 months' notice. Support: support@neuroencoder.com (best effort, reply within 3 business days); status: https://neuroencoder.com/status. Reference: https://docs.neuroencoder.com/api. Getting started without signing up: https://docs.neuroencoder.com/instant-keys. OpenAPI: https://api.neuroencoder.com/v1/openapi.json. Sleep staging: a whole-night PSG (.edf/.bdf, at least 2 h, at least one EEG channel with a 10-20 label at 100 Hz or more; EOG used when present) as a job with "task": "sleep_staging" (POST /v1/files, PUT, POST /v1/jobs, poll, download) returns W/N1/N2/N3/REM per 30 s epoch with probabilities, a low-confidence flag, summary metrics (TST, sleep efficiency, latencies, WASO) and a CSV; it counts nights per week (trial 3, instant 1), weeks start Monday 00:00 UTC. Model neuroencoder-sleep-2026-11, trained on 1,629 nights from eight public datasets licensed for commercial use. On nights it never trained on, Cohen's kappa with EOG is 0.755 on 44 Sleep-EDF telemetry nights and 0.687 on 128 BOAS nights (YASA's pretrained classifier on the same nights: 0.732 and 0.659), and 0.672 to 0.807 across eight leave-one-site-out folds. It is behind that reference on CAP and ANPHY, and slightly below on DOD (within the confidence intervals). Guide: https://docs.neuroencoder.com/sleep-staging. Benchmark: https://docs.neuroencoder.com/sleep-benchmark.

# Sleep staging

> Send a whole-night PSG in EDF or BDF and get a sleep stage (W, N1, N2, N3, REM) for every 30 s epoch, with probabilities, a confidence flag and summary metrics. How it was trained, accuracy on held-out data, quota, errors.

> [!WARNING]
>
> **Research use only. Not a medical device.** The output is not a clinical sleep score. Do not use it to diagnose, treat or monitor anyone. Every job, hypnogram file and CSV carries this notice.

Upload one night of polysomnography (PSG) and the API scores it. You get one stage per 30 s epoch (W, N1, N2, N3 or REM), the probability of each stage, a low-confidence flag, and summary metrics such as total sleep time and sleep efficiency. A 10 h night took 34 s from the start of the upload to the result in our test. Times depend on your upload speed and on whether the worker is already running: a cold start adds about 45 s.

The current model is `neuroencoder-sleep-2026-11`. It combines our EEG encoder's embeddings of each EEG region with standard hand-crafted sleep features from [YASA](https://github.com/raphaelvallat/yasa) 0.7.0 (of one EEG and one EOG channel) and the signal amplitude. It normalises the features by the night's own average and reads the night as a sequence. That is why it needs the whole night. See [How it was trained](#how-it-was-trained) and the [benchmark](https://docs.neuroencoder.com/sleep-benchmark.md).

## What to send

| Requirement | Detail |
| - | - |
| File | One EDF or BDF file, the whole night (lights off to lights on, or the full recording) |
| Length | At least 2 h, at most 24 h. The model was validated on nights of 1.5 to 12 h |
| EEG | At least one channel with a 10-20 label, such as `C4-M1`, `C3`, `Fpz-Cz` or `EEG F4-M1`, sampled at 100 Hz or more |
| EOG | Used when present (labels such as `E1`, `LOC`, `ROC`, `EOG left`, or any label containing `EOG` or `EYE`). Without EOG the API uses an EEG-only model |
| Units | Calibrated physical units in the header (uV, mV or V), or the `units` option when the header's unit is empty or wrong. The API checks the amplitude (see below) |
| File size | At most 2 GB |

Channel names are matched as in the [embeddings API](https://docs.neuroencoder.com/api.md#channel-names): referential channels (`C4-M1`, `C4-A1`, `C4-REF`) map to their electrode, and bipolar pairs (`Fpz-Cz`) to the region of the first electrode. Labels written without a dash, as many PSG systems export them (`C4A1`, `O2M1`, `F3:A2`), are recognised the same way and map to the first electrode. EMG, ECG and channels with other names are ignored. Rename numbered or non-standard channels with `channel_names`.

**Which channels are used.** Every EEG channel feeds the embedding part. One EEG channel feeds the YASA features: the first central channel, else the first frontal one, else the first EEG channel. One EOG channel is used: a left-eye channel (`E1`, `LOC`, `LEFT`, `EOGL`) if there is one, else the first EOG channel. EEG or EOG channels below 100 Hz are skipped. The submit response shows the choice in `input.plan` before anything runs.

**Units check.** The worker reads the file in volts using the physical dimension in the EDF header. If the median standard deviation of the chosen EEG channel over 30 s epochs is outside 1 to 500 uV (EEG is usually 5 to 50 uV), the job fails with `invalid_input` and the night is refunded. A wrong or empty unit field in the header, an uncalibrated export, or a flat channel causes this. The API does not guess a scale. If the header's unit field is empty or wrong, say what unit the stored values are in with the `units` option (`"uV"`, `"mV"` or `"V"`); it replaces the header's unit for the channels used. The error's `fix` points to this option and to `eeg_channel` for a flat channel.

**Epochs.** Epoch `i` starts `30 * i` seconds after the first sample of the file. A partial epoch at the end is dropped. The whole file is scored: if your recording starts well before lights off, crop it first, or the wake before lights off counts in the metrics.

## Run it

You need an API key (see [Quickstart](https://docs.neuroencoder.com/quickstart.md)). The steps are the [job](https://docs.neuroencoder.com/api.md#jobs-for-long-recordings) steps with `"task": "sleep_staging"`.

```bash theme={null}
F=night.edf
curl -s https://api.neuroencoder.com/v1/files -H "Authorization: Bearer $NEUROENCODER_API_KEY" \
  -H "content-type: application/json" -d "{\"filename\": \"$F\", \"bytes\": $(wc -c < $F)}" > file.json
curl -s -X PUT --upload-file $F "$(jq -r .upload_url file.json)"
curl -s https://api.neuroencoder.com/v1/jobs -H "Authorization: Bearer $NEUROENCODER_API_KEY" \
  -H "content-type: application/json" -H "Idempotency-Key: $(uuidgen)" \
  -d "{\"file\": \"$(jq -r .id file.json)\", \"task\": \"sleep_staging\"}" > job.json
jq '{status, error, plan: .input.plan}' job.json
JOB=$(jq -r .id job.json)
while sleep 5; do
  curl -s https://api.neuroencoder.com/v1/jobs/$JOB -H "Authorization: Bearer $NEUROENCODER_API_KEY" > job.json
  case $(jq -r .status job.json) in queued|running) ;; *) break ;; esac
done
jq '{status, error, summary: .result.summary}' job.json
curl -s "$(jq -r .result.url job.json)" -o night_hypnogram.json
curl -s "$(jq -r .result.csv_url job.json)" -o night_hypnogram.csv
```

1. `POST /v1/files` with the file name and size returns an upload URL. PUT the file there within 10 minutes, without the `Authorization` header.
2. `POST /v1/jobs` with `"task": "sleep_staging"` reads the file header, checks it, and queues the job. Most input errors come back here, before a night is counted. `input.plan` shows the channels that will be used.
3. Poll `GET /v1/jobs/{id}` every `Retry-After` seconds (5) until `status` is `succeeded`, `failed`, `cancelled` or `expired`.
4. On `succeeded`, `result.summary` holds the metrics. `result.url` is the hypnogram JSON and `result.csv_url` the CSV. The links are valid 5 minutes; get the job again for fresh ones.

We ran these commands on 13 November 2026 against the live API with Sleep-EDF recording `ST7011J0-PSG.edf` (9.97 h, 100 Hz; [Sleep-EDF Expanded](https://physionet.org/content/sleep-edfx/1.0.0/), ODC-By 1.0). The plan at submit (it depends only on the file header, not on the model):

```json theme={null}
{"embedding": ["EEG Fpz-Cz", "EEG Pz-Oz"], "yasa_eeg": "EEG Fpz-Cz", "yasa_eog": "EOG horizontal",
 "read": ["EEG Fpz-Cz", "EEG Pz-Oz", "EOG horizontal"], "names": ["EEG Fpz-Cz", "EEG Pz-Oz", "EOG horizontal"],
 "ignored": ["EMG submental", "Marker"], "sfreq": 100, "epochs": 1196, "override": false}
```

We ran the current model (`neuroencoder-sleep-2026-11`) on 16 November 2026. It took 34 s from the start of the upload to the result, with the worker already running; an earlier run that day, with a cold worker, took 78 s.

The summary gave:

* time in bed 598 min;
* total sleep time 437 min;
* sleep efficiency 73.1%;
* sleep onset latency 29.0 min;
* REM latency 115.5 min;
* WASO 132 min.

Against the human scoring of this night, Cohen's kappa is 0.643 (see [Accuracy](#accuracy)).

### Options

Pass them as `"options"` in `POST /v1/jobs`. All are optional.

| Option | Meaning |
| - | - |
| `picks` | Header labels of the channels to consider; others are ignored. Leaving out the EOG channel gives the EEG-only model |
| `channel_names` | New names, one per channel of the file (or per pick), when the file's labels are not 10-20 names |
| `eeg_channel` | The EEG channel for the YASA features, by name (after renaming). Default: the first central, else frontal, else first EEG channel |
| `eog_channel` | The EOG channel, by name. Default: a left-eye channel, else the first EOG channel |
| `units` | `"uV"`, `"mV"` or `"V"`: the unit of the values stored in the file, when the header's unit field is empty or wrong. Omit it when the header is right |

Other options are rejected with `invalid_input`. There is no option to crop the night; crop the file before upload.

## What you get

### Job result

`result` of a succeeded job:

| Field | Meaning |
| - | - |
| `summary` | Sleep metrics, defined below. Example (ST7011): `{"epochs": 1196, "tib_minutes": 598, "tst_minutes": 437, "sleep_efficiency_percent": 73.1, ...}` |
| `channels_used` | `embedding` (EEG channels used for the embeddings), `regions`, `yasa_eeg`, `yasa_eog` (null without EOG), `variant` |
| `variant` | `eog` or `eeg_only`: which model staged the night |
| `low_confidence_epochs` | Number of epochs flagged low confidence |
| `low_confidence_threshold` | 0.5 |
| `stages`, `epoch_seconds` | `["W", "N1", "N2", "N3", "REM"]`, 30 |
| `model` | `neuroencoder-sleep-2026-11` |
| `url`, `csv_url`, `url_expires_at` | Download links for the hypnogram JSON and CSV, valid 5 minutes |
| `notice` | `Research use only, not a medical device.` |

`usage` shows `nights` (1), `week` (the ISO week charged, such as `2026-W46`), `week_nights` (the account's nights that week at submit) and `billed`.

### Hypnogram JSON

The same fields as the result (without the links), plus `epochs`, one object per 30 s epoch. The examples here and in the CSV below come from a run of an earlier model; the format is the same:

```json theme={null}
{"t_start": 6000.0, "stage": "W", "probabilities": {"W": 0.9733, "N1": 0.0258, "N2": 0.0007, "N3": 0.0001, "REM": 0.0002},
 "confidence": 0.9733, "low_confidence": false}
```

`t_start` is in seconds from the start of the file. `confidence` is the highest probability. `low_confidence` is true when it is below 0.5. Probabilities are rounded to 4 decimals.

### CSV

The first line is the notice, then a header and one row per epoch:

```text theme={null}
# Research use only, not a medical device.
epoch,t_start_s,stage,confidence,low_confidence,p_W,p_N1,p_N2,p_N3,p_REM
0,0,W,0.9728,0,0.9728,0.0136,0.0093,0.0012,0.0031
1,30,W,0.9897,0,0.9897,0.0057,0.0031,0.0005,0.0010
```

Skip the first line when reading it, for example `pandas.read_csv("night_hypnogram.csv", comment="#")`.

### Summary metrics

All times are in minutes, rounded to 0.1. They are computed from the predicted stages of the whole file. The recording start stands in for lights off, and the end for lights on.

| Field | Definition |
| - | - |
| `epochs` | Number of 30 s epochs scored |
| `tib_minutes` | Time in bed: all scored epochs (the whole analysed recording) |
| `tst_minutes` | Total sleep time: epochs scored N1, N2, N3 or REM |
| `sleep_efficiency_percent` | 100 x TST / TIB |
| `sleep_onset_latency_minutes` | From the start of the recording to the first epoch of any sleep stage (N1 counts). Null if there is no sleep |
| `rem_latency_minutes` | From sleep onset to the first REM epoch. Null if there is no REM |
| `waso_minutes` | Wake after sleep onset: W epochs between sleep onset and the last sleep epoch |
| `awakenings` | Runs of one or more consecutive W epochs between sleep onset and the last sleep epoch |
| `stages` | For each stage: `minutes`, `percent` and `percent_of`. N1, N2, N3 and REM are a percentage of TST; W is a percentage of TIB |

The latencies and WASO count every epoch. There is no minimum duration for an awakening and no smoothing.

### Probabilities and the low-confidence flag

The probabilities are the averaged outputs of three trained copies of the model. They were not calibrated, so 0.8 does not mean 80% correct. The flag has not been validated for the current model. With an earlier model (v1), on night ST7011 the 29 flagged epochs that have a human score were right 21% of the time, the others 75%. A wrong stage given with high confidence is not flagged. Review flagged epochs first, but do not treat unflagged epochs as checked.

## Python and command line

Client 2.5.0 and later (not yet on PyPI, which has 2.2.0; until then use the HTTP steps above):

```python theme={null}
import neuroencoder
r = neuroencoder.sleep_staging("night.edf")   # upload, submit, poll, download
r.summary, r.stages, r.epochs                 # metrics; stage per epoch; stage, probabilities, confidence per epoch
r.save_csv("night_hypnogram.csv")
```

```bash theme={null}
neuroencoder sleep night.edf -o night_hypnogram.csv   # prints the summary and the notice
```

The same options are available as `eeg_channel`, `eog_channel`, `picks` and `channel_names` (`--eeg-channel`, `--eog-channel`, `--picks`, `--channels`). Earlier versions do not have sleep staging; use the HTTP steps above.

## Quota

Sleep staging counts nights, not hours of EEG. Each job is one night, whatever its length. It does not use the account's monthly EEG quota.

| Tier | Nights per week |
| - | -: |
| trial | 3 |
| instant | 1 (at most 12 h, file at most 128 MB) |
| collab | 100 |
| paid | unlimited |

* Weeks start Monday 00:00 UTC.
* The night is reserved at submit. It is given back if the job fails, is cancelled before it finishes staging, expires before it starts, or is deleted before it finishes. Deleting a finished job does not give it back.
* Over the limit, `POST /v1/jobs` returns 429 `sleep_quota_exceeded` with `Retry-After` until Monday.
* `GET /v1/me` shows `limits.sleep_nights_per_week` and `usage.sleep_staging`: `week`, `nights`, `nights_remaining` and `resets_at` (Unix time).
* An instant key's 120-window cap does not apply to sleep jobs; its night may be at most 12 h long (403 `agent_key_limit` at submit, nothing counted) in a file of at most 128 MB.
* A cancel stops the job at the worker's next check and gives the night back. If the night was already staged when the cancel arrived, the job finishes as `succeeded` with its result and the night counts.
* Queue and active-job limits are those of other [jobs](https://docs.neuroencoder.com/api.md#jobs-for-long-recordings). Results are kept 7 days. The upload is deleted when the job ends; a contributed copy of the signal is separate ([Data use](https://docs.neuroencoder.com/data-use.md)).

For more nights, ask at [contact@neuroencoder.com](mailto:contact@neuroencoder.com).

## Errors

Errors have the usual shape, `{"error": {"message", "type", "code", "param", "fix"}}`; follow `fix`. Errors at submit do not count a night.

| When | Status | Code | Meaning |
| - | - | - | - |
| Submit | 400 | `unsupported_file` | Not an EDF or BDF file |
| Submit | 400 | `unreadable_file` | The header could not be read |
| Submit | 400 | `no_eeg_channels` | No channel has a 10-20 EEG label; rename with `channel_names` |
| Submit | 400 | `sfreq_too_low` | All EEG channels are below 100 Hz. Upsampling does not help: the spindle band is missing |
| Submit | 400 | `recording_too_short` | Under 2 h |
| Submit | 400 | `invalid_input` | A bad option: unknown name, `units` not `uV`, `mV` or `V`, or an `eeg_channel`, `eog_channel`, `picks` or `channel_names` that does not fit the file. `fix` lists the usable channels |
| Submit | 400, 409 | `file_not_uploaded`, `file_already_used`, `input_too_large` | As for [other jobs](https://docs.neuroencoder.com/api.md#errors). `input_too_large`: over the job limits (24 h, 400 M samples) |
| Submit | 429 | `sleep_quota_exceeded` | No nights left this week; `Retry-After` until Monday 00:00 UTC |
| Submit | 429 | `too_many_queued_jobs` | 20 jobs of this account are already waiting |
| Job `failed` | | `invalid_input` | Amplitude outside 1 to 500 uV (units check). Refunded. Set `units` if the header's unit is wrong, or pick another `eeg_channel` |
| Job `failed` | | `worker_timeout`, `worker_unavailable`, `internal_error`, `input_changed` | As for other jobs. Refunded; submit again |

Two examples from the live API:

```json theme={null}
{"error": {"message": "The recording has 1.00 h; sleep staging needs at least 2 h.", "type": "invalid_request_error",
           "code": "recording_too_short", "param": "file",
           "fix": "Upload the whole night (lights off to lights on): the model normalises each recording by its own night-long mean."}}
{"error": {"message": "eeg_channel 'C4-M1' is not a usable EEG channel of the file.", "type": "invalid_request_error",
           "code": "invalid_input", "param": "options.eeg_channel",
           "fix": "Usable EEG channels: ['EEG Fpz-Cz', 'EEG Pz-Oz'] (at least 100 Hz, a 10-20 or EOG label)."}}
```

## Accuracy

These numbers are for the current model, `neuroencoder-sleep-2026-11`. They come only from nights the model did not train on. The [sleep staging benchmark](https://docs.neuroencoder.com/sleep-benchmark.md) has the full tables, confidence intervals, per-stage results and method.

**Agreement with human scorers.** Cohen's kappa, pooled over epochs. The reference is YASA's pretrained classifier on the same nights and channels.

| Test | Nights | With EOG | YASA, with EOG | EEG only | YASA, EEG only |
| - | -: | -: | -: | -: | -: |
| Sleep-EDF telemetry (held out) | 44 | 0.755 | 0.732 | 0.749 | 0.699 |
| BOAS (held out) | 128 | 0.687 | 0.659 | 0.683 | 0.613 |
| Leave-one-site-out, 8 sites (range) | 1,629 | 0.672 to 0.807 | 0.641 to 0.790 | 0.669 to 0.818 | 0.618 to 0.764 |

* **Held-out sets.** With EOG, we are better than the reference on 36 of 44 Sleep-EDF telemetry nights and on 88 of 128 BOAS nights.
* **Leave-one-site-out.** Each of the eight training sources was held out in turn. The recipe was trained on the other seven and tested on the held-out source.
  * With EOG, we are behind the reference on CAP and ANPHY, and slightly below on DOD (0.731 vs 0.742, within the confidence intervals).
  * Without EOG, we are below the reference's EEG-only classifier on one site: CAP.
* **For comparison:** two human scorers agree at about kappa 0.76 under AASM rules ([Danker-Hopfe et al. 2009](https://doi.org/10.1111/j.1365-2869.2008.00700.x)).
* **Weak spots.**
  * N1 is the least reliable stage.
  * N3 depends on how the lab scores deep sleep. Compared with the human scorers, the model calls too much N3 at some labs (Sleep-EDF SC, DOD, CinC 2018, BOAS) and too little at others (CAP, HMC).
* **Single nights** can be much worse than the averages.

### Two example nights

Both nights ran through the live API with the current model on 16 November 2026. Neither is in the training data. The YASA reference used the same channels.

| Night | Recording | Kappa | YASA kappa | Upload to result |
| - | - | -: | -: | -: |
| Sleep-EDF telemetry ST7011 | 9.97 h, 100 Hz, Fpz-Cz, Pz-Oz, EOG; 1,092 scored epochs | 0.643 | 0.594 | 34 s |
| CAP n13, healthy sleeper | F3A2, F4A1, C3A2, C4A1, O1A2, O2A1 and LOC; 952 scored epochs; `units` `"uV"` | 0.894 | 0.836 | 54 s |

Notes on these nights:

* **ST7011** is from the Sleep-EDF telemetry study. Training used only the sleep cassette study.
* **CAP n13** was left out of training because its scoring file has malformed rows. Its summary: time in bed 485 min, total sleep time 392.5 min, sleep efficiency 80.9%, sleep onset latency 6.5 min, REM latency 59.5 min, WASO 81.5 min.
* Both times are with the worker already running. A cold start adds about 45 s.
* Two nights are not a benchmark.

## How it was trained

**Data.** 1,629 nights, 1,538,460 scored epochs, from eight public sources. All eight are licensed for commercial use of derived models. They cover:

* lab and home PSG;
* healthy adults and patients with sleep disorders;
* R\&K and AASM scoring.

| Dataset | Licence | Nights | Scored epochs | Scoring |
| - | - | -: | -: | - |
| [Sleep-EDF Expanded](https://physionet.org/content/sleep-edfx/1.0.0/), sleep cassette | ODC-By 1.0 | 153 | 195,469 | R\&K |
| [Haaglanden Medisch Centrum (HMC)](https://physionet.org/content/hmc-sleep-staging/1.1/) | CC BY 4.0 | 151 | 137,243 | AASM |
| [St Vincent's University Hospital / UCD (SVUH-UCD)](https://physionet.org/content/ucddb/1.0.0/) | ODC-By 1.0 | 25 | 20,774 | R\&K |
| [CAP Sleep Database](https://physionet.org/content/capslpdb/1.0.0/) | ODC-By 1.0 | 102 | 102,248 | R\&K |
| [Dreem Open Datasets, DOD-H and DOD-O](https://zenodo.org/records/15900394) | MIT | 80 | 77,898 | AASM, consensus of 5 scorers |
| [PhysioNet/CinC Challenge 2018](https://physionet.org/content/challenge-2018/1.0.0/), training set | ODC-By 1.0 | 994 | 892,262 | AASM |
| Ear-EEG Sleep Monitoring [EESM19](https://openneuro.org/datasets/ds005185) and [EESM23](https://openneuro.org/datasets/ds005178), home PSG | CC0 | 95 | 88,373 | AASM |
| [ANPHY-Sleep](https://osf.io/r26fh/) | CC0 | 29 | 24,193 | AASM |

How the data were prepared:

* R\&K stages 3 and 4 are merged into N3.
* Unscored, movement and artefact epochs are left out of training.
* Some nights were excluded because their files could not be used, for example broken scoring files or no usable EEG channel.

**Labels.**

* The training labels are the human expert scores, mixed during training with labels from our own teacher models.
* A teacher never saw the site whose nights it labels.
* No third-party model weights or labels are used.
* YASA's pretrained classifier serves only as the [benchmark reference](https://docs.neuroencoder.com/sleep-benchmark.md#reference). The model uses YASA's open-source feature code (BSD-3-Clause), not its trained classifier.

**BOAS was left out.** One public set, [BOAS](https://openneuro.org/datasets/ds005555) (CC0), was not used for training.

* It scores deep sleep (N3) far more sparingly than the other labs.
* Adding it to training made N3 worse at the other sites.
* It is now one of the two fully held-out test sets.

**Model.**

* The served output is the average of three copies of the model, trained with different seeds.
* One variant uses EEG and EOG. The other uses EEG only, for recordings without EOG.

**Data use.** All training data are public and de-identified. For the OpenNeuro datasets we follow OpenNeuro's terms, including never attempting to re-identify participants.

**Validated recordings.**

* Montages: Fpz-Cz with Pz-Oz (Sleep-EDF); AASM F/C/O mastoid sets; C3-A2 and C4-A1; CAP's bipolar chains; the EESM home PSG cap.
* Sampling rates: 100, 128, 200, 250, 256 and 512 Hz.
* Not validated: children, and wearable, forehead or ear EEG.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.