← All posts

What Does an EEG Recording Actually Look Like to a Computer?

A computer science perspective on EEG data—from raw voltages to processed signals—and why preprocessing decisions matter more than the model itself.

  • eeg
  • neuroscience
  • data-science
  • signal-processing
  • machine-learning
On this page

When I first heard people talk about EEG, I imagined the familiar image: several wavy lines moving across a screen.

Something that looked obviously like “brain activity.”

Then I started looking at actual EEG data.

That simple realization helped me understand EEG much better.

This article is my attempt to explain what those numbers represent, how they become something we can analyze, and why so many important decisions happen before a machine-learning model ever sees the data.

Figure · scalp map

Where the numbers come from: 19 electrodes on one scalp

EEG 10-20 electrode placement Fp1 Fp2 F7 F3 Fz F4 F8 C3 Cz C4 T7 T8 P3 Pz P4 P7 P8 O1 O2

Hover or focus an electrode. Letters name the lobe Fp frontal pole · F frontal · C central · P parietal · O occipital · T temporal. Odd numbers are left hemisphere, even are right, z is midline. Older papers still label T7 T8 P7 P8 as T3 T4 T5 T6 — same places, previous names.


First: what is EEG measuring?

EEG stands for electroencephalography.

Electrodes are placed on the scalp and measure tiny voltage differences related to electrical activity produced by populations of neurons. McWeeny & Norton, 2020

That wording matters.

EEG is not a camera pointed at the brain.

An electrode does not tell us:

“This person is thinking about food.”

or:

“This neuron just fired.”

What we receive is a changing electrical signal measured over time.

That signal is affected by the brain, but also by many other things.

Which is where the engineering problem starts.


From a person to a matrix of numbers

Imagine someone wearing an EEG cap with several electrodes.

Each electrode gives us a signal. One electrode might be called F3, another Cz, another O1. These names refer to locations on the scalp, following the international 10–20 system (see the interactive map above).

For each location, the system repeatedly records a voltage value.

So instead of seeing a “brain,” a computer receives something conceptually like this:

TimeF3F4CzO1
0.000 s8.24.1-2.06.4
0.004 s8.64.0-1.76.8
0.008 s7.94.5-1.37.0
0.012 s7.15.0-0.86.7

Suddenly EEG looked much less mysterious to me.

From a software perspective, it is a multichannel time series. You have:

  • channels — values from different electrode locations
  • time — when each measurement happened
  • samples — the individual recorded values
  • events — information about what was happening during the recording

That last part becomes very important.


Sampling: how often are we measuring?

A signal changes continuously. A computer cannot store an infinite number of measurements, so the EEG system samples the signal at regular intervals.

For example, suppose the sampling rate is 250 Hz. That means the system records approximately 250 samples every second for each channel.

With 64 channels: 250 samples × 64 channels every second.

Record for several minutes, and the dataset grows quickly. This was another useful connection for me.

EEG may come from neuroscience, but once it reaches software, many familiar engineering questions appear: How much data are we collecting? How is it stored? How do we process it efficiently? Which parts matter? Which parts are noise?


And there is a lot of noise

This was probably one of the biggest things I misunderstood at first. I imagined EEG signals as clean brain waves. They are not. Puce & Hämäläinen, 2017

A recording can contain activity caused by:

  • blinking
  • eye movements
  • jaw movement
  • facial muscles
  • head movement
  • poor electrode contact
  • electrical interference
  • other recording artifacts

Figure · contamination

Six ways a recording picks up something that isn't brain

Blink EOG
Cause
A blink moves the eyelid and the eye together, which throws a large field change across the forehead.
How you spot it
Large, stereotyped deflections over the frontal sites, worst at Fp1/Fp2.
What people do
ICA component, or regression against a dedicated eye channel.
Eye movement EOG
Cause
The eye carries a standing charge that shifts as it rotates, so looking sideways drags the potential with it.
How you spot it
Slow, step-like shifts at frontal sites; horizontal movements reverse polarity between left and right.
What people do
ICA removal, or exclude segments around large movements.
Muscle tension EMG
Cause
Jaw clenching and facial muscles emit broadband activity that reaches far beyond the usual EEG range.
How you spot it
Energy spread across the spectrum rather than sitting in one band, often strongest at temporal sites.
What people do
ICA component rejection, or discarding the contaminated segments.
Head movement Motion
Cause
Shifting the cap changes electrode impedance and drags the cables.
How you spot it
Slow drifts across many channels at once.
What people do
Accelerometer gating, robust re-referencing, or segment rejection.
Bad electrode Hardware
Cause
An electrode lifting off the scalp goes flat or saturates.
How you spot it
Flatlines, rail-to-rail clipping, or an impedance spike.
What people do
Interpolate from the surrounding electrodes, or drop the channel entirely.
Power-line hum Environment
Cause
Mains electricity at 50 Hz (Europe and much of the world) or 60 Hz (North America) couples into every lead.
How you spot it
A sharp spectral spike at 50/60 Hz and its harmonics.
What people do
A narrow notch filter, applied early.

The amplifier can't tell a blink from a thought — both are voltage. Every one of these has to be found and dealt with before the data is honest enough to model.

