obob_mne.decoding.GeneralizedTemporal¶
-
class
obob_mne.decoding.
GeneralizedTemporal
(epochs, pipeline, epochs_test=None, cv=2, scoring='accuracy', n_jobs=-1, metadata_querylist=None, metadata_querylist_test=None)[source]¶ Apply a decoding pipeline using Temporal Generalization.
Use this class to perform Temporal Generalization decoding. This means that a classifier is trained on every sample and then tested on all samples. So, if you supply epochs with 100 samples, a classifier gets trained on the data data of the first sample. This classifier is then tested on the data of the first sample, then the second sample and so on. The process is then repeated by training on the second sample and testing on all samples and so forth.
The minimum requirements are the data as
mne.Epochs
and the pipeline assklearn.pipeline.Pipeline
, which is most commonly generated usingsklearn.pipeline.make_pipeline()
.This class treats every individual
event_id
as an individual target. If you want to combine multipleevents_id
into one target, you can useepochs.collapse_conditions()
.If you want the training and testing data to be different, you can supply the training data to
epochs
and the testing data toepochs_test
.Cross validation will be run only if training and testing data are equal (i.e., when
epochs_test=None
).Parameters: - epochs (
mne.Epochs
) – The epochs to apply the classifier pipeline to. - pipeline (
sklearn.pipeline.Pipeline
) – The classifier pipeline to use. Most likely created withsklearn.pipeline.make_pipeline()
- epochs_test (
mne.Epochs
or None, optional) – If set, the classifier gets tested on this data. The event_ids must be equal. No crossvalidation will be run in this case. - cv (int, optional) – The amount of folds for cross validation
- scoring (str or callable, optional) – The scoring function to use.
- n_jobs (int, optional) – Number of CPU cores to use
- epochs (