An end-to-end MATLAB pipeline classifying real clinical EEG epochs into five sleep stages at 92.6% accuracy.
A complete biomedical machine-learning pipeline that takes raw overnight EEG recordings from PhysioNet's Sleep-EDF database and automatically scores each 30-second epoch into Wake, N1, N2, N3 or REM sleep, following AASM scoring conventions. The project's hardest problem wasn't the classifier — it was getting clean, correctly-labeled training data out of a clinical file format MATLAB doesn't natively support.
A staged pipeline: custom EDF+ annotation decoding → Butterworth bandpass/notch filtering → Z-score normalization → 30-second epoch segmentation → 17-dimensional time/frequency feature extraction → One-vs-All ECOC multi-class SVM → real-time inference and hypnogram generation.
MATLAB's built-in EDF reader cannot decode annotation-only EDF+ files, which blocked label extraction entirely.
Wrote a custom binary parser for the EDF+ TAL format from the specification, synchronizing decoded labels back to the raw EEG signal.
REM sleep shares spectral characteristics with neighboring stages, making it the hardest class to separate.
Accepted the accuracy trade-off transparently — 72.8% on REM vs. 98.9% on Wake — and reported per-class results rather than a single blended number.
The trained SVM reached 92.61% overall accuracy on held-out test epochs, with per-class performance ranging from 98.9% (Wake) to 72.8% (REM), reflecting genuine physiological overlap rather than a modeling flaw.