0
$\begingroup$

I have a model for a binary classification problem that I want to cross validate. The data is divided into groups. Some groups contain samples in both classes, others only contain samples from one class. Given the nature of the data, it's important that each group is entirely in the training set or entirely in the test set in each fold (i.e. what scikit-learn's GroupKFold does). But I'd also like each test set to be balanced (or at least not contain samples from only one class, which is what GroupKFold gives me). Is there a known algorithm for doing cross validation with both stratification and groups like this?

$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.