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

MAINT Added Parameter Validation for datasets.make_circles() #25804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 0 commits into from

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

sklearn/datasets/_samples_generator.py Outdated Show resolved Hide resolved
"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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.