NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Autoreject: Automated artifact rejection for MEG and EEG data

Mainak Jas, Denis A. Engemann, Yousra Bekhti, Federico Raimondo, Alexandre GramfortNeuroImage 2017 · DOI

Introduction

Recording brain activity via Magnetoencephalography (MEG) and Electroencephalography (EEG) is a cornerstone of modern neuroscience. However, these signals are frequently corrupted by high-amplitude artifacts—noise from eye blinks, muscle movements, or environmental interference—that can be orders of magnitude stronger than the neural signals of interest.

Traditionally, researchers have relied on manual visual inspection to reject "bad" trials. This process is inherently subjective, time-consuming, and often wasteful, as a single noisy sensor can lead to the rejection of an entire trial's worth of otherwise clean data. While automated tools exist, they typically require manually tuned, arbitrary thresholds that do not account for the high variability between subjects and sensors. Autoreject addresses these challenges by providing a fully automated, data-driven framework for identifying and repairing bad trials using cross-validation and Bayesian optimization.

Methods: Global and Local Approaches

The authors introduce two versions of the algorithm: Autoreject (global) and Autoreject (local).

Autoreject (global)

The global version seeks a single optimal peak-to-peak threshold for all sensors. It employs K-fold cross-validation to test a range of candidate thresholds, selecting the one that minimizes the Root Mean Square Error (RMSE) between the mean of the "good" training trials and the median of the validation trials. This approach ensures the threshold is neither too restrictive (underfitting) nor too permissive (overfitting).

Cross-validation for global threshold selection showing the RMSE curve and the avoidance of underfitting/overfitting.

Autoreject (local)

The local version is more sophisticated, learning a unique threshold for every individual sensor. This allows for a "Repair or Reject" logic:

  1. Identify: If a sensor exceeds its local threshold in a trial, it is marked as a "bad segment."
  2. Repair: If only a few sensors are bad, the algorithm interpolates their data from neighboring "good" sensors.
  3. Reject: If the number of bad sensors exceeds a learned parameter ($\kappa$), the entire trial is rejected.
The 'Repair or Reject' logic of local autoreject across sensors and trials.

To optimize performance, the algorithm uses Bayesian optimization to search the threshold space efficiently and data augmentation (via interpolation) to help the cross-validation process recognize clean signal characteristics even for consistently noisy sensors.

Key Insights

  • Threshold Variability: Optimal rejection thresholds vary significantly across subjects and sensors, making fixed thresholds fundamentally flawed.
  • Robust Metrics: Using the median of the validation set in cross-validation provides a stable target that is less sensitive to outliers than the mean.
  • Data Preservation: By repairing trials through local interpolation rather than outright rejection, Autoreject significantly increases the statistical power of neuroimaging analyses.

Results and Performance

Autoreject was validated on four public datasets (MNE Sample, EEGBCI, EEG Faces, and HCP MEG) involving over 200 subjects. In head-to-head comparisons on the HCP dataset, Autoreject (local) consistently outperformed existing automated methods like FASTER, SNS, and RANSAC, producing results that closely matched human-cleaned "ground truth" data. Furthermore, the algorithm demonstrated high scalability, successfully automating the preprocessing of massive datasets that would otherwise require extensive manual intervention.

Limitations

While highly effective, Autoreject has specific limitations. It assumes artifacts are independent across trials; "phase-locked" artifacts that occur consistently relative to a stimulus may be harder to distinguish from neural signals. Additionally, it is designed for high-amplitude noise and is not a replacement for Independent Component Analysis (ICA) for low-magnitude artifacts like heartbeats. Finally, if a large cluster of neighboring sensors is bad simultaneously, spatial interpolation becomes unreliable, a scenario the algorithm currently flags for the user.

Summary updated

BibTeX
@article{jas2017autoreject,
  author = {Mainak Jas and Denis A. Engemann and Yousra Bekhti and Federico Raimondo and Alexandre Gramfort},
  title = {{Autoreject: Automated artifact rejection for MEG and EEG data}},
  journal = {NeuroImage},
  year = {2017},
  doi = {10.1016/j.neuroimage.2017.06.030},
}
Figure