Hello,
I am doing cross-modal classification within a ROI and with searchlight strategy.
With the function nilearn.decoding.Decoder, I could train one decoder, and apply the same decoder to test on another set of data (cross-modal classification) with Decoder.predict(), but .predict() does not go with SearchLight, so I can’t access the same estimator.
Here is the pipeline I am using:
cv = LeaveOneGroupOut()
pipeline = make_pipeline(StandardScaler(), LinearSVC())
searchlight = SearchLight(mask_img=mask_img, radius=10.0, estimator=pipeline, n_jobs=-1, scoring="accuracy", cv=cv, verbose=0)
searchlight.fit(X_train, y_train, groups=train_groups)
Question 1: When using Decoder(), I defined the cv.split for Decoder.fit(X_train, y_train) and for Decoder.predict(X_test, y_test). Do I need to define cv.split when using searchlight.fit()? Based on the examples I’ve looked up, this step seems not neccessary for searchlight.fit() that the train and test sets are still splited, but I am not sure.
Question 2: I need suggestions that in which part of the arugments I should modify to apply the same estimator on another set of data.
So far, I think the way to do this is to create a custom_cv as in the scikit-learn example.
Is it possible to define the cv to split the data1 with leave-one-group-out (groups = groups; I have 6 groups for 12 images (2 images per group) in data1) cross-validation as X_train, and to define the whole data2 as the X_test (I have the same y_train and y_test labels for data1 and data2)?
Does this idea sound reasonable?
Many thanks.