Hi all,
python 3.8.13
mne 1.6.1
I’m looking to do some temporal decoding of a simple reaction task, classifying two groups. Before this I’d like to apply Xdawn as a denoising step.
My understanding is that if I were to feed my labelled epoch data through Xdawn with n_components=2, Xdawn would fit the spatial filters to differentiate the two groups, not to remove noise.
To avoid this I used the following approach:
# Create a copy of the target epochs
nolabel_epochs = epochs.copy()
# Create uniform labels for all epochs
nolabel_epochs.event_id = {'uniform':0}
nolabel_epochs.events[:,-1] = 0
# Estimates signal covariance from raw
signal_cov = mne.compute_raw_covariance(raw)
# Create Xdawn instance with n=1
xd = Xdawn(n_components=1, signal_cov=signal_cov)
# Fit Xdawn on uniform labelled epochs
xd.fit(nolabel_epochs)
# Apply Xdawn to labelled target epochs
epochs_denoised = xd.apply(epochs)
The denoised epochs see the expected result, which is an increase in ERP. I wanted to double check that this wouldn’t result in any overfitting behaviour, i.e. applying spatial filtering based on group labels.
Thank you in advance,
Tom