Corrmap fit / transform

Not sure if this belongs here:

Context:
I want to use mne.preprocessing.corrmap for selecting EOG/EKG Independent Components. AFAIK corrmap computes some sort of average IC based on a seed IC (template) given by the user. It is assumed that the average template is a better template for matching similar components in other ICA decompositions.

Here is the problem:
A training and a test dataset exists. I want to calculate the average template only with the training data and apply it to the test data. How should I do that? (I am thinking of the fit / transform interface)

Current state:
For now I intend to run corrmap twice:

  1. Only with training data. β†’ Remove artifactual ICs in training dataset
  2. With training and test data β†’ Remove artifactual ICs from test dataset, but compute an average template that uses both the training and test dataset.

Relevance:
There is a small chance that other ICs are identified, when the average template is build from training and test data. This could create problems for testing a model which was build with the training data. (I don’t think it is a big problem in my case, since I have more then 500 training recordings. But when only 10 training subjects exist, then the average template would change when a new test subject was added. Tbh. one can manually identify ICs in the last case.)

I think you have to code up your own routine for that. What you propose is currently not supported with the MNE machinery.

To be very safe on which ICA components to reject, you could also use further methods in addition:

1 Like

Thank you for the answer.

The ICAlabel tool seems great and I might test it in my next project.

1 Like