diff --git a/sklearn/model_selection/_split.py b/sklearn/model_selection/_split.py index 4bcc0ae1c5349..65fe033595230 100644 --- a/sklearn/model_selection/_split.py +++ b/sklearn/model_selection/_split.py @@ -577,13 +577,13 @@ def _make_test_folds(self, X, y=None): y_counts = np.bincount(y_inversed) min_groups = np.min(y_counts) if np.all(self.n_splits > y_counts): - raise ValueError("All the n_groups for individual classes" - " are less than n_splits=%d." + raise ValueError("n_splits=%d cannot be greater than the" + " number of members in each class." % (self.n_splits)) if self.n_splits > min_groups: warnings.warn(("The least populated class in y has only %d" " members, which is too few. The minimum" - " number of groups for any class cannot" + " number of members in any class cannot" " be less than n_splits=%d." % (min_groups, self.n_splits)), Warning)