/sleep-linear

EEG

Primary LanguageJupyter NotebookMIT LicenseMIT

Do not 😴 on linear models

Simple and Interpretable Techniques Outperform Deep Learning for Sleep Scoring

Code from the paper Do Not Sleep on Linear Models: Simple and Interpretable Techniques Outperform Deep Learning for Sleep Scoring.

Preprint: https://arxiv.org/abs/2207.07753


How is the code structured?

For each dataset you can find a separate notebook in the notebooks folder.

The notebooks allow to reproduce the results as they contain;

  1. data loading (see code in src folder)
  2. pre-processing & feature extraction
  3. (seeded) machine learning experiments
notebook dataset
SleepEDF-SC +- 30min.ipynb SC-EDF-20 & SC-EDF-78
SleepEDF-ST SC-EDF-ST
MASS-SS3 MASS SS3

How to install the requirements?

This repository uses poetry as dependency manager.
A specification of the dependencies is provided in the pyproject.toml and poetry.lock files.

You can install the dependencies in your Python environment by executing the following steps;

  1. Install poetry: https://python-poetry.org/docs/#installation
  2. Install the dependencies by calling poetry install

How to download the datasets?

This work uses 4 (sub)sets of data;

  • SC-EDF-20: first 20 patients (40 recordings) of Sleep-EDFx - Sleep Cassette
  • SC-EDF-78: : all 78 patients (153 recordings) of Sleep-EDFx - Sleep Cassette
  • ST-EDF: all 22 patients (44 recordings) of Sleep-EDFx - Sleep Telemetry
  • MASS SS3: all 62 patients (62 recordings) of the MASS - SS3 subset

Contains the the SC-EDF-20, SC-EDF-78, and ST-EDF subset.

You can download & extract the data via the following commands;

mkdir data
# Download the data
wget https://physionet.org/static/published-projects/sleep-edfx/sleep-edf-database-expanded-1.0.0.zip -P data
# Extract all data
unzip data/sleep-edf-database-expanded-1.0.0.zip -d data

Contains the MASS SS3 subset.

In order to access the data you should submit a request as is described here; http://ceams-carsm.ca/mass/