1. Intended use and evaluation target
1.1 Service boundary
Sleep algorithm evaluation services design reproducible tests for a frozen model version, input interface, output definition and use setting. Targets include sleep/wake detection, stage classification, arousal or respiratory-event detection, nightly parameter estimation and wearable trends. Data quality assessment supports this work, but evaluation asks how algorithm output differs from a justified reference result. It does not by itself develop the algorithm, diagnose a patient or confer regulatory authorization.[3]
Register intended users, clinical or nonclinical purpose, eligible population, input channels, signal-quality conditions, output granularity, software and model versions, human review, operating environment and decision owner. Nightly averages, epoch classifications, event detections and participant-level decisions answer different questions. Overall accuracy alone can hide consequential errors. An assessment of general wellness trends cannot be extrapolated into diagnostic use; that use needs purpose-specific evidence and the applicable local regulatory pathway.[8]
1.2 Freeze the protocol before testing
Before seeing test outcomes, specify sources, participant split, reference standard, clock alignment, class mapping, uninterpretable intervals, primary and secondary endpoints, uncertainty intervals, subgroups, missingness and acceptance conditions. Any retrospective threshold adjustment, retraining or removal of difficult nights creates a new experiment; the same test set no longer gives an independent estimate of the original frozen system. The FDA, Health Canada and MHRA GMLP principles emphasize representative data, independent testing, best available reference methods and testing in clinically relevant conditions.[3]
| Algorithm task | Frozen input and output | Main evaluation question |
|---|---|---|
| Sleep stages or sleep/wake | Channels, epoch size, stage system and unknown-label handling | Which classes are confused, and how are sleep architecture estimates affected? |
| Respiratory events or arousals | Event definition, boundary tolerance, overlap and matching | Where do missed, extra or misclassified events occur? |
| Nightly measures | Denominator and version for sleep time, efficiency, AHI and related measures | How large are individual error, bias and threshold misclassification? |
| Wearable trends | Wear detection, night limits, firmware and population | Are changes across nights reproducible and interpretable? |
2. Test data and reference results
2.1 Independent samples and leakage
Keep all nights from a participant on one side of a split. Also check overlapping windows, repeated exports, public mirrors, pretraining corpora, and correlations by site or hardware batch. Randomly splitting epochs can place neighboring fragments of one recording in both development and test data, inflating apparent performance. Distinguish internally held-out tests, external institutions or devices, and prospective or real-workflow tests; these answer different generalization questions.[3] Sleep-EDF Expanded pairs PSG recordings with stage annotations, but its original scoring conventions, channels and study populations must be described before cross-dataset comparison.[7]
| Sample layer | Documented split evidence | Typical distortion |
|---|---|---|
| Participants and nights | Deduplication key, multiple nights and follow-up links | Nights from one person enter both development and test. |
| Acquisition source | Site, device, firmware, setting and collection period | Single-site performance is called generalizable. |
| Files and derivatives | Checksums, crops, resampling and public mirrors | Equivalent content has a different filename and leaks. |
| Frozen independent test | Sample list, access log, threshold and code revision | Repeated probing is still described as blind testing. |
2.2 Reference standards and scorer variation
For PSG work, document the AASM scoring-manual version, montage and scoring workflow, and use appropriately qualified scorers under the applicable rules. This guide does not reproduce the licensed detailed rules.[1] Retain scorer identity, blinding, review and adjudication. AASM inter-scorer resources distinguish epoch-by-epoch staging from respiratory events, limb movements and arousals; a single annotation file should not be assumed infallible.[2] The multi-scorer PSG-IPA resource helps reveal human variability, but its agreement values are not automatic acceptance thresholds for another study.[5] Define how unscorable segments, unknown stages and disputed event boundaries enter the analysis before unblinding.
3. Metrics and error attribution
3.1 Metrics that match the task
For epoch staging, give a confusion matrix, class recall and precision, balanced summaries and participant-level distributions. For sleep/wake, report both sleep sensitivity and wake specificity: the high prevalence of sleep epochs can make average accuracy misleading.[9] Event evaluation requires a declared temporal tolerance and one-to-one matching; otherwise one long prediction might count against several reference events. Report event counts, recall, precision and false alarms. Nightly measures need error distributions, systematic bias, individual disagreement, mistakes around decision cutoffs and no-result rates. Correlation is not agreement. Name the denominator: participants, nights, epochs, events or usable recording time.
| Output level | Suitable primary measure | Disclose alongside it |
|---|---|---|
| Sleep/wake and stages | Class confusion, recall, precision and macro summary | Unknown epochs, class counts and participant spread. |
| Respiratory or arousal events | Recall, precision and false alarms under a fixed match rule | Tolerance, event types, overlap treatment and recording time. |
| Nightly parameters | Bias, absolute error and individual error interval | Definition, denominator, cutoff mistakes and no-result rate. |
| User decisions | Error rate for the intended decision | Human review, abstention and workflow consequence. |
3.2 Stratification and human involvement
Examine errors by age, disease severity, site, device, acquisition setting, signal quality and available channels. State subgroup sizes and uncertainty before interpreting apparent differences. Review source signal excerpts to separate disputed reference labels, missing inputs, time misalignment, model mistakes and postprocessing failures. If people can edit output, measure raw model performance, edit volume, review time and final human-algorithm performance separately. GMLP explicitly addresses the human-AI team.[3] FDA-partner transparency principles call for information on test data, known biases, failure modes and limits of use.[4]
| Error source | Review evidence | How to report it |
|---|---|---|
| Disputed reference | Independent scores, adjudication and original excerpts | Show a range across references; do not silently change truth labels. |
| Input or time defect | Quality flags, clock data and channel logs | Report no-result rates and conditional performance separately. |
| Model or postprocessing | Scores, threshold and event merge rules | Locate error types and affected model revisions. |
| Human review effect | Edit log, time and final output | Separate autonomous and human-algorithm performance. |
4. Validation settings and robustness
4.1 External settings and stress tests
Select sites, devices, ages, severity levels and home or laboratory conditions representative of the declared use, and name groups left untested. NSRR SHHS offers EDF signals and XML annotations but documents some discrepancies in event counts and oxygen-desaturation annotation, so public data support external checks only after alignment and version review.[6] Examine noise, sensor loss, poor wear, clock drift, short nights, cross-midnight recordings and rare classes. A synthetic perturbation test cannot be presented as observed clinical performance. For wearables, obtain synchronized PSG and examine both nightly aggregates and epoch mismatches; an original validation-framework study notes that the high base rate of sleep affects interpretation of average agreement.[9]
| Validation setting | Controlled variables | Limit on inference |
|---|---|---|
| New site or device | Protocol, sensors, firmware and population | Transfer claims apply only to measured combinations. |
| Home versus laboratory | Wear, interference, duration and staff support | Report settings separately before any pooling. |
| Degraded signal | Missing channels, noise and abstention policy | Report failure rate and conditional accuracy together. |
| Rare event or subgroup | Sample size, severity and scorer dispute | Mark uncertain findings where evidence is sparse. |
4.2 Reproducibility and decision
Provide a rerunnable container or dependency list, frozen model and threshold, input/output checksums, evaluation code and random seed. Repeating a run on the same sample should reproduce its results. Acceptance conditions depend on intended risk, human review and the registered protocol; there is no universal percentage for every staging, respiratory or consumer-device algorithm. If a critical setting is absent, reference labels are unstable or the sample is too small, conclude evidence is insufficient or use must be restricted. Separate observed statistics, expert judgment and regulatory status in the report.
5. Handoff and version maintenance
5.1 Evaluation package and change triggers
Deliver the preregistered protocol, data flow, sample and exclusion flow, reference-label version, model build identifier, primary and subgroup results, uncertainty intervals, error cases, no-result and abstention counts, leakage checks, human review log, rerun instructions and scope of conclusions. Tables should preserve numerators, denominators and participant-level summaries instead of only means. A change to input channels, hardware, firmware, scoring rules, weights, threshold or postprocessing requires an impact statement and targeted or full retesting. Monitor data drift, failure and human correction trends after deployment. GMLP and transparency guidance both address monitoring and controlled model changes.[3][4]
6. Acceptance checklist, sources and limits
6.1 Final review
The recipient should be able to verify that intended use and versions were frozen; test participants were independent of development data; reference labels and scorer disagreement are traceable; each metric fits its task and names its denominator; errors are stratified by population, device and setting; human review and no-result rates are visible; thresholds were specified in advance; and updates trigger retesting. Otherwise the conclusion remains pending. These references support design and examples; they do not establish that this guide tested any particular algorithm, earned certification or authorized clinical use.
[2] AASM Inter-scorer Reliability Fact Sheet
[3] FDA Good Machine Learning Practice principles
[4] FDA Transparency for Machine Learning-Enabled Medical Devices
[6] NSRR SHHS polysomnography introduction
[7] PhysioNet Sleep-EDF Expanded
[8] AASM Consumer Sleep Technology Position Statement
[9] Validation framework for wearable sleep stage scoring