Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 10dbc14

Browse filesBrowse files
author
Théophile Baranger
authored
MAINT Parameters validation for datasets.make_moons (#25971)
1 parent fce9a77 commit 10dbc14
Copy full SHA for 10dbc14

File tree

Expand file treeCollapse file tree

3 files changed

+9
-6
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+9
-6
lines changed

‎sklearn/datasets/_samples_generator.py

Copy file name to clipboardExpand all lines: sklearn/datasets/_samples_generator.py
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,14 @@ def make_circles(
778778
return X, y
779779

780780

781+
@validate_params(
782+
{
783+
"n_samples": [Interval(Integral, 1, None, closed="left"), tuple],
784+
"shuffle": ["boolean"],
785+
"noise": [Interval(Real, 0, None, closed="left"), None],
786+
"random_state": ["random_state"],
787+
}
788+
)
781789
def make_moons(n_samples=100, *, shuffle=True, noise=None, random_state=None):
782790
"""Make two interleaving half circles.
783791

‎sklearn/datasets/tests/test_samples_generator.py

Copy file name to clipboardExpand all lines: sklearn/datasets/tests/test_samples_generator.py
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -636,12 +636,6 @@ def test_make_moons_unbalanced():
636636
assert X.shape == (12, 2), "X shape mismatch"
637637
assert y.shape == (12,), "y shape mismatch"
638638

639-
with pytest.raises(
640-
ValueError,
641-
match=r"`n_samples` can be either an int " r"or a two-element tuple.",
642-
):
643-
make_moons(n_samples=[1, 2, 3])
644-
645639
with pytest.raises(
646640
ValueError,
647641
match=r"`n_samples` can be either an int " r"or a two-element tuple.",

‎sklearn/tests/test_public_functions.py

Copy file name to clipboardExpand all lines: sklearn/tests/test_public_functions.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def _check_function_param_validation(
137137
"sklearn.datasets.make_gaussian_quantiles",
138138
"sklearn.datasets.make_hastie_10_2",
139139
"sklearn.datasets.make_low_rank_matrix",
140+
"sklearn.datasets.make_moons",
140141
"sklearn.datasets.make_multilabel_classification",
141142
"sklearn.datasets.make_regression",
142143
"sklearn.datasets.make_sparse_coded_signal",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.