cross decode different areas using generalizing estimator

  • MNE version: 1.2.1
  • operating system: macOS 12.6

I am using generalizing estimator where my model object is instantiated as:

tgm_fits[g][train_model_area] = GeneralizingEstimator(make_pipeline(StandardScaler(),PCA(n_components = 15), LinearDiscriminantAnalysis()), scoring='roc_auc', verbose=True)

train_scores_tgm[g][train_model_area] = tgm_fits[g][area].score(X = X_train_area, y = y_train)
test_scores_tgm[g][train_model_area] = tgm_fits[g][area].score(X = X_test_area, y = y_test)

I am trying to do something like this:

scores_cross_area_tgm[g][(train_model_area, test_area)] = tgm_fits[g][train_model_area].score(X = X_test_area_, y = y_test
                                                                                              

This works fine when I train on a group of channels and test on the same group of channels.

But I want to cross-decode on a different group of channels, and the problem is that now we have a different number of channels, and the normalization and PCA step throw an error for test data for not having the same number of dimensions as the trained data.

Can I somehow bypass the preprocessing steps when I call .score() when the X is from a different group of sensors, and they are manually preprocessed to have PCA dimensions be 15.

Any advice would be very helpful!

as the feature space is expected to be the same between train and test you must have the same set of channels

I would suggest you subsample the channels so they match.

Alex

1 Like