Skip to main content

Mother of All ECoG Benchmarks — MOABB-style benchmarking for ECoG motor decoding

Project description

MOECoG — Mother of All ECoG Benchmarks

A MOABB-style benchmarking framework for electrocorticographic (ECoG) motor decoding.

"ECoG isn't just the future — it's the testable present."

Vision

MOABB transformed EEG-BCI research by making algorithm comparison reproducible and fair. MOECoG does the same for ECoG motor decoding — the signal modality at the critical intersection of clinical viability (long-term stability, lower surgical risk) and high-performance neural control (high-gamma access, mm-scale spatial resolution).

This project will be successful when we read in an abstract:

"...the proposed method obtained a correlation of 0.82 on MOECoG, outperforming the state of the art by 12%..."

Why ECoG Needs Its Own Benchmark

Property EEG (MOABB) ECoG (MOECoG)
Signal type Scalp potentials Cortical surface potentials
Key features mu/beta ERD/ERS High-gamma broadband (>70 Hz) + beta suppression
Spatial resolution ~cm ~mm
Electrode geometry Standard montages (10-20) Patient-specific grids/strips
Primary tasks Classification (L/R imagery) Both classification AND continuous regression
Cross-subject Standard channel alignment Requires anatomical registration
Noise profile EMG, EOG artifacts Epileptiform activity, referencing

MOABB's paradigm/dataset/evaluation/pipeline abstraction is brilliant — but its assumptions (fixed channel montages, epoched classification, standard frequency bands) break down for ECoG.

Architecture

MOECoG follows MOABB's 4-concept design, adapted for ECoG:

+--------------+    +---------------+    +---------------+    +---------------+
|   Dataset    |--->|   Paradigm    |--->|  Evaluation   |--->|   Pipeline    |
|              |    |               |    |               |    |               |
| Raw ECoG +   |    | Motor Imagery |    | WithinSubject |    | Feature ext.  |
| electrode    |    | Finger Flex   |    | CrossSession  |    | + Classifier  |
| positions +  |    | Arm Reach     |    | Transfer      |    | or Regressor  |
| anatomy      |    | Grasp Type    |    |               |    |               |
+--------------+    +---------------+    +---------------+    +---------------+

Key Differences from MOABB

  • Dual-task paradigms: Classification (which finger?) AND regression (finger trajectory)
  • Anatomical electrode registration: Patient-specific grids mapped to MNI/FreeSurfer atlas
  • Broadband feature extraction: High-gamma (70-150 Hz), beta (13-30 Hz), phase-amplitude coupling
  • Continuous decoding metrics: Correlation coefficient (r), R-squared, normalized MSE — not just accuracy
  • Naturalistic movement support: Not just cued trials but free/spontaneous movements (AJILE12)

Included Datasets

Tier 1: Core Benchmark

Motor-specific, public, well-documented.

ID Dataset Source Subjects Task Channels Modality
MillerFingerFlex BCI Competition IV Dataset 4 Miller & Schalk 3 Individual finger flexion (5-class regression) 48-64 ECoG grid
MillerLibrary Stanford/Mayo ECoG Library Miller 2019, Nature Human Behaviour 34 16 experiments (motor, sensory, language, visual) Varies ECoG grid
AJILE12 Annotated Joints in Long-term ECoG Peterson et al. 2022, Scientific Data 12 Naturalistic wrist movements >=64 ECoG grid

Tier 2: Extended Benchmark

ID Dataset Source Subjects Task
BCITetraplegia BCI and Tetraplegia (WIMAGINE) Benabid/Costecalde et al. 1 (chronic) 4-class motor imagery, 2D cursor
GraspECoG Natural grasp types Various (Pistohl, Bleichner) Varies Grasp classification
MoveAgain Blackrock/BrainGate ECoG subsets If released publicly Varies Arm/hand movement

Tier 3: Cross-Modality Comparison

ID Dataset Why included
MOABB_MI MOABB motor imagery EEG datasets Direct EEG vs ECoG comparison on matched paradigms

Paradigms

FingerFlexionRegression

  • Task: Predict continuous finger flexion trajectories from ECoG
  • Metrics: Pearson r, R-squared, NRMSE per finger
  • Datasets: MillerFingerFlex, MillerLibrary (motor subset)
  • Baseline: BCI Competition IV Dataset 4 leaderboard

MotorImageryClassification

  • Task: Classify imagined/attempted movements (L/R hand, feet, tongue, etc.)
  • Metrics: Accuracy, ROC-AUC, Cohen's kappa
  • Datasets: MillerLibrary (motor imagery subset), BCITetraplegia

