Skip to content

Commit 10344f9

Browse files
authored
MAINT Parameters validation for sklearn.utils.resample (scikit-learn#26139)
1 parent d8b05e0 commit 10344f9

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

sklearn/tests/test_public_functions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ def _check_function_param_validation(
254254
"sklearn.tree.export_text",
255255
"sklearn.tree.plot_tree",
256256
"sklearn.utils.gen_batches",
257+
"sklearn.utils.resample",
257258
]
258259

259260

sklearn/utils/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,14 @@ def _get_column_indices(X, key):
465465
)
466466

467467

468+
@validate_params(
469+
{
470+
"replace": ["boolean"],
471+
"n_samples": [Interval(numbers.Integral, 1, None, closed="left"), None],
472+
"random_state": ["random_state"],
473+
"stratify": ["array-like", None],
474+
}
475+
)
468476
def resample(*arrays, replace=True, n_samples=None, random_state=None, stratify=None):
469477
"""Resample arrays or sparse matrices in a consistent way.
470478

0 commit comments

Comments
 (0)