biomed-ml.
Modular biomedical ML pipeline — first module: Bonn EEG seizure detection, designed so configs are declarative and group leakage cannot inflate validation metrics.
overview
biomed-ml is a modular biomedical ML pipeline with interchangeable dataset loaders, feature extractors, and classifiers driven by YAML configs and covered by pytest. Its first implemented module detects epileptic seizures in Bonn EEG recordings (11,500 one-second segments at 173.61 Hz), reaching F1 = 0.938 (0.9376) and ROC-AUC = 0.995 (0.9951) under group-aware 5-fold cross-validation. You can test the exact Welch PSD + 300-tree Random Forest pipeline directly in BioVanta EEG Analysis Studio.
problem
If 1-second EEG segments from the same recording appear in both train and test folds of a random split, the model leaks recording-specific background patterns and artificially inflates F1. biomed-ml enforces recording-grouped cross-validation by default.
data
- first module — Epileptic seizure detection on Bonn University EEG data (500 recordings)
- segments — 11,500 one-second (178-sample) segments at 173.61 Hz across 5 sets (S, F, N, O, Z)
- task & baseline — Binary classification (ictal S vs non-seizure F/N/O/Z), 20% positive (trivial baseline 0.80 accuracy, 0.00 recall)
- features — 21 features per segment (10 time-domain statistics + 11 Welch PSD band features)
method
Each experiment runs from an explicit YAML specification using 5-fold StratifiedGroupKFold (seed 42), keeping all 23 segments of each Bonn recording in a single fold. Random Forest (300 trees) and Logistic Regression are benchmarked under identical splits.
results & the leakage lesson
Group-aware 5-fold CV: Random Forest accuracy 0.9748, F1 = 0.9376, ROC-AUC = 0.9951 (Logistic Regression: F1 0.9217, ROC-AUC 0.9915).
The amber bar demonstrates why leaky splits deceive: +0.0204 higher F1 comes from train/test recording leakage, not better generalization.
limitations
Bonn University EEG is the framework's first module and contains short, artifact-free segments without patient-level IDs (grouped by recording). Not validated on continuous clinical EEG or intended for diagnosis.