Bench modeSteps, parts, and safety only. Big type for a phone at the bench.
Phase 3: Read intentProjectMonths, on and off$0 beyond the amplifierTier 2Humbling by design

Project C: Motor imagery

Imagine moving your left hand or your right. A classifier tries to tell which from rhythms over motor cortex. Months of work, subject-dependent, and the project that teaches you why BCI is not solved.

AssumesSpatial filters and montagesClassification done honestlySpineDecoding / signal processing / ML

You are skimming: the title, the first figure, and the short version. Switch to Read in the header for the full page, or Deep to open every deep dive.

When you move your right hand, the over the left motor cortex drops. When you imagine moving it vividly, it drops too, less. A classifier trained on the pattern of mu and beta power across electrodes over motor cortex can, for most people, tell left from right imagery better than chance. That is , the paradigm behind wheelchair and cursor demos, and it is marked humbling on this site because it is: accuracies are modest, they vary enormously between people, they drift between days, and about one person in five cannot do it at all. Doing this project well means finding all of that out for yourself and reporting it honestly.

Predict before you look

You collect 40 trials of left and 40 of right imagery and your classifier gets 62 percent. Is it working?

Probably not. With 80 trials and two classes, chance produces accuracies up to about 61 percent one time in twenty just by luck (the binomial 95 percent upper bound). 62 is barely above that. You would need around 70 percent on 80 trials, or 62 percent on 400 trials, to be confident. The statistics explainer has the calculation, and motor imagery is where you will need it most.

The paradigm

The Graz protocol. A fixation cross. At second two, an arrow left or right. From second three to seven, imagine the movement: the feeling of squeezing a ball, not the picture of a hand. Rest. Randomized order, forty trials per class per run, three or four runs. Electrodes at C3, Cz, C4 and their neighbours (FC3, FC4, CP3, CP4), referenced to an earlobe, then re-referenced to a Laplacian.

The classic pipeline

Band-pass 8 to 30 Hz (mu and beta). Take the window from 0.5 to 2.5 seconds after the cue. : find the spatial filters that maximize variance for left and minimize it for right, and vice versa, using the training trials. Take the log-variance of the first and last few CSP components as features. . This pipeline, with two or three lines of MNE and scikit-learn, is what most of the literature before 2015 used, and it still holds up.

from mne.decoding import CSP
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.pipeline import make_pipeline
from sklearn.model_selection import cross_val_score, StratifiedKFold
clf = make_pipeline(CSP(n_components=6, log=True), LinearDiscriminantAnalysis())
scores = cross_val_score(clf, X, y, cv=StratifiedKFold(5, shuffle=False))   # X: trials × channels × samples

The shuffle=False matters: with runs recorded in order, unshuffled folds approximate testing on later data, which is closer to the truth than shuffled folds.

The modern pipeline

A classifier: compute each trial’s covariance matrix, project to the tangent space at the mean, classify with logistic regression. pyRiemann does this in three lines and it is the strongest simple baseline on every public dataset. Then via Braindecode, if you want to find out how deep learning does on your own eighty trials (usually no better).

What you will find

Within one session, 65 to 85 percent for most people with the classic pipeline, higher with feedback and practice. Across sessions, a drop of five to fifteen points unless you recalibrate. Across people, everything from 95 to 50. Your own number is data, not a grade.

Feedback and training

Close the loop: show a bar that grows left or right with the classifier’s output during imagery. People improve over sessions with feedback, sometimes a lot. This is a skill being learned by the user as much as a pattern being learned by the machine, and the co-adaptation is the interesting part.

  1. Implement the Graz paradigm in PsychoPy with LSL markers.
  2. Record four runs on yourself. Before any classifier, plot the C3 and C4 spectra for left versus right imagery. Is there a visible difference? If not, the classifier will not find one.
  3. Run CSP + LDA with unshuffled 5-fold cross-validation. Compute the chance upper bound for your trial count. Report both.
  4. Run the Riemannian pipeline. Compare.
  5. Record a second session on another day. Train on day one, test on day two. Report the drop.
  6. Add online feedback. Do five sessions over two weeks. Plot your accuracy over sessions.
  7. Recruit two friends under your lab’s protocol. Report their numbers next to yours without commentary.

Why this project is here anyway

Because it is the paradigm that promises the most (control by thought alone, no eyes or muscles) and delivers the least reliably, and understanding exactly why is the beginning of a real education in the field. Everything in the classification and statistics explainers exists because of projects like this one.

Recall
What does 'humbling by design' mean for motor imagery?
Accuracies are modest and vary widely between people, drop between sessions, and about a fifth of people cannot control it; the project's value is in measuring and reporting that honestly.
Recall
Why should cross-validation folds not be shuffled for motor imagery runs recorded in order?
Unshuffled folds approximate training on earlier data and testing on later data, which is closer to real use and does not leak slow drifts across folds.
Recall
A classifier reports 90 percent on the first attempt. What is the most likely explanation?
Leakage or a non-brain confound, such as eye movements toward the cue arrow or muscle activity that differs between classes. Check the classifier's spatial pattern.