Skip to content
Somnibeat

Research prototype · not a diagnostic tool

Method & evaluationMethod

One heartbeat‑interval file.
A look at last night's sleep.

Get total sleep time, sleep efficiency, wake bouts and suspected sleep-apnea minutes, plus how far this kind of estimate can differ from a hospital sleep study.

Optional clock times

With the recording start time, the chart shows clock times. Lights off and lights on limit the analysis to time in bed and need the recording start time.

Your file is never sent to a server; everything is computed in this browser. Expected columns: time_s, rr_ms.

Only have the raw ECG (for example an EDF file from a sleep lab or Holter)? Convert it to this file with scripts/ecg_to_rr.py.

Drop an RR CSV file here
Total sleep time
— h — m
Sleep efficiency
— %
Layout example, not real data.

Sample nights

Real overnight recordings from open research datasets. Choose one to see a full report.

Loading samples…

File:

Computing in your browser

Nothing leaves this device. This usually takes a few seconds.

  1. Reading the fileWaiting
  2. Finding usable heartbeatsWaiting
  3. Computing 30-second and 10-minute featuresWaiting
  4. Building the reportWaiting

Night report

File: Try another file

Model: —

Switching recomputes this report in your browser with the other model.

Research prototype. Do not use it for diagnosis or treatment decisions. The results below can differ from a hospital sleep study.

Development stub: these numbers are synthetic, not real results.

Total sleep time

—

Time judged asleep between lights off and lights on

Sleep efficiency

—

Share of time in bed judged asleep

Wake bouts

—

Number of awake stretches during the night

Suspected apnea

—

Minutes with suspected breathing events

Sleep stages across the night

Somnibeat estimate from heartbeats

Sleep lab (polysomnography, scored by experts)

    Compare with the sleep lab

    Stages are shown by row position and text labels as well as color.

    How far can you trust this?

    Errors against hospital sleep studies, measured on recordings the model never saw during training.

    Side by side on the same nights: v2, v1 and a trivial rule

    See full method & evaluation

    Total sleep time: estimate vs. sleep study

    Total sleep time error: v2, v1 and a trivial rule (asleep from lights off)

    Known limitations

      Full evaluation: Method & evaluation

      Try a sample Back to report

      Method & evaluation

      How the report is computed, what it was tested on, and where it can fail.

      Pipeline

      1. 1. RR intervalsTime between heartbeats, from your CSV, cleaned of implausible values and artifacts
      2. 2. 30-second epochsMean, variability and change versus neighbouring epochs; v2 adds 10-minute windows around each epoch
      3. 3. ClassifierGradient boosting and logistic regression, no deep nets; v2 smooths stages over the whole night
      4. 4. ReportSleep time, efficiency, wake bouts, apnea minutes

      Data

      All datasets are open. Most recordings are from sleep-clinic patients, so results may not carry over to healthy sleepers.

      Evaluation design (v1)

      • Splits are by recording and by subject, so one person never appears on both sides.
      • Stage models train on CAP and MIT-BIH and are tested on UCDDB; the apnea model trains on Apnea-ECG and is tested on UCDDB.
      • The test set is never used to fit, normalize, select features, pick thresholds or choose models. Each model predicts it once.
      • Operating thresholds are fixed on out-of-fold predictions from the training data only.
      • Errors are estimate minus reference, with record-level bootstrap 95% intervals and Bland–Altman plots.
      • Every model is compared with a trivial rule scored on the same epochs.
      • Seeds and configs are fixed; one command rebuilds every number.

      v2: chosen on training data, frozen, tested once

      v2 and v1 on the test sets

      Suspected apnea minutes

      Excluded recordings

      v2 total sleep time on HMC, primary (Bland–Altman)

      v2 suspected apnea minutes on UCDDB (Bland–Altman)

      v1 results, first look (UCDDB)

      External test on UCDDB. Lower error is better; higher kappa is better.

      v1 total sleep time (Bland–Altman)

      v1 suspected apnea minutes (Bland–Altman)

      R-peak detector validation

      Who benefits, and who could be harmed

      Who may benefit

      People who already have overnight heart recordings, sleep researchers and clinicians who want a quick first look at sleep from a heartbeat file.

      Who could be harmed

      Someone falsely reassured when apnea is missed, someone needlessly worried by a false alert, or anyone treating this research prototype as a diagnosis. Real heartbeat files should not appear in public videos or screenshots.

      Limitations

        Reproduce

        make reproduce

        Downloads the datasets, trains, evaluates and rewrites every number on this page. Code: source repository

        Back to start

        File problem

        We couldn't use this file

        • The file needs a header row with columns named time_s and rr_ms.
        • RR values should be in milliseconds, one row per heartbeat.
        • time_s is the time of each beat in seconds since the recording started, increasing row by row.
        • The recording needs enough hours of beats to make a report.

        Expected format

        time_s,rr_ms

        Research prototype · not a diagnostic tool

        Evaluation method and code: source repository