Skip to content

EEG-based ADHD Detection with CNNs — machine learning thesis by Garv Malik.

B.Tech Final Thesis · BML Munjal University · 2024

Can a machine read a child's brainwaves and detect ADHD? We built a CNN and tested seven ML models against 19-channel EEG from 121 children — reaching 98.53% accuracy.

Machine LearningDeep LearningEEG Signal ProcessingCNNPythonADHD Research
RoleSole Researcher & Author
SupervisorDr. Devanjali Relan, BML Munjal University
PeriodMarch – July 2024
TypeB.Tech Final Thesis (CS)

Key Results

98.53%

CNN accuracy at 3000 epochs

5-block CNN with batch normalisation, LeakyReLU, max-pooling, and dropout layers. Validated with 10-fold cross-validation on 19-channel EEG data.

98.5%

LightGBM — best traditional ML

Gradient boosting on 13 extracted time-domain features with StandardScaler preprocessing. Outperformed 6 other classifiers including XGBoost (97.8%) and Random Forest (81%).

121

Children in the dataset

61 diagnosed with ADHD, 60 controls. Ages 7–12. EEG recorded at 128 Hz across 19 channels during a visual attention task designed specifically for children.

The CNN's advantage came from automatic hierarchical feature extraction — it learned spatial and temporal patterns directly from raw EEG without hand-engineering features, matching what gradient boosting needed 13 manually extracted features to achieve.

The Problem

ADHD affects millions of children. Diagnosis today still relies on subjective behavioural checklists.

"Early detection is very important for effective intervention — EEG signals offer a great way to objectively classify ADHD based on characteristic brain wave patterns."

Attention Deficit Hyperactivity Disorder is a prevalent neurodevelopmental condition that primarily impacts children and can persist into adulthood. It affects learning, social interaction, and quality of life — yet accurate early diagnosis remains challenging due to its reliance on clinician observation and parent/teacher reports.

Electroencephalography (EEG) captures brain electrical activity non-invasively. Prior research showed ADHD produces distinct brainwave signatures — the goal of this thesis was to automate that detection with machine learning.

Dataset

121

Children total

61/60

ADHD / Control

7–12

Age range (years)

19

EEG channels

EEG Setup

Sampling rate: 128 Hz

19 channels: Fz, Cz, Pz, C3, T3, C4, T4, Fp1, Fp2, F3, F4, F7, F8, P3, P4, T5, T6, O1, O2

Standard 10-20 electrode placement system

ADHD diagnoses by psychiatrists via DSM-5 criteria

Recording Task

Children viewed images of cartoon characters and counted them (5–16 per image). After each response, the image was immediately replaced — maintaining constant visual attention stimulation throughout the recording.

Recording duration varied per child based on performance. Gender-balanced: 98 boys (48 ADHD, 50 control), 23 girls (13 ADHD, 10 control).

ML Pipeline

01 — Signal Preprocessing

Raw EEG files loaded from ADHD and control folders. Unnecessary columns stripped, channel names assigned to 10-20 standard placement. MNE library used to construct RawArray objects at 128 Hz. Continuous recordings segmented into 6-second epochs for analysis.

02 — Feature Extraction

13 time-domain statistical features computed per channel per segment: mean, standard deviation, variance, peak-to-peak, min, max, arg-min, arg-max, RMS, absolute difference, skewness, kurtosis. Each EEG segment became a 1D feature vector for the ML models.

03 — Traditional ML Evaluation

7 classifiers evaluated with 6 preprocessing scalers each: MinMaxScaler, StandardScaler, MaxAbsScaler, PowerTransformer, QuantileTransformer, Normalizer. 80/20 train-test split with 10-fold cross-validation. Models: Extra Trees, Random Forest, XGBoost, LightGBM, Gradient Boosting, AdaBoost, Logistic Regression.

04 — CNN Model

5-block CNN trained directly on raw EEG (no manual features needed). Each block: Conv1D(5 filters, kernel=3) → BatchNorm → LeakyReLU → MaxPool1D(pool=2) → Dropout(0.4). Followed by Dense(48) → Dense(32) → Dense(1, sigmoid). Adam optimizer (lr=0.0003), binary cross-entropy loss. 10-fold CV.

Model Comparison

Accuracy by classifier

Extra Trees
75%
Random Forest
81%
AdaBoost
90%
Logistic Regression
91%
Gradient Boosting
95%
XGBoost
97.8%
LightGBM
98.5%

CNN vs Best ML

CNN (3000 epochs)

98.53%

LightGBM + StandardScaler

98.5%

XGBoost

97.8%

CNN (50 epochs only)

78.76%

CNN Epochs vs Accuracy

50 epochs

78.76%

200 epochs

~88%

500 epochs

~93%

1000 epochs

~96%

3000 epochs

98.53%

CNN Architecture

A 5-block convolutional architecture designed to extract hierarchical temporal and spatial features from raw EEG signals without manual feature engineering.

Input

19-ch EEG segments

×5 Conv Block

Conv1D → BatchNorm LeakyReLU → MaxPool Dropout(0.4)

Flatten

3D → 1D vector

Dense

48 units 32 units ReLU + Dropout

Output

1 unit Sigmoid ADHD / Control

Training Configuration

Optimizer

Adam

Learning rate

0.0003

Loss

Binary cross-entropy

Validation

10-fold CV

What I Learned

This thesis was done before I pivoted to UX — but the research mindset it built has been inseparable from my design work ever since. Running a full ML pipeline from raw signal data to validated model taught me what it actually means to work with evidence.

The most interesting tension was CNN vs gradient boosting. Both hit ~98.5%, but through completely different routes — one through hand-crafted features, the other through automatic representation learning. Watching a model learn better features than I could engineer manually was a turning point.

Design connection

ADHD affects how children interact with any interface — attention span, impulsivity, response latency. Having studied it at a signal level makes me think differently about accessible and neurodiverse-inclusive design. The quantitative rigor here feeds directly into how I frame research questions in UX studies.

Full ML pipeline: preprocessing → feature extraction → model selection

EEG signal analysis with MNE library

Cross-validation methodology and avoiding data leakage

Interpreting model performance beyond accuracy (overfitting, generalisation)

Full thesis document

EEG-based ADHD Classification using Machine Learning

BML Munjal University · B.Tech Practice School III · July 2024 · 25 pages

Download PDF ↓

Open to UX/UI internships — Finland & Europe

Interested in working together?

thegarvmalik@gmail.com