invertmeeg: A Unified Python Library and Benchmark for 112 M/EEG Inverse Solvers
Journal:
bioRxiv
Published Date:
Mar 9, 2026
Abstract
Magnetoencephalography (MEG) and electroencephalography (EEG) source imaging requires solving an ill-posed inverse problem for which numerous algorithms have been proposed over the past decades. However, these methods are scattered across different programming languages, software packages, and publications, making systematic comparison under controlled conditions nearly impossible. We present the most comprehensive benchmark of M/EEG inverse solvers to date, evaluating 106 methods from ten algorithmic families - minimum norm estimates, LORETA variants, beamformers, Bayesian methods, sparse recovery, subspace scanning, matching pursuit, dipole fitting, deep learning, and hybrid approaches - across four evaluation scenarios of increasing dificulty using a unified simulation and evaluation framework. All solvers are implemented in invertmeeg, an open-source Python package providing 112 inverse solvers through a consistent two-step interface that integrates with the MNE-Python ecosystem. We evaluate solver performance on an ico3 source space (1,284 dipoles, BioSemi-32 montage) using earth mover's distance (EMD) as the primary metric and average precision (AP) as a secondary detection metric, which we argue is more appropriate than the commonly used AUC for the highly imbalanced classification problem inherent to sparse source imaging. Our results reveal that no single method dominates all scenarios: subspace and hybrid methods excel at multi-source and extended-source recovery, while Bayesian methods lead under focal and noisy conditions. We provide practical guidance on solver selection based on the expected source configuration and computational budget. invertmeeg is available via pip install invertmeeg under the GPL-3.0-only license.