DOC Improve doc for GroupKFold and StratifiedGroupKFold
@@ -452,8 +452,8 @@ class KFold(_BaseKFold):
class GroupKFold(_BaseKFold):
"""K-fold iterator variant with non-overlapping groups.
- The same group will not appear in two different folds (the number of
- distinct groups has to be at least equal to the number of folds).
+ Each group will appear exactly once in the test set across all folds (the
+ number of distinct groups has to be at least equal to the number of folds).
The folds are approximately balanced in the sense that the number of
distinct groups is approximately the same in each fold.
@@ -762,10 +762,11 @@ class StratifiedGroupKFold(_BaseKFold):
return stratified folds with non-overlapping groups. The folds are made by
preserving the percentage of samples for each class.
- The same group will not appear in two different folds (the number of
- distinct groups has to be at least equal to the number of folds).
+ Each group will appear exactly once in the test set across all folds (the
+ number of distinct groups has to be at least equal to the number of folds).
- The difference between GroupKFold and StratifiedGroupKFold is that
+ The difference between :class:`~sklearn.model_selection.GroupKFold`
+ and :class:`~sklearn.model_selection.StratifiedGroupKFold` is that
the former attempts to create balanced folds such that the number of
distinct groups is approximately the same in each fold, whereas
StratifiedGroupKFold attempts to create folds which preserve the
