mne-tools / mne-tools/mne-python

ENH: decoding module 2025

Open
#13,392 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

I'll summarise here my work for GSoC 2025 and describe a few ideas I had throughout for future improvements.

My main goal (following Mike X Cohen's paper) was to implement an sklearn transformer for generalized eigendecomposition (GED) that would generalize algorithms like CSP, xDAWN, etc.
The transformer was implemented in #13259 supporting restriction/whitening for rank-deficient covariances (see the implementation details entry).

GED-based algorithms are spatial filters and essentially separate sources. The SpatialFilter container for their (and LinearModel) visualisation was implemented in #13332 and currently supports scree plot and topomaps for filters and patterns (see, for example, xDAWN example).

  • It would be useful to have a tutorial showing how to implement custom covariance estimation / eigenvalue sorting functions for _GEDTransformer and investigate the resulting sources with SpatialFilter
    • After that _GEDTransformer could be made public
  • _GEDTransformer could have inverse_transform similarly to how CSP does, but generalize it to the "multi" decomposition as in the XdawnTransformer case
  • Following ICA visualisation of spatially filtered time-series, it would be nice to have similar function for other spatial filters, but will require adding a new branch for SpatialFilter (or unifying it with ICA) in mne.viz._figure.BrowserBase
  • SpatialFilter is intended for visualisation of multiple spatial filters fixed over time, but there are cases such as EMS, LinearModel on vectorized data, SlidingEstimator wrapping LinearModel (and potentially GeneralizingEstimator) where each time point of an epoch can have different pattern. These can be conveniently visualised using EvokedArray and could be implemented either as a second use case for SpatialFilter or in an another container inheriting from EvokedArray, for example
  • mne.preprocessing.Xdawn works with Epochs and so can't directly inherit from _GEDTransformer, but perhaps _GEDTransformer's logic in fit and transform could be modularised and then reused in Xdawn.
  • SlidingEstimator and GeneralizingEstimator currently apply wrapped classifier per time-point. This can be generalized to sliding windows, where search lights will pass the windows to the downstream pipeline to cover cases like: SlidingEstimator(make_pipeline(Vectorizer(), SVC())) or, using pyRiemann transformers, SlidingEstimator(make_pipeline(XdawnTransformer(), Covariances(), TangentSpace(), SVC())) for ERP decoding.

The second part of the GSoC was to make the decoding classes more compliant with new sklearn (1.6+) estimator checks and data validation. LinearModel has been made a meta-estimator and reworked in #13361, while sklearn compliance for other classes was corrected in #13393.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Choose one unchecked proposal and begin with the named entry points: _GEDTransformer, SpatialFilter, mne.viz._figure.BrowserBase, Xdawn, SlidingEstimator, or GeneralizingEstimator. Review the linked implementation and examples, but the issue does not define a single scope, starting file, test, or completion condition; those need agreement before work begins.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, scikit-learn
Domain
data-visualization, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.