Context:
Our healthcare client was conducting a clinical trial to evaluate sleep quality in 40 participants over 4 nights using ECG recordings. The goal is to extract sleep biomarkers, classify sleep stages (NREM, REM, Wake), and predict sleep quality using machine learning algorithms.
Resolution:
To solve this, a simple AI tool was developed by our specialized team using NeuroKit2, a Python package, the ECG signals were filtered and cleaned to remove noise/artifacts, R-peaks were detected for heart rate variability (HRV) and segmented into sleep stages as NREM: Deep sleep, REM: Dreaming phase and Wake
Train models to predict sleep quality score (1–10 scale) or classify sleep stages used Random Forest and Gradient Boosting (XGBoost).
Result:
The AI tool personalized sleep reports for each participant, identified poor sleep patterns (e.g., frequent waking, low REM) and integrated consumer health apps or clinical dashboards that classified sleep stage accuracy, correlated between predicted and actual sleep ratings and featured importance which biomarkers most influence sleep quality.