1
$\begingroup$

I'm trying to do a cross validation with multiple fold with a 70%/30% train/test set split in folds and even class in my folds:

For example, I have:
1000 observations with about 800 class "0" and 200 class "1",
I would like to do 10 folds with each fold having around 70 observations in train set and 30 observations in test set,
and inside each fold, the train set and test set should have 50% class "0" and 50% of class "1", so around 35 class "0" and 35 class "1" in train test and 15 class "0" and 15 class "1" in test test

First is it a valid approch and is there any method to do it in Python ?

Edit: apparently, if I choose 10 fold, it will be a 90%/10% ratio for my train/test set ?

$\endgroup$
  • 1
    $\begingroup$ Why do you want to alter the class balance from 80/20 to 50/50 for your cross-validation? Do you expect a 50/50 balance in your production data? $\endgroup$ – Stev Apr 17 '18 at 8:51
-1
$\begingroup$

There is clear class imbalance in the data so first apply class balancing techniques like SMOTE on train data after train-test-split. Don't attempt to make any changes in test to balance the classes. Now that your train data has 50-50 classes, you can apply cross-validation if you wish.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.