diff --git a/sklearn/datasets/_samples_generator.py b/sklearn/datasets/_samples_generator.py index 59c32125b6ff3..ffe81d9c13a18 100644 --- a/sklearn/datasets/_samples_generator.py +++ b/sklearn/datasets/_samples_generator.py @@ -6,7 +6,7 @@ # G. Louppe, J. Nothman # License: BSD 3 clause -from numbers import Integral +from numbers import Integral, Real import numbers import array import warnings @@ -39,6 +39,25 @@ def _generate_hypercube(samples, dimensions, rng): return out +@validate_params( + { + "n_samples": [Interval(Integral, 1, None, closed="left")], + "n_features": [Interval(Integral, 1, None, closed="left")], + "n_informative": [Interval(Integral, 1, None, closed="left")], + "n_redundant": [Interval(Integral, 0, None, closed="left")], + "n_repeated": [Interval(Integral, 0, None, closed="left")], + "n_classes": [Interval(Integral, 1, None, closed="left")], + "n_clusters_per_class": [Interval(Integral, 1, None, closed="left")], + "weights": ["array-like", None], + "flip_y": [Interval(Real, 0, 1, closed="both")], + "class_sep": [Interval(Real, 0, None, closed="neither")], + "hypercube": ["boolean"], + "shift": [Interval(Real, None, None, closed="neither"), "array-like", None], + "scale": [Interval(Real, 0, None, closed="neither"), "array-like", None], + "shuffle": ["boolean"], + "random_state": ["random_state"], + } +) def make_classification( n_samples=100, n_features=20, diff --git a/sklearn/tests/test_public_functions.py b/sklearn/tests/test_public_functions.py index 0e95f359a71aa..4a733b1b71252 100644 --- a/sklearn/tests/test_public_functions.py +++ b/sklearn/tests/test_public_functions.py @@ -103,6 +103,7 @@ def _check_function_param_validation( "sklearn.covariance.empirical_covariance", "sklearn.covariance.shrunk_covariance", "sklearn.datasets.fetch_california_housing", + "sklearn.datasets.make_classification", "sklearn.datasets.make_sparse_coded_signal", "sklearn.decomposition.sparse_encode", "sklearn.feature_extraction.grid_to_graph",