Challenge Data

Predict brain deep sleep slow oscillation
by Dreem

Register or login to participate !



Started on Jan. 1, 2019

Challenge context

Measuring Sleep

The measurment of sleep is usually done in a sleep laboratory. Various electrods are attached to the head to measure physiological signals. Electrical activity in the brain is measured by electroencephalography (EEG). Muscle activity is recorded using electromyography (EMG), because muscle tone also differs between wakefulness and sleep. Eye movements during sleep are measured using electro-oculography (EOG). Other sensors can be added (pulseoxymeter, airflow etc.) These procedure is called polysomnographie (PSG) and allows to analyse the state of the patient during sleep. It also allows to track sleep related disease such as sleep apnea or restless-leg syndrom.

Dreem Headband

Dreem headband is a device able to measure sleep at home. It is easy to use and confortable compared to a classic PSG. Its aims to help people track and improve their sleep. The Dreem headband uses three kind of sensors: EEG electrods, accelerometer and pulseoximeter. Hence, it is able to measure brain activity, position, respiration, heartrate and movement all along the night. The device is also able to send sounds using bone conduction. Signals are analyzed online throughout the night and the device is able to perform sound stimulation to enhance deep sleep quality at different steps of the night : falling asleep, deep sleep and awakening. More info at


In this challenge, data consists on EEG signals acquired on the Dreem headband in sham condition i.e. without any kind of sound stimulations. Thus we aim to predict brain activity in normal condition.

Challenge goals

Normal sleep

Sleep progresses in cycles that involve multiple sleep stages : wake, light sleep, deep sleep, rem sleep. Different sleep stages are associated to different physiological functions. The represenation of the sleep stages through the night is called an hypnogram and is built from the physiological signals recorded by PSG and analyzed by window of 30seconds. Hypnogram

Deep Sleep

Deep sleep (also called slow wave sleep) occurs mainly in the first hours of sleep. It is associated with memory consolidation, energy restoration, hormone releasing. Electroencephalographic measurement in deep sleep is characterized by slow oscillations: trains of high magnitude and low frequency waves (1-4 Hz).

Deep sleep enhancement

Deep Sleep can be enhanced by inducing slow oscillations through various kind of stimulations (auditory, visual, magnetic etc. see this publication). The Dreem headband is able to perform such sound stimulation during deep sleep.


In this dataset, we try to predict whether or not a slow oscillation will be followed by another one in sham condition, i.e. without any stimulation. This will allow to:

  • Predict normal brain activity
  • Know when it’s interesting to stimulate
  • Better quantify the impact of an individual stimulation by comparing to what would have occurred without stimulation.

Data description


Each sample represents 10 seconds of recording starting 10 seconds before the end of a slow oscillation. Data provided consists of a N x 1261 matrix.


  1. Number of previous slow oscillations
  2. Mean amplitude of previous slow oscillations
  3. Mean duration of previous slow oscillations
  4. Amplitude of the current slow oscillation
  5. Duration of the current slow oscillation
  6. Current Sleep stage
  7. Time elapsed since the person fell asleep
  8. Time spent in deep sleep so far
  9. Time spent in light sleep so far
  10. Time spent in rem sleep so far
  11. Time spent in wake sleep so far
  12. to 1261. EEG signal for 10 seconds (sampling frequency: 125Hz -> 1250 data points)


The prediction is a label in {0, 1, 2}.

  1. no slow oscillation is starting in the following second.
  2. a slow oscillation of low amplitude started in the following second.
  3. a slow oscillation of high amplitude started in the following second

High and low are defined with respect with the mean amplitude of slow oscillations measured on the whole record.

Benchmark description


from sklearn.ensemble import RandomForestClassifier
import pandas as pd

X_train = h5py.File("X_train.h5", "r")
y_train = pd.read_csv("y_train.csv").as_matrix()[:, 1].squeeze()
X_test = h5py.File("X_test.h5", "r")


def extract_features(h5):
    data = h5["features"][:]
    features = []
    features.append(data[:, :11])
    features.append(data[:, 11:].max(1).reshape(-1, 1))
    features.append(data[:, 11:].min(1).reshape(-1, 1))
    features.append(np.abs(data[:, 11:]).mean(1).reshape(-1, 1))
    features = np.concatenate(features, 1)
    return features


features_train = extract_features(X_train)
clf = RandomForestClassifier(n_estimators=10), y_train)


features_test = extract_features(X_test)
y_pred = clf.predict(features_test)
with open("y_benchmark.csv", "w") as f:
    f.write("".join(["id,label\n"] + ["{},{}\n".format(i, y) for i, y in enumerate(y_pred)]))



Files are accessible when logged in and registered to the challenge

The challenge provider