PhysioEx: a new Python library for explainable sleep staging through deep learning.

Journal: Physiological measurement
Published Date:

Abstract

Sleep staging is a crucial task in clinical and research contexts for diagnosing and understanding sleep disorders. This work introduces PhysioEx (Physiological Signal Explainer), a Python library designed to support the analysis of sleep stages using deep learning (DL) and Explainable AI (XAI).PhysioEx provides an extensible and modular API for standardizing and automating the sleep staging pipeline, covering data preprocessing, model training, testing, fine-tuning, and explainability. It supports both low-resource devices and high-performance computing clusters and includes pretrained models based on the Sleep Heart Health Study dataset. These models support single-channel EEG and multichannel EEG-EOG-EMG configurations and are easily adaptable to custom datasets. PhysioEx also features a command-line interface toolbox allowing users to streamline the model development and deployment. The library offers a range of XAI post-hoc methods to explain model decisions and align them with expert knowledge.PhysioEx benchmark state-of-the-art sleep staging models in a standard pipeline. Enabling a fair comparison between them both on the training source and out-of-domain sources. Its XAI techniques provide insights into DL-based sleep staging by linking model decisions to human-understandable concepts, such as American Academy of Sleep Medicine-defined rules.PhysioEx addresses the need for a standardized and accessible platform for sleep staging analysis, combining DL and XAI. By supporting modular workflows and explainable insights, it bridges the gap between machine learning models and clinical expertise. PhysioEx is publicly available and installable via pip6https://pypi.org/project/physioex/., making it a valuable tool for researchers and practitioners in sleep medicine.

Authors

  • Guido Gagliardi
    Department of Information Engineering, University of Pisa, Pisa, Italy.
  • Antonio Luca Alfeo
    Department of Information Engineering, University of Pisa, Pisa, Italy.
  • Mario G C A Cimino
    Department of Information Engineering, University of Pisa, Largo Lucio Lazzarino, 1, Pisa, 56126, Italy; Bioengineering & Robotics Research Center E. Piaggio, University of Pisa, Largo Lucio Lazzarino, 1, Pisa, 56126, Italy.
  • Gaetano Valenza
  • Maarten De Vos
    STADIUS Center for Dynamical Systems, Signal Processing and Data Analytics-Department of Electrical Engineering (ESAT), KU Leuven, Leuven, Belgium. maarten.devos@kuleuven.be.