EEG Signal Classification AI Model

Inspiration

The inspiration behind this project came from my interest in artificial intelligence, neuroscience, and data analysis. I wanted to explore how machine learning could be used to analyze EEG (Electroencephalography) brainwave data and identify patterns within neural signals. Since EEG data is widely used in medical research, brain-computer interfaces, and neurological studies, I thought it would be both challenging and educational to build a model capable of processing and classifying EEG signals.

As a Computer Science student, I also wanted to gain more experience working with real-world datasets, machine learning workflows, and scientific Python libraries.


What It Does

This project is an AI-powered EEG signal classification system designed to analyze EEG scan data and train a machine learning model on extracted signal features.

The application:

  • Loads EEG scan data from .edf files
  • Processes brainwave recordings into smaller time windows
  • Extracts statistical features from EEG channels
  • Trains a machine learning classifier
  • Evaluates model performance on testing data

The goal of the project is to better understand how EEG signals can be transformed into structured data that machine learning models can analyze.

For example, feature extraction calculations include statistical measurements such as:

$$ \mu = \frac{1}{n}\sum_{i=1}^{n} x_i $$

where:

  • ( \mu ) represents the mean signal value
  • ( x_i ) represents EEG signal samples

The model also uses standard deviation calculations to measure signal variability:

$$ \sigma = \sqrt{\frac{1}{n}\sum_{i=1}^{n}(x_i - \mu)^2} $$

These extracted features help the AI model learn patterns from EEG brainwave activity.


How I Built It

I built this project using Python along with several scientific and machine learning libraries, including:

  • mne for EEG signal processing
  • numpy for numerical operations
  • scikit-learn for machine learning
  • RandomForestClassifier for AI model training

The workflow of the project included:

  1. Loading EEG .edf scan data using the mne library
  2. Extracting raw EEG channel data
  3. Breaking EEG recordings into smaller two-second time windows
  4. Extracting features from each EEG window, including:
    • Mean values
    • Standard deviation
    • Maximum signal peaks
    • Minimum signal values
  5. Converting extracted features into structured arrays
  6. Splitting the dataset into training and testing sets
  7. Training a Random Forest machine learning model
  8. Evaluating model accuracy

The project helped me better understand the complete machine learning pipeline, from preprocessing raw data to training and testing an AI model.


Challenges I Faced

One of the biggest challenges was understanding how EEG data is structured and how to properly preprocess brainwave recordings before training the model. EEG datasets are large, complex, and highly noisy, so learning how to organize the data into usable training samples required a lot of experimentation.

Another challenge was understanding feature extraction and determining which EEG characteristics would be useful for machine learning. I also learned that achieving extremely high accuracy can sometimes indicate problems such as:

  • Data leakage
  • Improper labeling
  • Overfitting
  • Identical training and testing data

At one point, the model achieved 100% accuracy because placeholder labels were being used, which taught me the importance of realistic datasets and proper model validation.


What I Learned

Through this project, I gained experience with:

  • EEG signal processing
  • Scientific Python libraries
  • Machine learning workflows
  • Feature engineering
  • AI model training and testing
  • Data preprocessing
  • Debugging and experimentation

I also learned how important data quality and labeling are in machine learning projects. Even simple AI models require careful preprocessing and evaluation to produce meaningful results.

Most importantly, this project gave me hands-on experience combining artificial intelligence with real-world biomedical data, which strengthened my interest in AI and advanced software development.


Future Improvements

In the future, I would like to improve this project by:

  • Using real EEG classification labels
  • Implementing deep learning models
  • Adding neural network architectures such as CNNs or LSTMs
  • Improving feature extraction techniques
  • Visualizing EEG brainwave activity
  • Creating a graphical interface for EEG analysis
  • Testing the model on larger datasets

My long-term goal is to continue exploring the intersection of artificial intelligence, healthcare, and neuroscience through machine learning research and development.

Built With

Share this project:

Updates