Skip to content

Conversation

@ZeeshanLone
Copy link
Contributor

Reference Issues/PRs

Towards #24862

What does this implement/fix? Explain your changes.

Added parameter validation for datasets.make_circle

Any other comments?

Tests passed flake8 ./sklearn/datasets/_samples_generator.py, pytest -vl sklearn/tests/test_public_functions.py

Copy link
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @still-learning-ev. Here are a couple of comments

"shuffle": ["boolean"],
"noise": [Interval(Real, 0, None, closed="left"), None],
"random_state": ["random_state"],
"factor": [Interval(Real, 0, 1, closed="both")],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the validation on line 729, 0 is allowed and 1 is not.

Suggested change
"factor": [Interval(Real, 0, 1, closed="both")],
"factor": [Interval(Real, 0, 1, closed="left")],

You can now remove validation on line 729, and check in test_sample_generator if we check for this specific error (in which case you can remove it).

Please also fix the param description in the docstring which should be ìn the range [0, 1)

@ZeeshanLone
Copy link
Contributor Author

Thanks for the PR @still-learning-ev. Here are a couple of comments

Thanks for the suggestion @jeremiedbb

@jeremiedbb
Copy link
Member

I unresolved this #25804 (comment) since the 2 second part of the comment still needs to be addressed.

@ZeeshanLone
Copy link
Contributor Author

"left": the interval is closed on the left and open on the right. It is equivalent to the interval [ left, right ) [0,1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants