Sleep timing estimation from smartphone context information
Almost one third of our lives is spent sleeping and yet many of us struggle finding consistent high-quality sleep. At the same time, smartphones have become our ubiquitous companions, filled with sensors, processing power, and wireless connectivity. Our proposed sleep timing estimation approach uses smartphone sensor information to estimate daily sleep timing. We evaluated our approach in a two-week free-living study of 13 participants and sensor data simulations of arbitrary sleep schedules, amounting to 98280 nights. Five intuitive sleep parameters were derived to control the simulation. Online retraining was used to perform model personalisation from on user feedback. Joint data and expert models showed an average relative estimation error of -2±62 min for sleep onset and -5±70 min for wake (absolute errors 40±48 min and 42±57 min), which significantly outperforms data-only methods. Our power-efficient smartphone app makes convenient everyday sleep monitoring finally realistic.
Video summary
Sleep detection from smartphone context information: Project video.
Sleep detection methodology
Our proposed sleep timing estimation algorithm uses two data-only classification models to distinguish sleep and wake with 5-minute resolution. Data-only model outputs are fused by the expert model which is based on the Two Process Model (TPM) by Daan et al., 1984. From the TPM output sleep timing is subsequently extracted using peak detection.

Sleep detection architecture. Data-only models are used sleep/wake classification and are used as inputs for the TPM-based expert model. The expert model performs fusion and sleep timing extraction.
Two process Model
The Two Process Model (TPM) uses data-only model outputs as inputs and models sleep pressure for sensor and time models separately. Classifier outputs for time and sensor models are shown in top plots of video below. Resulting TPM homeostatic and circadian outputs are shown on the bottom plot. Markers show estimated sleep timing.
Data-only model and Two Process Model outputs.
Two process model Python package
Our Python implementation of the Two Process Model is available online in the Python Package in the Python package index (PyPI).
It can be installed by running pip install twoprocessmodel
.
The code is published under the MIT License and you are invited to contribute to the project or create your own fork on GitLab.
If you use this package or adapt the code, please cite:
[1] Florian Wahl and Oliver Amft. 2018. Data and Expert Models for Sleep Timing and Chronotype Estimation from Smartphone Context Data and Simulations. Proc. ACM Interact. Mob. Wearable Ubiquitous Technol. 2, 3, Article 139 (September 2018), 28 pages. DOI: https://doi.org/10.1145/3264949
[2] S. Daan, D. G. Beersma, and Alexander A. Borbély. 1984. Timing of Human Sleep: Recovery Process Gated by a Circadian Pacemaker.
American Journal of Physiology – Regulatory, Integrative and Comparative Physiology 246, 2 (Feb. 1984), R161–R183.
Model personalisation
Sleep behaviour and environments are very dynamic, thus it is challenging to build a model which generalises to a wide range of individuals. And even within an individual, sleep environments or habits can change, e.g. through moving, travel, or social obligations. Out proposed coping strategy is to start off with a generalised model and use user feedback from daily notifications to personalise the model to user behaviour over time. In our evaluation we found performance improvements of over 50% for personalisation using just two days user feedback.
Demonstration of model personalisation over 23 days for the time data-only model.
Publications
[publication-list ids=”8WQV7VXW”]
Contact
Florian Wahl
- Job title: External Researcher
- Phone number: +49 9131 85-23601
- Email: florian.wahl@gmail.com