NaturalisticReachDecoding

  • Task: Decode wrist movement onset and trajectory from unconstrained behavior
  • Metrics: Event detection F1, trajectory r, latency
  • Datasets: AJILE12

GraspClassification

  • Task: Classify grasp types or hand gestures from sensorimotor ECoG
  • Metrics: Accuracy, confusion matrix analysis
  • Datasets: GraspECoG, MillerLibrary (gesture subset)

Evaluation Strategies

Strategy Description Use Case
WithinSubjectCV K-fold within single subject Standard single-patient decoding
CrossSessionEval Train on session A, test on session B Stability / recalibration assessment
CrossSubjectTransfer Leave-one-subject-out (with atlas projection) Generalization / zero-shot transfer
TemporalStabilityEval Chronological split (early to late) Long-term signal stability

Baseline Pipelines

Feature Extraction

  • LogBandPower — Log power in canonical bands (mu, beta, low-gamma, high-gamma)
  • BroadbandChange — Miller's broadband spectral change method
  • PAC — Phase-amplitude coupling (theta/gamma, beta/high-gamma)
  • CSP_ECoG — Common Spatial Patterns adapted for patient-specific grids
  • TimeFrequency — Continuous wavelet / multitaper spectrograms

Decoders

  • LDA / SVM / LogisticRegression — Classical classifiers
  • Ridge / Kalman — Linear regressors for trajectory decoding
  • ECoGNet — Lightweight CNN for ECoG (braindecode-compatible)
  • FingerFlex — Convolutional encoder-decoder (Lomtev et al.)
  • HTNet — Transfer learning across subjects via Hilbert transform

Quick Start

import moecog
from moecog.datasets import MillerFingerFlex
from moecog.paradigms import FingerFlexionRegression
from moecog.evaluations import WithinSubjectCV
from moecog.pipelines.features import LogBandPower
from sklearn.linear_model import Ridge
from sklearn.pipeline import make_pipeline

# Define pipeline
pipelines = {
    "LogBandPower+Ridge": make_pipeline(LogBandPower(), Ridge(alpha=1.0))
}

# Load data
dataset = MillerFingerFlex()
paradigm = FingerFlexionRegression(fmin=1, fmax=150)
evaluation = WithinSubjectCV(paradigm=paradigm, datasets=[dataset], n_splits=5)

# Run benchmark
results = evaluation.process(pipelines)
print(results.groupby("pipeline")["score"].mean())

Installation

pip install moecog

Or for development:

git clone https://github.com/epyifany/MOECoG.git
cd MOECoG
pip install -e ".[dev]"

Dependencies

Core:

  • mne >= 1.5 — ECoG signal handling, coordinate transforms
  • numpy, scipy, scikit-learn — Core ML
  • pandas — Results management
  • h5py — Persistent results storage
  • pooch — Robust data downloading

Optional:

  • torch, braindecode — Deep learning baselines (pip install moecog[deep])
  • pynwb, dandi — NWB data access for AJILE12 (pip install moecog[nwb])
  • nilearn, nibabel — Anatomical registration (pip install moecog[anatomy])
  • matplotlib, seaborn — Visualization (pip install moecog[viz])

Citation

If you use MOECoG in your research, please cite:

@software{moecog2025,
  title = {MOECoG: Mother of All ECoG Benchmarks},
  author = {Yu, Yifan},
  year = {2025},
  url = {https://github.com/epyifany/MOECoG}
}

And the foundational datasets:

  • Miller, K.J. "A library of human electrocorticographic data and analyses." Nature Human Behaviour 3(11), 1225-1235 (2019).
  • Peterson, S.M. et al. "AJILE12: Long-term naturalistic human intracranial neural recordings and pose." Scientific Data 9, 184 (2022).
  • Schalk, G. et al. BCI Competition IV Dataset 4.

License

BSD-3-Clause (matching MOABB)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moecog-0.1.0.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moecog-0.1.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file moecog-0.1.0.tar.gz.

File metadata

  • Download URL: moecog-0.1.0.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for moecog-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1613b5d4e2ebadd1da27a9489a2d51801fbdce4a63d0a062d629f810b6fa5e4d
MD5 316bfaa646cede95475e60ff1d4feb66
BLAKE2b-256 596ecfc3bb70ec209f3ced963da7a4c40059120eae60748d2e907a358def4429

See more details on using hashes here.

File details

Details for the file moecog-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: moecog-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for moecog-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59a6a6683998d89e5dc75fbcda2f310e89cba2aae7fac276a2944bb20021d13b
MD5 49787c03ecadcb2ce2ff6d9300655f99
BLAKE2b-256 d4aea0eb90cf475767b1efc239112294762eacbbe21b7bf092fa76e481c14216

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page