Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Signal Classification and Event Detection in Attentional Processing

Note: Data associated with this project is derived from the study by Luna et al. (2023). Raw datasets are not included in this repository due to author rights but are available upon request (see Data Availability).

Description

This project implements Machine Learning (ML) pipelines to classify EEG frequency data, specifically focusing on detecting failures in executive and arousal vigilance. The primary objective is a binary classification task to determine if a participant is attentionally focused (1) or unfocused (0) during an ANTI-Vea task.

The analysis focuses on oscillatory rhythms across different cortical regions and frequency bands. The study isolates the critical time window for anticipatory neural activity, defined as the pre-target interval $[-300, -50]$ ms relative to target onset.

Data Architecture & Preprocessing

The dataset comprises data from 36 participants performing the ANTI-Vea task over two sessions (two consecutive days), with each session divided into 7 blocks.

Feature Engineering

The original acquisition included multiple electrodes per region (e.g., O1, Oz, O2). To reduce dimensionality and improve signal stability, spatial averaging was applied:

  1. Spatial Reduction: Electrodes were averaged into 3 distinct cortical regions.
  2. Spectral Decomposition: Signal power was extracted for 5 frequency bands.
  3. Total Features: This results in a feature vector of size 15 per trial ($3 \text{ regions} \times 5 \text{ bands}$), reduced from a potential 45 features.

Preprocessing Steps

  • Normalization: Data was normalized against baseline frequency activity.
  • Filtering: Noisy trials were excluded based on artifact rejection criteria.
  • Final Dataset: The cleaned dataset consists of approximately 7,900 samples (rows) and 15 numerical features.

Project Organization

The repository is organized to separate documentation, data analysis, and experimental workflows.

├── doc/                   # Project documentation and literature references
├── data/                  # Feature analysis outputs (Data clouds, Histograms)
│                          # Note: Raw EEG data is excluded.
├── src/                   # Source code for data processing and feature analysis
├── experiments/           # Iterative ML workflows (formerly "workflow")
│   ├── 01_global_train/       # Approach 1: General population training
│   ├── 02_participant_train/  # Approach 2: Individualized training (Best Results)
│   └── 03_session_train/      # Approach 3: Session-specific & SMOTE (WIP)
└── README.md

Methodology and Workflows

The project iterated through three distinct modeling strategies, located in the experiments directory.

1. Global Training (01_global_train)

  • Strategy: Training models on the entire concatenated dataset without participant or session stratification.
  • Models: Linear SVM, Non-linear SVM, Tree-based models, k-Nearest Neighbors (KNN).
  • Outcome: This approach yielded poor performance. The models failed to generalize or find significant correlations across the heterogeneous population of 36 participants.
  • Artifacts: Jupyter notebooks and confusion matrices.

2. Participant-Centric Training (02_participant_train)

  • Strategy: Training and evaluating models specifically for each participant to account for inter-subject variability.
  • Validation Methods:
    • train_test_split: Standard split validation.
    • cross-validation: $k$-fold cross-validation.
  • Outcome: Optimal Performance. The Random Forest classifier using Cross-Validation achieved the highest predictive accuracy and AUC scores.
  • Artifacts: Training scripts, CSV metrics logs, and ROC curves.

3. Session-Centric Training (03_session_train) (WIP)

  • Strategy: Training on single-session data to test temporal robustness.
  • Techniques:
    • Oversampling: Applied SMOTE (Synthetic Minority Over-sampling Technique) to address class imbalance.
    • Leave-One-Block-Out: Trained on blocks 1–6, tested on block 7.
  • Models: Random Forest and Linear SVM.
  • Status: Work in progress. Preliminary results favor Random Forest, but further optimization is required.

Installation

To replicate the analysis, clone the repository and install the required dependencies.

git clone https://github.com/ls-javier/signal-classification-eeg.git
cd signal-classification-eeg
pip install -r requirements.txt

Note: Ensure you have Python 3.8+ installed.

Usage

Visualizing Data Distribution

To generate feature histograms and data clouds:

python src/feature_analysis.py

Running Experiments

To run the best-performing model (Participant-Centric Random Forest):

cd experiments/02_participant_train/cross-validation
python train_rf_cv.py

Roadmap

  • Global model evaluation (Completed - Deprecated).
  • Participant-specific modeling (Completed - Best Performance).
  • Complete Session-Centric analysis (SMOTE and Leave-1-out optimization).
  • Implement Deep Learning approaches (CNN/LSTM) for raw time-series data.

References and Acknowledgment

This project is based on the experimental design and data acquisition described in:

Luna, F. G., Aguirre, M. J., Martín-Arévalo, E., Ibáñez, A., Lupiáñez, J., & Barttfeld, P. (2023). Different oscillatory rhythms anticipate failures in executive and arousal vigilance. Frontiers in Cognition, 2:1128442.

Data Availability

The raw EEG datasets used in this study are not publicly available within this repository to protect participant privacy and author rights. Researchers interested in the original data should contact the authors of the cited paper directly to request access.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Bachelor's Degree final project development

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages