I’m wondering if there is a way to get the scores of each trial instead of each split when I use mne.decoding.cross_val_multiscore(). At first, I use the leave one out cross-validation method to get scores of each trial, but the computation cost too much and not preferred compared with the KFold or StratifiedKFold (n_splits = 5 or 10). I’m wondering if there is a way to get scores of each trial when using StratifiedKFold cross-validation method.
Here is my code snippet:
And the shape of dvalues_fea_col is (n_epochs/samples, n_time_points), this is exactly what I want! I’m gonna to try other methods of cross_val_predict(), like ‘predict_proba’ and so on to see if the shapes of the results will be what I want. And my another concern is whether the orders of the epochs/events in the obtained dvalues npy file will be different from the original ones(the orders in the experiment), because according to the visualization of the StratifiedKFold behavior:
So maybe I should try Kfold instead of StratifiedKFold, do you have any thoughts about that? And thank you again, your suggestion really help me a lot!
Yeah, I get your point. But before I called the cross_val_predict(), I do this: time_decod_col.fit(epochs_data_train, labels_fea_col),
and then dvalues_fea_col = cross_val_predict(time_decod_col, epos, labels_fea_col, cv=cv, n_jobs=-1, method='decision_function'). And following is the shape of outputs when using different method arguments:
you can see that 625 is the number of time points, 115 is the number of epochs, 3 is the permutation times (can be ignored). I think the reason I can get these time-resolved results is I fit the SlidingEstimator first, and then use the cross_val_predict(), so it worked. But if I do not fit the SlidingEstimator, the cross_val_predict() might not work, just like the problem I met with the decision function method of SlidingEstimator. Back then I’m so confused why the decision function method could not work to gave me the d values of each time point though the documents already state that the SlidingEstimator do have this method, and it turned out that I did not use the .fit to the SlidingEstimator. I don’t know if I made my points clear