Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
edited tags
Link
Rawan
  • 163
  • 1
  • 5
Source Link
Rawan
  • 163
  • 1
  • 5

Splitting the dataset manually for k-Fold Cross-Validation

I manually divided the dataset into three sets: train, test, and validation. Each set includes several folders, one for each patient. Each patient has many images from a different point of view. As a result, I manually divided the dataset by patient folders to avoid having the same patient appear in more than one set.

Train:
   class 1:
      patient_1:
         a.png
.......

Now I'd like to apply k-Fold Cross-Validation on a manually split dataset. Is it possible to do so?.

x_train,y_train= load_mydata()    
x_test,y_test= load_mydata()
x_val,y_val= load_mydata()

from sklearn.model_selection import cross_val_score
    # evaluate model
scores = cross_val_score(model, ?, ?, scoring='accuracy', cv=cv, n_jobs=-1)

Can I re-split the dataset to 50% for training and 50% for testing and using them in the cross validation two times?