If someone blinks, that can create a strong pattern in the signal. The computer does not automatically know: “Ignore this. Nada just blinked.” It only sees the values change.


Raw data is not ready for machine learning

My first instinct as a software student would have been: “We have data. Let’s train a model.”

EEG makes that instinct dangerous. Before training anything, researchers may need to make decisions about filtering, bad channels, artifacts, referencing, segmentation and many other details. Bigdely-Shamlo et al., 2015

The order above is one reasonable shape, not the pipeline. Published pipelines disagree about the details, and the early steps interact with each other in ways that are easy to underestimate.


What is filtering doing?

EEG contains activity at different frequencies. Some changes happen slowly. Others happen faster. Researchers often use filters to focus on particular frequency ranges or remove unwanted parts of the signal.

This is where terms such as delta, theta, alpha, beta, and gamma start appearing.

Figure · the spectrum

Five frequency bands, five different conversations

  • Delta 0.5–4 Hz
    Slow-wave sleep
  • Theta 4–8 Hz
    Drowsiness
  • Alpha 8–13 Hz
    Eyes closed
  • Beta 13–30 Hz
    Active thinking
  • Gamma 30–100 Hz
    High-level processing

Delta — The slow, high-amplitude rhythm that dominates deep sleep. A lot of it in an awake recording usually means look closer, not relax.

A real recording mixes all five at once. Isolating one is a filtering decision — and the edges are conventions, not joints in the spectrum, so the exact ranges shift from paper to paper. Everything above is an association, not a definition: the same band can mean different things depending on where it sits and what the person was doing.

These frequency bands are often discussed in relation to different brain states and processes. But I am being careful with them.

It is very easy to find simplified claims online such as:

“Alpha means relaxation.”

or:

“Beta means concentration.”

The real interpretation is more complicated. Frequency activity depends on brain region, task, experimental design and many other factors. One review I read found that band-power patterns overlap heavily between psychiatric disorders and correlate only weakly with symptom scores — and that even the band edges move from paper to paper. So I am trying to learn the signal first before attaching psychological meaning to every wave I see. Newson & Thiagarajan, 2019


Events give the signal context

Imagine an experiment where a participant sees an image every few seconds. The EEG recording alone is a continuous stream of values. But the researcher may also store event markers:

10.0 s → image appeared
12.0 s → participant responded
15.0 s → next image appeared

Now we can connect parts of the EEG recording to something that happened. This allows researchers to cut the continuous signal into smaller pieces around those events. These pieces are often called epochs. McWeeny & Norton, 2020

Figure · epoching

Cutting a 20-second stream into 1.5-second experiments

6.0s
13.5s
Window −0.5 s → +1.0 s Width 1.5 s

Every marker yields 1.5 s of signal — one candidate example, as long as it stays on a single side of the train/test split.

Drag the window or use arrow keys (hold Shift to jump further). Widen it and you keep more context but blur the moment you cared about; narrow it and you risk cutting off the response. Cutting finer also makes more examples — but not more independent ones, which comes back later.

Now instead of asking “What happened during this entire 20-minute recording?” we can ask: “What happened in the brain signal around this specific event?”

That feels much closer to an experiment.


Channels also have spatial meaning

One thing I had not understood before reading about EEG was that channel location matters. Electrodes are positioned across different parts of the scalp.

So an EEG dataset is not simply signal over time. It is closer to signal × time × location.

Figure · channels × time

One recording, three stages: a grid of voltages

Full bandwidth — drifts and line noise included.

Each cell is one sample. Blue is negative voltage, violet positive. Filtering removes what you ask it to remove — but it can also reshape what is left, so those settings need a reason. Epoching then keeps only the windows around an event and sets the rest aside.

That makes the data more interesting, but also harder. A model could potentially learn patterns involving:

  • when something happened
  • how strong the signal was
  • its frequency
  • where on the scalp it appeared

The number of possible patterns grows quickly.


Where machine learning enters

Once the signal has been prepared, machine learning can be used for many different tasks:

Figure · four questions

Same signal, four different things you can ask of it

  • Classification “Task A or task B?” discrete label → one of N categories
  • Detection “Is drowsiness present here?” segment flag → yes / no per window
  • Regression “How drowsy, exactly?” continuous → a number on a scale
  • Prediction “What happens next?” forward in time → a future value

Driver fatigue — the question that started this article — can be framed as detection or regression. But every one of them inherits the same preprocessing choices above.

This is where my original truck-driver question comes back. If researchers want to detect driver fatigue from EEG, the model needs examples of EEG recorded under different levels of alertness. The computer then tries to learn which patterns separate those states. How well that works in the real world is a separate question, and not one I can answer yet — but the shape of the problem is clear.

But there is another question that now interests me even more:

How do we know the model learned something real?


A model can cheat without us noticing

Suppose we record EEG from several people. Then we divide tiny pieces of those recordings randomly between training and testing data. The model might perform extremely well. Great.

Except there is a problem. Pieces from the same person may appear in both sets. Segments from one person really do resemble each other more than they resemble other people, so the recording carries a recognisable individual signature.

