template for non-ICA dimension reduction/ preprocessing like SFA

Hi,

I m trying to use the mne library using (linear) time series dimension reduction techniques that are NOT ICA; for example, slow feature analysis (SFA) is another obvious example of how to analyze EEG signals (https://www.cnbc.cmu.edu/~tai/readings/learning/wiskott_sejnowski_2002.pdf)

Looking through the ica.py file, I could make create my own SFA class and replacing the FastICA() call with a custom SFA() implementation (mne-python/mne/preprocessing/ica.py at maint/1.10 · mne-tools/mne-python · GitHub). However, downstream I run into issues with visualization and scoring/component functions that expect certain class names / namespaces to be from the mne library, rather than my local copy of the class.

I was surprised to not find a general purpose DimensionReduction((ContainsMixin)) class, where a user can pass any sklearn compatible transformer for analyzing data. Is there a particular reason ICA is hardcoded in the ICA class, rather than providing a general purpose API , with FastICA() just being one of (infinitely) many rotation transformations that can be learned. Did I miss this general purpose class in another file/module?

Again, technically I m not blocked to proceed; it just seemed odd to have to copy/paste a 1000+ line class to make this work when the actual code changes inside that class are just ~10 LOC (replace the FastICA() call with a SFA() call – or any other sklearn dimension reduction technique).

would appreciate any pointers,

Georg

Have a look at what is inside the mne.decoding submodule, especially spatial_filter.py which was added to main about a month ago (ENH: Viz for spatial filters by Genuster · Pull Request #13332 · mne-tools/mne-python · GitHub). It may not contain exactly what you want, but that is where our general-purpose base classes live that interface with scikit-learn style estimators.