Single-subject auditory ERP-BCI performance enhancement in ALS via an AI coding assistant prompt.
The 10 matches
- [1] § Results › Offline cross-validation accuracy ↔ analysis_codes/fig4_cv_confusion.py, lines 1–37 · score 0.87 · row normalized confusion, baseline LASSO, cross validation, Baseline LDA, StratifiedKFold, baseline SVM
- [2] § Results › Offline cross-validation accuracy ↔ analysis_codes/fig4_cv_confusion.py, lines 1–37 · score 0.78 · confusion matrices, baseline LASSO, cross validation, baseline LDA, StratifiedKFold, baseline SVM
- [3] § Materials and methods › Baseline system ↔ compute_lda_baseline.py, lines 1–24 · score 0.76 · 0.1–30 Hz, feature vector, Baseline LDA, taps, FIR, auto
- [4] § Materials and methods › The AI-Designed ERP classifier (AIDE) › Evaluation ↔ compute_metrics.py, lines 186–249 · score 0.74 · GroupKFold, temporal split, StratifiedKFold, LODO, LOTO, undersampled
- [5] § Materials and methods › The AI-Designed ERP classifier (AIDE) › Evaluation ↔ compute_lda_baseline.py, lines 197–241 · score 0.72 · GroupKFold, temporal split, StratifiedKFold, LODO, LOTO, day
- [6] § Results › Offline cross-validation accuracy ↔ compute_lda_baseline.py, lines 197–241 · score 0.72 · temporal split, Baseline LDA, StratifiedKFold, baseline SVM, LODO, LOTO
- [7] § Results › Feature space visualization ↔ compute_lda_baseline.py, lines 1–24 · score 0.71 · 0.1–30 Hz, baseline correction, feature vector, baseline SVM, FIR, downsampling
- [8] § Materials and methods › The AI-Designed ERP classifier (AIDE) › Preprocessing ↔ model_v2.py, lines 1–23 · score 0.65 · sub delta, low band, high band, gamma
- [9] § Materials and methods › The AI-Designed ERP classifier (AIDE) › Feature extraction ↔ model_v2.py, lines 1–23 · score 0.62 · log scale variance, ERP waveform, gamma, band, ds
- [10] § Results › Online test ↔ analysis_codes/fig7_generate_online_confusion.py, lines 1–45 · score 0.53 · online trials, confusion matrices, AIDE, Figure 7, class, baseline
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Python · 241 lines · 9.1 KB · no license · 4 matches
- """
- Baseline LDA cross-validation across all 5 strategies.
- Baseline pipeline (identical to Baseline SVM in paper):
- FIR bandpass 0.1-30 Hz (21 taps, filtfilt)
- Epoch 1000 ms (250 samples), baseline correction 5 samples
- SEQ=5 repetitions averaged per label
- Downsample: mean-pool into 10 bins (250//10 = 25 samples/bin)
- All 8 channels
- Concatenate mean ERP of labels 1, 2, 3 → feature vector
- Classifier swap: LinearSVC → LDA(solver='lsqr', shrinkage='auto')
- """
- import os, warnings
- import numpy as np
- import pandas as pd
- from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
- from sklearn.svm import LinearSVC
- from sklearn.model_selection import StratifiedKFold, LeaveOneGroupOut, GroupKFold
- from sklearn.preprocessing import StandardScaler
- from scipy.signal import firwin, filtfilt
- warnings.filterwarnings("ignore")
- # ── paths & constants ──────────────────────────────────────────────────────
- DATA_FOLDER = "./sub1_8ch"
- SR = 250 # sampling rate
- WS = 250 # epoch window (1000 ms)
- SEQ = 5 # repetitions per label
- NUMTAPS = 21
- LOW_CUT = 0.1
- HIGH_CUT = 30.0
- BL = 5 # baseline samples
- DS_RATE = 10 # downsampling: WS//DS_RATE = 25 samples/bin → 10 bins
- EPOCH_PATTERN = [0, 1, 2] # labels 1, 2, 3 (indices into [L1, L2, L3, L4])
- # 2022 vs 2025-26 split dates
- TRAIN_DATES = {"20220916", "20221003", "20221101", "20221115", "20221121"}
- TEST_DATES = {"20250725", "20250822", "20250903", "20251217", "20260121"}
- ALL_DATES = sorted(TRAIN_DATES | TEST_DATES)
- SESSION_ORDER = {d: i for i, d in enumerate(ALL_DATES)}
- # ── FIR filter coefficients ────────────────────────────────────────────────
- nyq = SR / 2
- b_fir = firwin(NUMTAPS, [LOW_CUT / nyq, HIGH_CUT / nyq], pass_zero=False)
- # ── feature extraction for one CSV file ───────────────────────────────────
- def extract(path):
- df = pd.read_csv(path)
- data = df.values
- stim = np.nan_to_num(data[:, 9], nan=0)
- onsets = np.where(np.diff(stim) != 0)[0] + 1
- onsets = onsets[stim[onsets] != 0][: 4 * SEQ]
- ch_cols = [c for c in df.columns if c.startswith("Ch") and c[2:].isdigit()]
- cidx = [list(df.columns).index(c) for c in ch_cols]
- eeg = data[:, cidx] * -1 # polarity inversion
- eeg = StandardScaler().fit_transform(eeg) # z-score per channel
- eeg = filtfilt(b_fir, 1.0, eeg, axis=0) # FIR bandpass
- ds_factor = WS // DS_RATE # 25 samples per bin → 10 bins
- n_ch = eeg.shape[1]
- eps_by_lbl = {}
- for o in onsets:
- if o + WS <= eeg.shape[0]:
- lbl = int(stim[o])
- bs = max(0, o - BL)
- ep = eeg[o: o + WS] - eeg[bs:o].mean(axis=0)
- eps_by_lbl.setdefault(lbl, []).append(ep)
- label_features = []
- for lbl in [1, 2, 3, 4]:
- eps = eps_by_lbl.get(lbl, [])
- if eps:
- mean_ep = np.array(eps).mean(axis=0) # (WS, n_ch)
- else:
- mean_ep = np.zeros((WS, n_ch))
- down = mean_ep.reshape(-1, ds_factor, n_ch).mean(axis=1) # (10, n_ch)
- label_features.append(down.flatten())
- feat = np.concatenate([label_features[i] for i in EPOCH_PATTERN])
- return feat
- # ── load all trials ────────────────────────────────────────────────────────
- print("Loading data …")
- X_list, y_list, sessions = [], [], []
- for fname in sorted(os.listdir(DATA_FOLDER)):
- if not fname.endswith(".csv"):
- continue
- parts = fname.replace(".csv", "").split("_")
- if len(parts) < 3:
- continue
- date = parts[0]
- try:
- label = int(parts[-1])
- except ValueError:
- continue
- if label not in (1, 2, 3):
- continue
- path = os.path.join(DATA_FOLDER, fname)
- try:
- feat = extract(path)
- X_list.append(feat)
- y_list.append(label)
- sessions.append(SESSION_ORDER[date])
- except Exception as e:
- print(f" skip {fname}: {e}")
- X = np.vstack(X_list)
- y = np.array(y_list)
- sessions = np.array(sessions)
- print(f"Loaded {len(y)} trials, feature dim={X.shape[1]}, classes={np.unique(y)}")
- # ── shared evaluation helper ───────────────────────────────────────────────
- def undersample_train(X_tr, y_tr, rng):
- ulabs = np.unique(y_tr)
- mn = min((y_tr == l).sum() for l in ulabs)
- idx = np.concatenate([rng.choice(np.where(y_tr == l)[0], mn, replace=False)
- for l in ulabs])
- return X_tr[idx], y_tr[idx]
- def strat_kfold_acc(X, y, clf_fn, n_seeds=10):
- scores_all = []
- for seed in range(n_seeds):
- rng = np.random.default_rng(seed)
- s = []
- for k in (3, 4):
- cv = StratifiedKFold(n_splits=k, shuffle=True, random_state=seed)
- for tr, te in cv.split(X, y):
- Xtr, ytr = undersample_train(X[tr], y[tr], rng)
- clf = clf_fn(seed)
- clf.fit(Xtr, ytr)
- s.append(clf.score(X[te], y[te]))
- scores_all.append(np.mean(s))
- return np.mean(scores_all)
- def lodo_acc(X, y, sessions, clf_fn):
- """Leave-One-Day-Out: leave each unique session out in turn."""
- logo = LeaveOneGroupOut()
- session_scores = {}
- for tr, te in logo.split(X, y, sessions):
- sess_id = sessions[te[0]]
- rng = np.random.default_rng(42)
- Xtr, ytr = undersample_train(X[tr], y[tr], rng)
- clf = clf_fn(42)
- clf.fit(Xtr, ytr)
- session_scores[sess_id] = clf.score(X[te], y[te])
- return np.mean(list(session_scores.values())), session_scores
- def loto_acc(X, y, clf_fn):
- """Leave-One-Trial-Out: strict leave-one-out over all 189 trials."""
- from sklearn.model_selection import LeaveOneOut
- loo = LeaveOneOut()
- correct = 0
- for tr, te in loo.split(X):
- rng = np.random.default_rng(42)
- Xtr, ytr = undersample_train(X[tr], y[tr], rng)
- clf = clf_fn(42)
- clf.fit(Xtr, ytr)
- correct += (clf.predict(X[te]) == y[te]).sum()
- return correct / len(y)
- def temporal_split_acc(X, y, sessions, clf_fn):
- """Train on 2022 (sessions 0-4), test on 2025-26 (sessions 5-9)."""
- train_mask = sessions < 5
- test_mask = sessions >= 5
- rng = np.random.default_rng(42)
- Xtr, ytr = undersample_train(X[train_mask], y[train_mask], rng)
- clf = clf_fn(42)
- clf.fit(Xtr, ytr)
- return clf.score(X[test_mask], y[test_mask])
- def group_kfold_acc(X, y, sessions, clf_fn, k=5):
- """Day GroupKFold (k=5): sessions kept intact within each fold."""
- gkf = GroupKFold(n_splits=k)
- scores = []
- for tr, te in gkf.split(X, y, sessions):
- rng = np.random.default_rng(42)
- Xtr, ytr = undersample_train(X[tr], y[tr], rng)
- clf = clf_fn(42)
- clf.fit(Xtr, ytr)
- scores.append(clf.score(X[te], y[te]))
- return np.mean(scores)
- # ── run both classifiers ───────────────────────────────────────────────────
- def svm_fn(seed): return LinearSVC(C=1.0, dual=False, random_state=seed)
- def lda_fn(seed): return LDA(solver="lsqr", shrinkage="auto")
- results = {}
- for name, clf_fn in [("Baseline SVM", svm_fn), ("Baseline LDA", lda_fn)]:
- print(f"\n── {name} ──")
- print(" StratifiedKFold …", end=" ", flush=True)
- sk = strat_kfold_acc(X, y, clf_fn)
- print(f"{sk*100:.2f}%")
- print(" LODO …", end=" ", flush=True)
- lodo, session_detail = lodo_acc(X, y, sessions, clf_fn)
- print(f"{lodo*100:.2f}%")
- date_map = {v: k for k, v in SESSION_ORDER.items()}
- for sid, acc in sorted(session_detail.items()):
- print(f" session {date_map[sid]}: {acc*100:.1f}%")
- print(" LOTO …", end=" ", flush=True)
- lt = loto_acc(X, y, clf_fn)
- print(f"{lt*100:.2f}%")
- print(" Temporal split …", end=" ", flush=True)
- ts = temporal_split_acc(X, y, sessions, clf_fn)
- print(f"{ts*100:.2f}%")
- print(" GroupKFold …", end=" ", flush=True)
- gk = group_kfold_acc(X, y, sessions, clf_fn)
- print(f"{gk*100:.2f}%")
- results[name] = dict(
- StratifiedKFold=sk, LODO=lodo, LOTO=lt,
- TemporalSplit=ts, GroupKFold=gk
- )
- print("\n\n── Summary ──")
- print(f"{'Strategy':<40} {'Baseline SVM':>14} {'Baseline LDA':>14}")
- print("-" * 70)
- strats = [("StratifiedKFold (k=3,4; 10 seeds)", "StratifiedKFold"),
- ("Day-out LODO (10 sessions)", "LODO"),
- ("One-trial-out LOTO (189-fold)", "LOTO"),
- ("Temporal split (2022→2025-26)", "TemporalSplit"),
- ("Day GroupKFold (k=5)", "GroupKFold")]
- for label, key in strats:
- svm_v = results["Baseline SVM"][key] * 100
- lda_v = results["Baseline LDA"][key] * 100
- print(f"{label:<40} {svm_v:>13.2f}% {lda_v:>13.2f}%")
compute_lda_baseline.py at commit 41bd2db, no license · at the source
Overview
Abstract
Introduction: Auditory event-related potential (ERP) brain-computer interfaces (BCIs) offer communication support for individuals with amyotrophic lateral sclerosis (ALS) who eventually progress to completely locked-in states. However, individual-specific BCI pipeline optimization is technically demanding and time-consuming, leaving substantial room for performance improvement in practice. A central challenge is increasing selection speed while maintaining reliable classification accuracy, since slower selections reduce the sense of agency and undermine the motivational and feedback dynamics essential for sustained BCI use.
Methods: We investigated whether an AI coding assistant could address this challenge for individual patients. A three-class auditory ERP-BCI was optimized for a single ALS patient using Claude Code (Anthropic, Inc.), which iteratively generated and evaluated 23 optimization scripts over approximately 24 hours with minimal human-in-the-loop oversight. The resulting AI-Designed ERP classifier (AIDE) was evaluated on 189 EEG trials spanning 3.5 years using five cross-validation strategies.
Results: For the baseline models, halving the stimulus repetitions to shorten selection time degraded classification accuracy; AIDE prevented this degradation, achieving 85.03% mean cross-validation accuracy (selection time 17 s; ITR 2.92 bits/
Discussion: These findings provide proof of concept that single-subject BCI performance can be improved via a single prompt, offering an efficient pathway to individualized optimization in clinical and research settings.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 10 matches between paragraphs and lines of code.
mikito-ogino/aide-bci-analysis
41bd2dbe69b06c73fbfb957bcc9bd778bbbed632, 2 June 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
36 files
- analysis_codes/
fig3_generate_erp_figure , Python, 187 lines.py - analysis_codes/
fig3b_generate_erp_image , Python, 159 lines.py - analysis_codes/
fig3c_generate_erp_topo. , Python, 181 linespy - analysis_codes/
fig4_cv_confusion.py , Python, 190 lines, 2 matches - analysis_codes/
fig5_generate_mds.py , Python, 227 lines - analysis_codes/
fig6_generate_seq_compar , Python, 248 linesison.py - analysis_codes/
fig7_generate_online_con , Python, 209 lines, 1 matchfusion.py - compute_lda_baseline.py, Python, 241 lines, 4 matches
- compute_metrics.py, Python, 348 lines, 1 match
- model.py, Python, 374 lines
- model_v2.py, Python, 241 lines, 2 matches
- optimization_history/
model_opt.py , Python, 502 lines - optimization_history/
model_opt_v10.py , Python, 374 lines - optimization_history/
model_opt_v11.py , Python, 379 lines - optimization_history/
model_opt_v12.py , Python, 671 lines - optimization_history/
model_opt_v13.py , Python, 640 lines - optimization_history/
model_opt_v14.py , Python, 562 lines - optimization_history/
model_opt_v15.py , Python, 536 lines - optimization_history/
model_opt_v16.py , Python, 438 lines - optimization_history/
model_opt_v17.py , Python, 493 lines - optimization_history/
model_opt_v18.py , Python, 400 lines - optimization_history/
model_opt_v19.py , Python, 565 lines - optimization_history/
model_opt_v2.py , Python, 613 lines - optimization_history/
model_opt_v20.py , Python, 548 lines - optimization_history/
model_opt_v21.py , Python, 511 lines - optimization_history/
model_opt_v22.py , Python, 438 lines - optimization_history/
model_opt_v23.py , Python, 419 lines - optimization_history/
model_opt_v24.py , Python, 489 lines - optimization_history/
model_opt_v3.py , Python, 492 lines - optimization_history/
model_opt_v4.py , Python, 341 lines - optimization_history/
model_opt_v5.py , Python, 296 lines - optimization_history/
model_opt_v6.py , Python, 444 lines - optimization_history/
model_opt_v7.py , Python, 488 lines - optimization_history/
model_opt_v8.py , Python, 448 lines - optimization_history/
model_opt_v9.py , Python, 437 lines - README.md, Text, 96 lines
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 35 scripts, each with its path and the digest of its content;
- 10 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Data availability statement
The EEG dataset will be made available upon reasonable request to the corresponding author. The analysis code (classifier implementations and figure-generation scripts) is publicly available at https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 2, 28 September 2026
- Funding: added Japan Society for the Promotion of Science: 24K20462
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, pages, dates, 1 author, 7 keywords, 31 references.
Cite
This paper
Ogino, M. (2026). Single-subject auditory ERP-BCI performance enhancement in ALS via an AI coding assistant prompt. Frontiers in human neuroscience, 20, 1869918. https://
BibTeX
@article{ogino2026single
author = {Ogino, Mikito},
title = {{Single-subject auditory ERP-BCI performance enhancement in ALS via an AI coding assistant prompt}},
journal = {Frontiers in human neuroscience},
year = {2026},
month = jul,
volume = {20},
pages = {1869918},
publisher = {Frontiers Media SA},
issn = {1662-5161},
doi = {10.3389/
url = {https://
pmid = {42459893},
pmcid = {PMC13369013}
}
RIS
TY - JOUR
AU - Ogino, Mikito
TI - Single-subject auditory ERP-BCI performance enhancement in ALS via an AI coding assistant prompt
T2 - Frontiers in human neuroscience
J2 - Front Hum Neurosci
PY - 2026
DA - 2026/
VL - 20
SP - 1869918
SN - 1662-5161
PB - Frontiers Media SA
DO - 10.3389/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.3389/
"type": "article-journal",
"title": "Single-subject auditory ERP-BCI performance enhancement in ALS via an AI coding assistant prompt",
"container-title": "Frontiers in human neuroscience",
"author": [
{
"family": "Ogino",
"given": "Mikito"
}
],
"container-title-short":
"volume": "20",
"page": "1869918",
"DOI": "10.3389/
"PMID": "42459893",
"PMCID": "PMC13369013",
"ISSN": "1662-5161",
"publisher": "Frontiers Media SA",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
1
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.3389/fnhum.2026.1807535
- The ASME-speller: 30-class auditory brain-computer interface speller using stream segregation and the QWERTY layout.Journal: Frontiers in human neuroscienceIn common: EEG, 9 references
- [2] doi:10.3389/fpsyg.2026.1774068 [code]
- Analysis of cognitive mechanisms in phoneme perception and pronunciation errors among Korean language learners.Journal: Frontiers in psychologyIn common: pyRiemann, LightGBM, XGBoost, 6 other tools, EEG
- [3] doi:10.3390/s26175327 [code]
- Subject Identity Confounds qEEG Emotion Recognition on DEAP and DREAMER.Journal: Sensors (Basel, Switzerland)In common: pyRiemann, XGBoost, MNE-Python, 5 other tools, EEG
- [4] doi:10.1371/journal.pone.0354510 [code]
- Personalized adaptive virtual reality experience driven by electroencephalography-b
ased pain recognition. Journal: PloS oneIn common: LightGBM, XGBoost, MNE-Python, 4 other tools, EEG - [5] doi:10.1038/s41591-026-04432-4 [code]
- Activity-dependent adaptive deep brain stimulation improves gait in Parkinson's disease.Journal: Nature medicineIn common: LightGBM, XGBoost, MNE-Python, 4 other tools, clinical / translational
- [6] doi:10.3389/fnhum.2026.1895016 [code]
- A confidence-gated source selection strategy for cross-session transfer in brain-computer interfaces.Journal: Frontiers in human neuroscienceIn common: pyRiemann, LightGBM, MNE-Python, 3 other tools, EEG
- [7] doi:10.3390/ijms27135920 [code]
- Metabolomic Classification of Myalgic Encephalomyelitis/
Chronic Fatigue Syndrome via Explainable Ensemble Learning and Pareto-Guided Feature Selection. Journal: International journal of molecular sciencesIn common: LightGBM, XGBoost, scikit-learn, 4 other tools, clinical / translational - [8] doi:10.1073/pnas.2516601123 [code]
- Unveiling the glymphatic system's role in brain aging: A comprehensive biomarker and modifiable intervention target.Journal: Proceedings of the National Academy of Sciences of the United States of AmericaIn common: LightGBM, XGBoost, scikit-learn, 4 other tools, clinical / translational
- [9] doi:10.1371/journal.pone.0347671 [code]
- RMETNet: A cross-subject motor imagery EEG signal classification model based on TSLANet and riemannian geometry features.Journal: PloS oneIn common: pyRiemann, MNE-Python, scikit-learn, 4 other tools, EEG
- [10] doi:10.1186/s13244-026-02365-7 [code]
- Super-resolution MRI and 2.5D deep learning for intratumoral-peritumoral
radiomics in preoperative prediction of rectal cancer perineural invasion. Journal: Insights into imagingIn common: LightGBM, XGBoost, scikit-learn, 4 other tools, other condition
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 35 scripts, and 10 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:a93a38134ef74ab6…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
