Seizure vs. non-seizure classification on the CHB-MIT scalp EEG dataset (subject chb01).
Pipeline: 4s windowing → bandpower features (Welch PSD) → Logistic Regression vs. Linear SVM, evaluated with time-ordered splits.
- Linear SVM achieved better overall performance on the held-out future test set (Macro-F1 = 0.9012) with fewer false positives.
- Because seizure windows are rare, we report Macro-F1 in addition to accuracy to reflect performance on the minority class.
- Logistic Regression: Accuracy 0.9833, Macro-F1 0.8442
- Linear SVM: Accuracy 0.9908, Macro-F1 0.9012
Test Performance Comparison (Accuracy + Macro-F1)

- Dataset: CHB-MIT Scalp EEG Database (subject chb01)
- Source: Kaggle mirror of CHB-MIT pediatric EEG (see References)
- Data in this repo: NOT included (EDF files are large). Please download separately.
- Sampling rate: 256 Hz
- Channels available: 23 EEG derivations per EDF file
- Channel used (baseline): F7–T7 (Channel 2) to reduce computation (engineering simplification)
- Files used (7 seizure-containing EDFs):
chb01_03, chb01_04, chb01_15, chb01_16, chb01_18, chb01_21, chb01_26
Sample unit: one 4-second EEG window (from the selected channel)
Label unit: one binary label per window
1= seizure (window overlaps an annotated seizure interval)0= non-seizure
For each 4-second window, we compute Welch Power Spectral Density (PSD) and convert the raw waveform into a small feature vector.
- Features: band powers in standard EEG bands: delta, theta, alpha, beta
- Feature dimension: 4 features per window
- Implementation: see the notebook for details
In short: PSD → average/integrate power within each frequency band → features.
- Logistic Regression (L2)
- Linear SVM (LinearSVC)
Both models use:
- StandardScaler for feature standardization
- TimeSeriesSplit (walk-forward CV) for hyperparameter tuning on the training portion only
- Train/Test split: time-ordered 80/20 (future is never used to predict the past)
- Cross-validation: walk-forward TimeSeriesSplit on training data
- Metrics: Accuracy, Macro-F1, Confusion Matrix
-
Download the CHB-MIT dataset (EDF + summary file) from Kaggle/PhysioNet.
-
Create a folder named
chb01/at the repo root, and put the EDF files inside:chb01/chb01_03.edf
chb01/chb01_04.edf
chb01/chb01_15.edf
chb01/chb01_16.edf
chb01/chb01_18.edf
chb01/chb01_21.edf
chb01/chb01_26.edf -
Install dependencies:
pip install -r requirements.txt
-
Open
EEG_SeizureDetection.ipynb -
Set
DATA_DIR(default isPath("chb01")), then run all cells.
EEG_SeizureDetection.ipynb— main notebook (full pipeline)assets/— figures (confusion matrices, comparison plot)
- Single subject only — trained and evaluated on chb01; results may not generalize to other patients without retraining.
- Single channel — uses only F7–T7 (Channel 2). Multi-channel analysis would likely improve performance.
- Simple features — only bandpower in four standard EEG bands. Does not include gamma band, spectral ratios, nonlinear features (e.g., sample entropy), or time-domain statistics beyond mean/std.
- Linear models only — no nonlinear classifiers (Random Forest, XGBoost, CNN/LSTM) were explored.
- No class imbalance handling — seizure windows are ~2% of the data, but no oversampling, undersampling, or
class_weightadjustment was applied. - No EEG preprocessing — no bandpass filtering or artifact rejection prior to feature extraction.
- Small positive sample size — only ~115 seizure windows total, which limits statistical reliability.
