0

I’m trying to make a simple pipeline and evaluate it’s accuracy, but for some reason I keep having this error ValueError: data copying was not requested by copy=None but it was required to get to double floating point precision cross_val_score on the cross_val_score line.

The weird thing is that I first encountered this error when trying to setup the pipeline with scikit-learn method ‘make_pipeline’. So I switched to this basic Pipeline(steps=…) call, and the first time I ran this code it actually worked. And when running it again it wouldn’t work. I’m kinda lost here.

Here is the relevant part of my code :

epochs_data = epochs.get_data()
scores = []
cv = ShuffleSplit(10, test_size=.3, random_state=99)

reg = LogisticRegression()
csp = CSP(n_components=10, reg=None, log=True, norm_trace=False)

clf = Pipeline(steps=[('CSP', csp), ('LogisticRegression', reg)])
scores = cross_val_score(clf, epochs_data, labels, cv=cv, n_jobs=-1)

I got the epochs object with :

# `files` corresponds to the raw data (concatenated)
events, event_id = events_from_annotations(files, event_id=event_mapping)
epochs = Epochs(files, events, event_id, tmin, tmax, proj=True,
                picks=picks, baseline=None, preload=True)
# the epochs object is correctly formatted, I checked it's content

I also checked the source code from mne that probably gives me this error text but I still don't get why I get this error. Finally the data is from mne.datasets.eegbci text, I'm dealing with edf files.

I tried a bunch of things instead of epochs.get_data(), like epochs.get_data().copy(), I tried using deepcopy as well, but it didn't work.

I tried make_pipeline instead of directly calling the Pipeline object, but it didn't work either.

0 Answers0