cannot import name 'time_generalization' from 'mne.decoding'

When I tried

from mne.decoding import time_generalization

scores = time_generalization(epochs_list, clf=None, cv=5, scoring="roc_auc",
                             shuffle=True, n_jobs=4)

I got an error that said:

--------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_40372/2330388309.py in <module>
----> 1 from mne.decoding import time_generalization

ImportError: cannot import name 'time_generalization' from 'mne.decoding' (C:\Users\Rekha\Anaconda3\envs\mne\lib\site-packages\mne\decoding\__init__.py)

What could be the issue? Is this not a python function? If not, what is its equivalent?

What made you believe there’s a time_generalization function in MNE? There is nothing with that name.

You’ll want to use the GeneralizingEstimator, as described in this tutorial:

https://mne.tools/stable/auto_tutorials/machine-learning/50_decoding.html#temporal-generalization

1 Like