bioRxiv Science⌕ Search

bioRxiv · 10.1101/2025.09.22.677765

Postprocessing-Enhanced Machine Learning for Reliable Real-Time Sleep Staging in Closed-Loop Neuromodulation

Abstract

Real-time sleep stage classification is important for closed-loop neuromodulation at certain stages during sleep, yet current models often yield noisy and unstable outputs that risk false triggers. These fluctuations, especially near stage boundaries, can compromise the safety and reliability of stimulation. Existing methods frequently rely on model-specific architectures or require extensive tuning to maximize precision, which limits their generalizability and hinders deployment in real-time systems. To address this, we propose a lightweight, classifier-independent post-processing pipeline that stabilizes predictions without modifying the underlying classifier. Our method first applies temporal smoothing to predicted sleep-stage probabilities, followed by conservative control logic to enhance stimulation precision. We evaluate four smoothing techniques: Moving Average (MA), Exponential Smoothing (ES), Kalman Filtering (KF), and a novel Weighted Exponential Smoothing (WES), on a 29-subject open-source sleep dataset. To capture the trade-offs between stability and responsiveness, we introduce new real-time evaluation metrics. We identify an optimal smoothing intensity range and assess three control strategies: probability thresholding, naive waiting, and entropy constraint, as well as a hybrid method combining high confidence and low uncertainty. Smoothing improves generalization and robustness: under both low and high synthetic noise ({sigma} > 0.2), smoothed outputs retain 10-15% higher precision and recall across all stages. Control logic further enhances reliability: our hybrid method achieves 80% (Wake), 96% (N2), 98% (N3), and 86% (REM) precision. Finally, we introduce a stage-transition constraint matrix to suppress biologically implausible transitions (e.g., REM[->] N3), to further stabilize outputs during evidence accumulation, with potential applications in objective sleep quality assessment. To our knowledge, this is the first study to systematically characterize real-time trade-offs between smoothing, latency, and control logic in sleep staging. Overall, our generalizable framework is expected to improve safety, interpretability, and deployment feasibility of real-time sleep classification for both clinical and wearable closed-loop neuromodulation systems.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Chae, T. S., Jeong, J., Tang, K. K. W., Moscoso-Barrera, W. D., Baird, B., Wei, X.-X., Millan, J. d. R., Wang, H.. 2025-09-24. Postprocessing-Enhanced Machine Learning for Reliable Real-Time Sleep Staging in Closed-Loop Neuromodulation. https://doi.org/10.1101/2025.09.22.677765

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related preprints

Selected for the surface: adaptive laboratory evolution for accelerated cathodic biofilm development in Cupriavidus necator

Cupriavidus necator is a metabolically versatile facultative chemolithoautotroph and a promising chassis for sustainable bioproduction from CO2. Efficient coupling of its metabolism to renewable electricity through microbial electrosynthesis (MES) requires the organism to form stable, electroactive biofilms on cathodes. This step is hindered under oxic conditions (oxic MES, oMES) by electrochemically generated reactive oxygen species (ROS), mass-transfer limitations and poor biofilm stability. Systematic strategies to improve C. necator biofilm formation on cathodes have been lacking. Here we used adaptive laboratory evolution (ALE) to address this gap. The progenitor strain colonised graphite cathodes only after an initial heterotrophic phase and formed spatially uneven biofilms whose distribution mirrored the local flow field, as resolved by micro-particle tracking velocimetry. Populations were then selected over five passages under controlled, oxygen-limited cathodic conditions. Resequencing revealed that the recovered population was genetically heterogeneous, and its dominant isolate, strain 890, was characterised in a microfluidic oMES platform. Strain 890 reached the target electrode coverage in about one day instead of six and maintained a robust biofilm at the progenitor's steady-state biovolume, whereas the multi-strain pool peaked higher but proved unstable. Relative to the progenitor, the accelerated biofilm phenotype of strain 890 is driven by a single novel mutation in a bifunctional diguanylate cyclase/phosphodiesterase locus, which likely encodes a central regulator of the planktonic-to-biofilm transition. The steady-state biovolume itself remained bounded, most probably due to a mass-transfer ceiling set by the counter-directional supply of H2 and O2. This work shows that ALE renders the initial-attachment barrier of cathodic biofilm formation genetically tractable, providing strain 890 as a robust chassis and a well-defined starting point for oMES-based CO2 valorisation.

bioengineering↗

Engineering a High-Fidelity CRISPR-Cas13d System for Targeted RNA Depletion in Plasmodium falciparum

Functional genomics in Plasmodium falciparum is severely constrained by the evolutionary absence of an endogenous RNA interference pathway and the requirement for time-consuming direct target locus modification by conventional conditional genetic engineering systems. To overcome these limitations, we established a programmable post-transcriptional gene silencing system in P. falciparum using High-Fidelity RfxCas13d (HF-RfxCas13d), an RNA-guided RNA nuclease that has been previously tested in several eukaryotic hosts. Using CRISPR-SpyCas9 we integrated a HF-RfxCas13d expression cassette at the dispensable pfs47 locus and generated a stable marker-free transgenic line capable of constitutive HF-RfxCas13d cytosolic expression without impairing intraerythrocytic asexual growth. Episomal delivery of single or dual guide RNAs (gRNAs) achieved significant target mRNA depletion (41%-76%) across three endogenous loci atp4, ap2-exp, ap2-g genes. Applying this system to the master transcriptional regulator of gametocytogenesis (ap2-g) resulted in transcript depletion that functionally impaired sexual differentiation in committed parasites, reducing significantly the Sexual Conversion Rate a 70%. Overall, our novel HF-Cas13d line provides a flexible, scalable, and non-locus-modifying addition to the P. falciparum genetic toolbox to accelerate functional genomics and malaria drug target identification.

bioengineering↗

DECODE: DEcomposition of COupled and DEcoupled Brain States: Separating Structure-Coupled and Structure-Decoupled Functional Organization in Alzheimers Disease

Brain functional activity emerges within an underlying structural scaffold. While structural network connectivity provides a relatively stable anatomical backbone for large-scale communication, functional interactions are high-dimensional and temporally dynamic, forming recurrent patterns that can be represented in a latent space of transient functional states. Yet, how these transient functional states are organized and the extent to which they remain constrained by structural network connectivity or become relatively decoupled from structural organization over time remain poorly understood. To address this gap, we introduce DECODE (DEcomposition of COupled and DEcoupled Brain States), a data-driven latent-space framework that uses independent component analysis (ICA) and multimodal data to decompose resting-state dynamic functional network connectivity into a lower-dimensional representation of transient functional states. These states capture temporally varying structure-coupled and structure-decoupled patterns using diffusion MRI-derived structural network connectivity priors. Structure-coupled states reflect functional configurations more strongly anchored to major structural motifs, whereas structure-decoupled states represent configurations less constrained by the identified structural organization, while potentially remaining within structurally defined dynamical bounds. DECODE identifies reproducible structure-coupled and structure-decoupled states, with mean squared error reconstruction of dynamic information < 0.1 and adjusted R-squared = 0.4. Applied to Alzheimers disease (AD), DECODE revealed stronger group differences (FDR-corrected p-value 0.05) in both connectivity organization and temporal dynamics for decoupled states. These findings suggest that functional states less constrained by identified structural organization may be more vulnerable to AD-related disruption, whereas structure-coupled states may be relatively preserved. More broadly, DECODE provides a reproducible and generalizable framework for quantifying how functional dynamics are shaped by, or diverge from, structural organization by incorporating a latent representation of the structural connectome as an informative prior. Our findings established structural and functional alignment variation by distinguishing dynamic functional patterns closely coupled with structure from those that deviate from it.

bioengineering↗