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

Dynamic Compression Platform for Live Imaging of Scaffold-Transmitted Cellular Mechanoresponses

Mechanical characterization of biomaterial scaffolds is essential to evaluate their capacity to meet the functional demands of target tissues in tissue engineering and regenerative medicine applications. Scaffolds designed to interface with living tissues must support the transmission of mechanical cues to resident cells and stimulate mechanosignaling pathways that are essential to their function. In joints, bone and cartilage cells act as primary mechanosensors, converting mechanical stimuli into biochemical signals that regulate tissue homeostasis and remodelling. Therefore, evaluating cellular mechanoresponses to scaffold-transmitted compression in vitro can inform the development of functional tissue-engineered constructs. For example, poly({epsilon}-caprolactone) (PCL) scaffolds are highly relevant for bone and cartilage tissue engineering due to their biocompatibility, stable mechanical properties and slow degradation. Here, we applied a custom-built device to study compression-induced mechanosignaling in MC3T3-E1 pre-osteoblast cells. The device is composed of a polydimethylsiloxane (PDMS) pillar, a force-sensing load cell, and a piezoelectric linear track. A protocol is described in which MC3T3-E1 cells are repeatedly compressed, while in parallel live tracking of force measurements and live imaging of intracellular calcium dynamics in MC3T3-E1 cells are recorded. PCL scaffolds fabricated by melt electrowriting (MEW) were subsequently integrated into the platform. Scaffold-transmitted compression triggered dynamic increases in cytosolic calcium; in MC3T3-E1 cells located directly under the PCL microfibers, but also in cells located in the interfiber spaces. This device and workflow facilitate in vitro investigations of real-time cellular mechanoresponses to dynamic compression applied with biomaterial scaffolds, and provides a testing platform for evaluating the mechanotransductive properties of scaffolds intended for tissue engineering applications.

bioengineering↗

Ultrasound Tracking Reveals Progressive Regional Strain Differences in Human Achilles Tendons During Fatigue Loading

Ultrasound is commonly used to assess structural changes in symptomatic Achilles tendons, but quantitative biomechanical metrics for progressive tendon deterioration remain limited. The goal of this study was to develop and validate an automated ultrasound tracking algorithm for regional tendon deformation and evaluate strain progression in survived and ruptured tendons during fatigue loading. We hypothesized that maximum strain, average strain, and strain heterogeneity would exhibit different trajectories between groups. Ten cadaveric Achilles tendons underwent cyclic loading with stress tests every 500 cycles until rupture or 150,000 cycles. Ultrasound images acquired during stress tests were analyzed using an automated tracking algorithm to generate spatially resolved regional strain fields. Ultrasound-derived bulk strain was highly correlated with actuator-derived strain in survived (R^2 = 0.968 +/- 0.017) and ruptured tendons (R^2 = 0.972 +/- 0.014). Maximum and average longitudinal strains progressively diverged between groups across fatigue life (Group x FatigueLife: p = 0.003 and p < 0.0001, respectively). During the first 10,000 cycles, average strain decreased in survived tendons ({beta} = -0.0268%, p = 0.0215) but not ruptured tendons ({beta} = 0.0147%, p = 0.1197), with a significant Group x Cycle interaction (p = 0.0061). This study demonstrates that the algorithm quantified Achilles tendon deformation with high fidelity and enabled spatially resolved strain assessment throughout fatigue loading. Maximum and average strain followed different trajectories between groups, whereas strain heterogeneity did not. Early differences in tendon biomechanics suggest that regional strain behavior may change before pronounced differences in absolute magnitude develop.

bioengineering↗

Brain organoid computing for robotic decision-making

Biomimicry has inspired the evolution of robotics toward greater autonomy, adaptability, and symbiosis with humans and dynamic environments. However, current robotic systems still face major challenges in recapitulating the high-efficiency decision-making capabilities of the human brain under complex and dynamic conditions. Here, we present Brainobot, a biohybrid robotic system that establishes a brain organoid controller as a high-level robotic decision-making layer for closed-loop embodiment. By leveraging brain organoid reservoir computing, Brainobot interacts with dynamic environments by receiving and processing sensory inputs and generating motor actions. As a proof-of-concept demonstration, Brainobot is implemented in a humanoid robotic system to perform real-world tasks, including object grasping and laser chasing. Interestingly, Brainobot exhibits unique features, including cross-task adaptivity, high computing efficiency, and low energy consumption. Thus, our approach may provide insights for advancing robotic embodiment and understanding biological decision-making.

bioengineering↗