Instead of learning “This is what fatigue looks like,” the model might partly learn “This looks like participant 7.”

Figure · leakage

Two ways to split the same data — only one survives contact with reality

Random split

leaky
S1
S2
S3
S4
S5

Every subject appears in both sets. The model can win by recognising who, not what state.

The score looks excellent — and it is measuring familiarity, not the condition.

Leave-subjects-out

honest
S1
S2
S3
S4
S5

Subjects 1–3 train, 4–5 test. The model has never seen a test brain before.

The score is lower — and it is the only one that would survive contact with a new person.

Each row is one participant, each tile one epoch. Segments from one person really are more alike than segments from different people, so a random split quietly hands the model that signature for free — and the score stops meaning what we think it means. Brookshire et al., 2024

This is not a theoretical worry. Brookshire and colleagues re-ran published deep-learning EEG studies both ways — splitting by random segment, and splitting by whole participant. On their Alzheimer’s classifier, test accuracy fell from near-perfect to roughly chance once entire people were held out instead of individual segments. And in their survey of the published studies, most had used the segment split. Brookshire et al., 2024

That means a very high accuracy score may not tell us what we think it tells us. The way we split the dataset may be just as important as the model we choose.


EEG made me see machine learning differently

In many beginner ML exercises, the dataset feels finished. You download a CSV. You choose some columns. You train a model. You measure accuracy.

Biomedical signals make that picture fall apart. The dataset itself is the result of many decisions:

  • How was the experiment designed?
  • Where were the electrodes?
  • What was the sampling rate?
  • What was filtered?
  • Which channels were removed?
  • How were artifacts handled?
  • How were examples created?
  • How was the train/test split performed?

Those decisions can change the result before we even start comparing algorithms.


What I understand now

When I look at an EEG recording now, I no longer imagine mysterious waves that somehow reveal thoughts.

I see a measurement system:

  • A person produces physiological activity.
  • Electrodes measure voltage differences.
  • The recording system samples them.
  • Software stores them as multichannel time-series data.
  • Researchers clean and organize that data.
  • Then algorithms look for patterns.

And every arrow in that pipeline contains assumptions:

person → electrodes → electrical measurements → samples and channels → preprocessing → epochs / features → model → prediction → interpretation

The last arrow may be the most dangerous one. A prediction is not automatically an explanation of the brain.


What I still don’t understand

A lot. And I want to keep this list visible instead of hiding it behind polished explanations.

I still want to understand:

  • how EEG referencing really affects the signal
  • what different filters do mathematically
  • how artifacts are detected and removed
  • what frequency bands actually tell us
  • how CSP works for motor imagery Padfield et al., 2019
  • how researchers choose useful EEG features
  • when deep learning is better than classical methods
  • how much EEG varies between people
  • why models often struggle on completely unseen subjects
  • what makes an EEG experiment scientifically convincing

These are no longer random vocabulary words to me. They are questions I can investigate one at a time.


The next thing I want to test

Reading about EEG is useful. Opening a real EEG dataset should be better.

For the next step, I want to take a public motor-imagery dataset and inspect it with Python. Not train a huge neural network. Not chase a high accuracy score. First I want to understand the data.

How many subjects are there? How many channels? What does one recording look like? What happens when I plot it? Where are the events? What does filtering change? What happens when someone blinks?

And only then: Can I build a simple classifier?


Sources & papers I used while learning this

These are some of the papers and reviews I used while trying to understand the concepts in this article. I’m still learning this field, so I prefer linking the original research rather than presenting these notes as expert conclusions.

  1. McWeeny & Norton2020

    Understanding Event-Related Potentials (ERPs) in Clinical and Basic Language and Communication Disorders Research: A Tutorial

    Used for the basics: what scalp EEG measures, how electrodes and the 10–20 system work, what event markers are, and how a continuous recording gets cut into epochs.

    Read paper
  2. Puce & Hämäläinen2017

    A Review of Issues Related to Data Acquisition and Analysis in EEG/MEG Studies

    Used for the noise section — eye blinks, muscle activity, impedance and reference choice, and why recording quality is decided before any analysis starts.

    Read paper
  3. Bigdely-Shamlo et al.2015

    The PREP pipeline: standardized preprocessing for large-scale EEG analysis

    Used for the preprocessing section. It is one published pipeline rather than the correct answer, but it shows concretely what early cleaning involves and how the steps interact.

    Read paper
  4. Newson & Thiagarajan2019

    EEG Frequency Bands in Psychiatric Disorders: A Review of Resting State Studies

    Used for the frequency bands, and mostly for its caution: band boundaries shift between studies and band-power findings overlap heavily between disorders.

    Read paper
  5. Brookshire et al.2024

    Data leakage in deep learning studies of translational EEG

    Used for the leakage section — the clearest thing I have read on why splitting by segment instead of by participant quietly inflates accuracy.

    Read paper
  6. Padfield et al.2019

    EEG-Based Brain-Computer Interfaces Using Motor-Imagery: Techniques and Challenges

    Used for the motor-imagery dataset I want to open next, and for context on CSP and on how much the signal varies from one person to another.

    Read paper