Skip to content

MAINT Parameters validation for svm.l1_min_c #24865

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

Merged
merged 8 commits into from
Nov 18, 2022

Conversation

glevv
Copy link
Contributor

@glevv glevv commented Nov 8, 2022

Reference Issues/PRs

Towards #24862

@glevv glevv changed the title [WIP] Added parameter validation for l1_min_c function WIP Added parameter validation for l1_min_c function Nov 8, 2022
@glevv glevv changed the title WIP Added parameter validation for l1_min_c function MAINT Parameters validation for l1_min_c Nov 8, 2022
@glevv
Copy link
Contributor Author

glevv commented Nov 9, 2022

I also don't understand these lines (from here and forward)

@pytest.mark.parametrize("seed, val", [(None, 81), (0, 54), (_MAX_UNSIGNED_INT, 9)])

Should random seeds check even be here? They are more of a general checks, than svm ones.

@ArturoAmorQ
Copy link
Member

Should random seeds check even be here? They are more of a general checks, than svm ones.

Yes, we also validate the random state (see here for example). We use the string "random_state" in the constraints dictionary, which is interpreted as constraining the parameter to either be an instance of RandomState, an int, or None.

Does that answer the question?

@glevv
Copy link
Contributor Author

glevv commented Nov 9, 2022

Should random seeds check even be here? They are more of a general checks, than svm ones.

Yes, we also validate the random state (see here for example). We use the string "random_state" in the constraints dictionary, which is interpreted as constraining the parameter to either be an instance of RandomState, an int, or None.

Does that answer the question?

So, I need to remove these tests, since parameter validation was added and there is no need in outside random seed validation?

@ArturoAmorQ
Copy link
Member

Should random seeds check even be here? They are more of a general checks, than svm ones.

I think I hadn't understand your question on my previous post. If the question is "why are we testing this inside the svm/tests/test_bounds.py file?", the reason is that we are not testing the random seed itself, but that the set_seed_wrap and bounded_rand_int_wrap functions from sklearn.svm._newrand are behaving as expected.

Hope this time I do answer the question! ;)

@glevv
Copy link
Contributor Author

glevv commented Nov 9, 2022

@ArturoAmorQ Oh, I see, so test_bounds.py contains tests for _bounds,py and _newrand.pyx

@glevv glevv marked this pull request as ready for review November 9, 2022 16:48
@glevv glevv changed the title MAINT Parameters validation for l1_min_c MAINT Parameters validation for svm.l1_min_c Nov 9, 2022
Copy link
Member

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

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

Thanks @glevv.

LGTM, and I don't think this function is used anywhere where we need to worry about performance degradation.

@adrinjalali adrinjalali added Quick Review For PRs that are quick to review Waiting for Second Reviewer First reviewer is done, need a second one! labels Nov 14, 2022
Copy link
Member

@ArturoAmorQ ArturoAmorQ left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @glevv!

Copy link
Member

@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

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

LGTM.

@jjerphan jjerphan merged commit 5e02715 into scikit-learn:main Nov 18, 2022
@glevv glevv deleted the l1-min-c-param-val branch January 2, 2023 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:svm No Changelog Needed Quick Review For PRs that are quick to review Waiting for Second Reviewer First reviewer is done, need a second one!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants