"A Computational Neuroscience pipeline utilizing Wavelet Transforms and Gradient Boosting to automate the detection of epileptic biomarkers in cortical EEG signals. Engineered for high-interpretability in clinical neuro-diagnostics."
๐ง Automated EEG Seizure Detection: Signal Dynamics & Machine Learning Pipeline. This repository contains a high-performance computational neuroscience pipeline designed to detect epileptic seizures in raw EEG telemetry. The project focuses on Multi-Domain Feature Extraction, using temporal and spectral characteristics of brain waves to automate clinical diagnostics.
๐ฌ Project Overview: The "Why"Epileptic seizures are characterized by sudden, hyper-synchronous electrical discharges in the brain. Manual identification of these events in hours of EEG recordings is:Time-Consuming: Requires hours of expert neuro-physiologist review. Subjective: Prone to human error due to fatigue or subtle signal artifacts.Our Goal: To build an In-Silico diagnostic engine that can accurately differentiate between Ictal (Seizure) and Inter-ictal (Normal) states using advanced signal processing and ensemble learning.
๐ The Dataset: Where & What?Source: The project utilizes data based on the UCI Epileptic Seizure Recognition Dataset (originally derived from the University of Bonn EEG database).Data Characteristics:Type: Multi-channel Time-Series data.Dimensions: 178 data points per second (1 second of brain activity per row).Classes: Originally 5 classes (Eyes open, Eyes closed, Tumor region, Non-tumor, Seizure).Preprocessing: We binarized the task into Seizure vs. Non-Seizure to improve clinical relevance for emergency alert systems.
๐ ๏ธ The Pipeline: Step-by-Step
- Signal Preprocessing & Cleaning. EEG data is notoriously "noisy" due to muscle movements or electrode interference.Solution: We implemented digital filters to stabilize the baseline and focused on the 0.5Hz - 40Hz frequency range, where the most vital brain rhythms reside.
- Feature Engineering (The Scientific Core)Raw voltage values aren't enough. We decomposed the signals into biological frequency bands:Delta (<4Hz): Deep sleep/Pathological. Theta (4-8Hz): Drowsiness.Alpha (8-13Hz): Relaxed wakefulness.Beta (13-30Hz): Active thinking/Alertness.
- Training & Testing Strategy
- Split: 80% Training / 20% Testing.Algorithm: Gradient Boosting Classifier. We chose this because it excels at finding non-linear patterns in tabular features compared to simple linear models. Optimization: Used K-Fold Cross-Validation to ensure the model isn't just "memorizing" one patient but generalizing across different neurological profiles.
- ๐ Evaluation: Confusion Matrix & Metrics. To ensure the model is "PhD-Ready," we don't just look at accuracy.Precision/Recall: Critical because a "False Negative" (missing a seizure) is dangerous in a clinical setting.
- Confusion Matrix: Our matrix shows high sensitivity for the Seizure class, ensuring minimal missed events.
โ ๏ธ Problems Faced & Solutions.- Problem: Technical Solution. Class Imbalance: Seizures are rare compared to normal activity.Applied Stratified Sampling to ensure the model sees enough seizure examples during training.Signal Overlap: Normal Beta waves can sometimes look like high-frequency seizure spikes.Integrated Signal Entropy as a feature to measure the "chaos" in the wave, which is much higher during a seizure.High Dimensionality: 178 features per second can be redundant.Used Feature Importance Ranking to drop irrelevant noise and keep only the most "bio-relevant" frequency markers.
- ๐ How to UseClone the Repo: git clone https://github.com/yourusername/EEG-Seizure-DetectionRun the Notebook: Open EEG_Pipeline.ipynb in Google Colab.Inference: Load eeg_seizure_detector.pkl to run predictions on new clinical data.
- ๐ Impact for Researchers
- This project demonstrates a scalable way to monitor patients remotely. By identifying the specific frequency band (e.g., Delta Surge) responsible for a prediction, we provide "Explainable AI" that doctors can trust.