-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Stratified splitters user warnings #28628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Stratified splitters user warnings #28628
Conversation
…ns less than 2 unique classes
@myenugula Also dont forget train_test_split with stratify=True and RepeatedStratifiedKFold |
@oasidorshin The
Output:
Similarly,
Output:
However, I'm thinking of replacing
with
in the |
…e of single class
@myenugula Thank you, looks good! I think that
is the way to go |
Any update on this? |
Is there something more you want to add in this issue ? maybe i could help |
Hello any update ? |
2 similar comments
Hello any update ? |
Hello any update ? |
Hi @lesteve, Could you please review this PR? |
Reference Issues/PRs
#28609
What does this implement/fix? Explain your changes.
Implement a warning in StratifiedKFold, StratifiedGroupKFold, and StratifiedShuffleSplit to alert users when only a single class is present in the target variable, suggesting that stratified splitting might not be appropriate and guiding towards more suitable cross-validation strategies.
Any other comments?
Here's a code sample of using the 3 classes, and it shows a user warning accordingly.
Output: