Skip to content

Commit 3e14f61

Browse files
glemaitrejnothman
authored andcommitted
DOC Make explicit that groups required *Group* splitter (scikit-learn#14235)
1 parent 936a9fa commit 3e14f61

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

sklearn/feature_selection/rfe.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,8 @@ def fit(self, X, y, groups=None):
469469
470470
groups : array-like, shape = [n_samples], optional
471471
Group labels for the samples used while splitting the dataset into
472-
train/test set.
472+
train/test set. Only used in conjunction with a "Group" `cv`
473+
instance (e.g., `GroupKFold`).
473474
"""
474475
X, y = check_X_y(X, y, "csr")
475476

sklearn/model_selection/_search.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,8 @@ def fit(self, X, y=None, groups=None, **fit_params):
630630
631631
groups : array-like, with shape (n_samples,), optional
632632
Group labels for the samples used while splitting the dataset into
633-
train/test set.
633+
train/test set. Only used in conjunction with a "Group" `cv`
634+
instance (e.g., `GroupKFold`).
634635
635636
**fit_params : dict of string -> object
636637
Parameters passed to the ``fit`` method of the estimator

sklearn/model_selection/_validation.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ def cross_validate(estimator, X, y=None, groups=None, scoring=None, cv='warn',
6060
6161
groups : array-like, with shape (n_samples,), optional
6262
Group labels for the samples used while splitting the dataset into
63-
train/test set.
63+
train/test set. Only used in conjunction with a "Group" `cv` instance
64+
(e.g., `GroupKFold`).
6465
6566
scoring : string, callable, list/tuple, dict or None, default: None
6667
A single string (see :ref:`scoring_parameter`) or a callable
@@ -294,7 +295,8 @@ def cross_val_score(estimator, X, y=None, groups=None, scoring=None, cv='warn',
294295
295296
groups : array-like, with shape (n_samples,), optional
296297
Group labels for the samples used while splitting the dataset into
297-
train/test set.
298+
train/test set. Only used in conjunction with a "Group" `cv` instance
299+
(e.g., `GroupKFold`).
298300
299301
scoring : string, callable or None, optional, default: None
300302
A string (see model evaluation documentation) or
@@ -674,7 +676,8 @@ def cross_val_predict(estimator, X, y=None, groups=None, cv='warn',
674676
675677
groups : array-like, with shape (n_samples,), optional
676678
Group labels for the samples used while splitting the dataset into
677-
train/test set.
679+
train/test set. Only used in conjunction with a "Group" `cv` instance
680+
(e.g., `GroupKFold`).
678681
679682
cv : int, cross-validation generator or an iterable, optional
680683
Determines the cross-validation splitting strategy.
@@ -1107,7 +1110,8 @@ def learning_curve(estimator, X, y, groups=None,
11071110
11081111
groups : array-like, with shape (n_samples,), optional
11091112
Group labels for the samples used while splitting the dataset into
1110-
train/test set.
1113+
train/test set. Only used in conjunction with a "Group" `cv` instance
1114+
(e.g., `GroupKFold`).
11111115
11121116
train_sizes : array-like, shape (n_ticks,), dtype float or int
11131117
Relative or absolute numbers of training examples that will be used to
@@ -1368,7 +1372,8 @@ def validation_curve(estimator, X, y, param_name, param_range, groups=None,
13681372
13691373
groups : array-like, with shape (n_samples,), optional
13701374
Group labels for the samples used while splitting the dataset into
1371-
train/test set.
1375+
train/test set. Only used in conjunction with a "Group" `cv` instance
1376+
(e.g., `GroupKFold`).
13721377
13731378
cv : int, cross-validation generator or an iterable, optional
13741379
Determines the cross-validation splitting strategy.

0 commit comments

Comments
 (0)