From d54ec4b7fb5adbcb7efbe01038b4dfffa40a2649 Mon Sep 17 00:00:00 2001 From: Balakumaran Manoharan Date: Mon, 17 Jul 2017 21:47:34 -0500 Subject: [PATCH 1/2] Fix wrong error message in StratifiedKFold --- sklearn/model_selection/_split.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sklearn/model_selection/_split.py b/sklearn/model_selection/_split.py index 4bcc0ae1c5349..ba90c475ec70a 100644 --- a/sklearn/model_selection/_split.py +++ b/sklearn/model_selection/_split.py @@ -577,8 +577,8 @@ 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" From f6bd5f63a18f2ce9e8f26fae412cf0b958ce9b3f Mon Sep 17 00:00:00 2001 From: Balakumaran Manoharan Date: Mon, 17 Jul 2017 22:42:16 -0500 Subject: [PATCH 2/2] Remove groups in warning message --- sklearn/model_selection/_split.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearn/model_selection/_split.py b/sklearn/model_selection/_split.py index ba90c475ec70a..65fe033595230 100644 --- a/sklearn/model_selection/_split.py +++ b/sklearn/model_selection/_split.py @@ -583,7 +583,7 @@ def _make_test_folds(self, X, y=None): 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)