From 3bea814a79be4ea5975c1c7b7525ad68b4ba2d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Baranger?= Date: Wed, 22 Mar 2023 19:09:53 +0100 Subject: [PATCH 1/3] add parameters validation to datasets.make_biclusters --- sklearn/datasets/_samples_generator.py | 11 +++++++++++ sklearn/tests/test_public_functions.py | 1 + 2 files changed, 12 insertions(+) diff --git a/sklearn/datasets/_samples_generator.py b/sklearn/datasets/_samples_generator.py index 192f8e6759ddb..0368e47e54246 100644 --- a/sklearn/datasets/_samples_generator.py +++ b/sklearn/datasets/_samples_generator.py @@ -1785,6 +1785,17 @@ def _shuffle(data, random_state=None): return result, row_idx, col_idx +@validate_params( + { + "shape": [tuple], + "n_clusters": [Interval(Integral, 1, None, closed="left")], + "noise": [Interval(Real, 0, None, closed="left")], + "minval": [Interval(Real, None, None, closed="neither")], + "maxval": [Interval(Real, None, None, closed="neither")], + "shuffle": ["boolean"], + "random_state": ["random_state"], + } +) def make_biclusters( shape, n_clusters, diff --git a/sklearn/tests/test_public_functions.py b/sklearn/tests/test_public_functions.py index 4b1934c378fbf..8646e10083666 100644 --- a/sklearn/tests/test_public_functions.py +++ b/sklearn/tests/test_public_functions.py @@ -129,6 +129,7 @@ def _check_function_param_validation( "sklearn.datasets.fetch_olivetti_faces", "sklearn.datasets.load_svmlight_file", "sklearn.datasets.load_svmlight_files", + "sklearn.datasets.make_biclusters", "sklearn.datasets.make_circles", "sklearn.datasets.make_classification", "sklearn.datasets.make_friedman1", From e56b2c1bfb61c6b81c9fb576fd8ffe5dd0938499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Baranger?= Date: Wed, 22 Mar 2023 19:21:20 +0100 Subject: [PATCH 2/3] update shape type to tuple in docstring --- sklearn/datasets/_samples_generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearn/datasets/_samples_generator.py b/sklearn/datasets/_samples_generator.py index 0368e47e54246..b0e460bfc2162 100644 --- a/sklearn/datasets/_samples_generator.py +++ b/sklearn/datasets/_samples_generator.py @@ -1812,7 +1812,7 @@ def make_biclusters( Parameters ---------- - shape : iterable of shape (n_rows, n_cols) + shape : tuple of shape (n_rows, n_cols) The shape of the result. n_clusters : int From eac275449dcdcdf1c0dfefa494ac1c08ed1614aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Baranger?= Date: Mon, 27 Mar 2023 19:12:35 +0200 Subject: [PATCH 3/3] change minval and maxval type to float in docstring --- sklearn/datasets/_samples_generator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sklearn/datasets/_samples_generator.py b/sklearn/datasets/_samples_generator.py index b0e460bfc2162..b7031500ab665 100644 --- a/sklearn/datasets/_samples_generator.py +++ b/sklearn/datasets/_samples_generator.py @@ -1821,10 +1821,10 @@ def make_biclusters( noise : float, default=0.0 The standard deviation of the gaussian noise. - minval : int, default=10 + minval : float, default=10 Minimum value of a bicluster. - maxval : int, default=100 + maxval : float, default=100 Maximum value of a bicluster. shuffle : bool, default=True