eegFloss: A Python package for refining sleep EEG recordings using machine learning models

Niloy Sikder, Paul Zerr, Mahdad Jafarzadeh Esfahani, Martin Dresler, Matthias Krauledat
7/8/2025
cs.LGeess.SPq-bio.QM

No official code found. Best implementation: Niloy333/eegFloss (19 stars, MIT, last commit 2026-04-13).

Abstract

Electroencephalography (EEG) allows monitoring of brain activity, providing insights into the functional dynamics of various brain regions and their roles in cognitive processes. EEG is a cornerstone in sleep research, serving as the primary modality of polysomnography, the gold standard in the field. However, EEG signals are prone to artifacts caused by both internal (device-specific) factors and external (environmental) interferences. As sleep studies are becoming larger, most rely on automatic sleep staging, a process highly susceptible to artifacts, leading to erroneous sleep scores. This paper addresses this challenge by introducing eegFloss, an open-source Python package to utilize eegUsability, a novel machine learning (ML) model designed to detect segments with artifacts in sleep EEG recordings. eegUsability has been trained and evaluated on manually artifact-labeled EEG data collected from 15 participants over 127 nights using the Zmax headband. It demonstrates solid overall classification performance (F1-score is approximately 0.85, Cohens kappa is 0.78), achieving a high recall rate of approximately 94% in identifying channel-wise usable EEG data, and extends beyond Zmax. Additionally, eegFloss offers features such as automatic time-in-bed detection using another ML model named eegMobility, filtering out certain artifacts, and generating hypnograms and sleep statistics. By addressing a fundamental challenge faced by most sleep studies, eegFloss can enhance the precision and rigor of their analysis as well as the accuracy and reliability of their outcomes.

View on arXivView PDF

Code Implementations(1)

Niloy333/eegFlossCommunity100%
MIT

A Python package that can automatically identify artifacts in sleep EEG signals and detect data usability for sleep autoscoring

191HTML, MATLABFeb 3, 20256 months agoMIT
artifact-removalmachine-learningsignal-processingsleep-eegwearables

Similar Papers

Cite this paper

@article{sikder2025eegfloss,
  title  = {eegFloss: A Python package for refining sleep EEG recordings using machine learning models},
  author = {Niloy Sikder and Paul Zerr and Mahdad Jafarzadeh Esfahani and Martin Dresler and Matthias Krauledat},
  year   = {2025},
  eprint = {2507.06433},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.06433v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.06433.svg)](https://codeofpaper.com/paper/2507.06433)

Discussion