Leanpub Header

Skip to main content

Hands-On Data Science Projects with Brain Signals: From Raw EEG Data to Machine Learning Models

This book is 90% completeLast updated on 2026-06-13

A hands-on, code-first journey from raw EEG signals to deep learning and

self-supervised foundation models — with a runnable Colab notebook for every

chapter.

Minimum price

$9.90

$19.98

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
About

About

About the Book

Electroencephalography (EEG) is one of the most accessible windows into the

human brain — and one of the richest sources of data for machine learning.

This book is a practical, code-first guide to building real EEG data science

pipelines, from your very first model to the cutting edge of self-supervised

foundation models.

Every chapter pairs clear explanations with a runnable Google Colab notebook,

so you can experiment with real EEG datasets (OpenNeuro, MOABB, and more) as

you read. You'll progress step by step:

- Understand EEG signals, electrodes, and montages, and run your first

end-to-end EEG machine learning application

- Set up a reproducible EEG ML project and build a traditional machine

learning pipeline — features, classifiers, evaluation

- Train deep learning models, including EEGNet and EEGConformer, for motor

imagery, P300, and other BCI paradigms

- Treat EEG as time series with modern libraries such as aeon (ROCKET,

HIVE-COTE)

- Explore self-supervised learning and foundation models for EEG with SelfEEG

(SimCLR, SimSiam)

- Design, prototype, and interpret your own custom EEG model architectures

Whether you're a student, researcher, or engineer moving from tutorials to

real projects, this book gives you a working toolkit — and the intuition

behind it — for turning raw brain signals into machine learning models you

can trust.

Author

About the Author

Xuan The Tran

Dr. Xuan-The Tran (Eric Tran) is a researcher working at the intersection of artificial intelligence, neuroimaging, and brain-computer interfaces (BCI). He holds a PhD in Engineering (Computer Science) from the University of Technology Sydney (2025). He aims to bring seven years of R&D experience in AI for healthcare and neuroimaging.

His research focuses on decoding human sensory experience from EEG and MRI signals, and on building the next generation of brain-computer interfaces through foundation models, self-supervised learning, generative AI for brain data, and mixture-of-experts architectures.

"Hands-On Data Science Projects with Brain Signals" distills this experience into a practical, code-first guide — helping students, researchers, and engineers move from raw EEG recordings to working machine learning models, one notebook at a time.

Contents

Table of Contents

Table of Contents
  • Introduction
  • Chapter 1 — Introduction to EEG Data
    • Passive vs. active EEG and the role of stimuli
    • EEG as time-series data: temporal, spectral, and spatial domains
    • EEG data structures for data science
    • Comparison with other neuroimaging modalities
    • Noise, artifacts, and why preprocessing matters
  • Chapter 2 — Run Your First EEG ML Application
    • A complete, runnable EEG ML pipeline from start to finish
    • Understanding the pipeline and interpreting results
    • Hands-on: run it yourself in Google Colab
  • Chapter 3 — EEG Machine Learning Project Setup
    • Setting up a Python virtual environment or Conda environment
    • Managing dependencies and reproducible environments
  • Chapter 4 — Traditional EEG Machine Learning Pipeline
    • Temporal features and P300 detection
    • Spectral features and mental workload classification
    • Spatial and connectivity features (CSP, PSD, HyPyP) for emotion recognition with DEAP
    • Automated benchmarking, ensembles, and hyperparameter tuning with Optuna
    • Hands-on pipelines for every feature type
  • Chapter 5 — EEG Deep Learning Pipeline
    • CNNs and EEGNet for compact BCI models
    • RNNs (GRU/LSTM) for RSVP target detection
    • Transformers: EEGformer and EEGConformer
    • State-space models (Mamba) for EEG
    • Working at scale with OpenNeuro and EEGDASH
    • Cross-subject generalization and the LOSO protocol
    • Hands-on: end-to-end EEGNet pipeline with MOABB and Braindecode
  • Chapter 6 — Consider EEG as Time-Series Data Pipeline
    • ROCKET and MiniRocket for fast, accurate classification
    • HIVE-COTE 2.0 ensembles with a time budget
    • Hands-on: end-to-end MOABB → aeon (ROCKET) pipeline
  • Chapter 7 — Self-Supervised Learning and Foundation Models for EEG
    • A primer on self-supervised learning for EEG
    • The SelfEEG toolkit: SimCLR and SimSiam
    • Hands-on: foundation-model pretraining with OpenNeuro, EEGDASH, and SelfEEG
  • Chapter 8 — Designing and Testing New EEG Models
    • A step-by-step workflow for model innovation
    • Building blocks: filters, attention, residual connections
    • Datasets, baselines, and evaluation protocols
    • Hands-on: build, benchmark, and interpret your own EEG model

Get the free Community Edition

You can get the free Community Edition in PDF or EPUB just by sharing your name and email address with the author, or you can just click this link to read a shorter sample online...

 

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub