@@ -452,8 +452,8 @@ def _iter_test_indices(self, X, y=None, groups=None):
452
452
class GroupKFold (_BaseKFold ):
453
453
8000
"""K-fold iterator variant with non-overlapping groups.
454
454
455
- The same group will not appear in two different folds (the number of
456
- distinct groups has to be at least equal to the number of folds).
455
+ Each group will appear exactly once in the test set across all folds (the
456
+ number of distinct groups has to be at least equal to the number of folds).
457
457
458
458
The folds are approximately balanced in the sense that the number of
459
459
distinct groups is approximately the same in each fold.
@@ -762,10 +762,11 @@ class StratifiedGroupKFold(_BaseKFold):
762
762
return stratified folds with non-overlapping groups. The folds are made by
763
763
preserving the percentage of samples for each class.
764
764
765
- The same group will not appear in two different folds (the number of
766
- distinct groups has to be at least equal to the number of folds).
765
+ Each group will appear exactly once in the test set across all folds (the
766
+ number of distinct groups has to be at least equal to the number of folds).
767
767
768
- The difference between GroupKFold and StratifiedGroupKFold is that
768
+ The difference between :class:`~sklearn.model_selection.GroupKFold`
769
+ and :class:`~sklearn.model_selection.StratifiedGroupKFold` is that
769
770
the former attempts to create balanced folds such that the number of
770
771
distinct grou
3CF7
ps is approximately the same in each fold, whereas
771
772
StratifiedGroupKFold attempts to create folds which preserve the
0 commit comments