Skip to content
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

TST Add common tests for single class fitting induced by sample weights #24140

Merged
merged 82 commits into from Dec 29, 2022

Conversation

cmarmo
Copy link
Member

@cmarmo cmarmo commented Aug 8, 2022

Reference Issues/PRs

Fixes #10337.
Supersedes and closes #10347.

What does this implement/fix? Explain your changes.

This pull request adds common tests for classifiers reducing to less than two classes via sample weights during fit.
See this comment in #10337

Any other comments?

In the meanwhile SVM was modified by #14286.
The error message has been updated to make the new common tests pass.
#10347 already received one approval by @jnothman.

Copy link
Member

@thomasjpfan thomasjpfan 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!

sklearn/utils/estimator_checks.py Outdated Show resolved Hide resolved
sklearn/utils/estimator_checks.py Outdated Show resolved Hide resolved
sklearn/utils/estimator_checks.py Outdated Show resolved Hide resolved
sklearn/utils/estimator_checks.py Outdated Show resolved Hide resolved
sklearn/utils/tests/test_estimator_checks.py Show resolved Hide resolved
sklearn/utils/tests/test_estimator_checks.py Outdated Show resolved Hide resolved
@cmarmo
Copy link
Member Author

cmarmo commented Dec 12, 2022

I am using precommit and sklearn/svm/src/libsvm/svm.cpp has been heavily touched.
I am happy to revert, but perhaps cpp files should be excluded from precommit modifications in some configuration files?
Thanks.

@glemaitre glemaitre self-requested a review December 29, 2022 15:27
@glemaitre glemaitre changed the title [MRG] Add common tests for classifiers reducing to less than two classes via sample weights during fit. TST Add common tests for classifiers reducing to less than two classes via sample weights during fit. Dec 29, 2022
Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

Given the +1 or @jnothman on the original PR, my approval, and @thomasjpfan review, I think that this PR is good to be merged.

@@ -3167,7 +3167,7 @@ const char *PREFIX(check_parameter)(const PREFIX(problem) *prob, const svm_param
free(newprob.x);
free(newprob.y);
free(newprob.W);
return "Invalid input - all samples with positive weights have the same label.";
return "Invalid input - all samples with positive weights belong to the same class.";
Copy link
Member

Choose a reason for hiding this comment

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

For other reviewers: This is the only change in the file. I know that we usually don't do cosmetic change but here we remove all trailingspace once for all. I don't want to revert them.

@glemaitre glemaitre changed the title TST Add common tests for classifiers reducing to less than two classes via sample weights during fit. TST Add common tests for single class fitting induced by sample weights Dec 29, 2022
@glemaitre
Copy link
Member

Going to merge when the CIs turn green

@glemaitre glemaitre enabled auto-merge (squash) December 29, 2022 16:48
@glemaitre glemaitre merged commit 2cce024 into scikit-learn:main Dec 29, 2022
@cmarmo cmarmo deleted the test-sample-weight-one-class branch December 31, 2022 08:48
jjerphan pushed a commit to jjerphan/scikit-learn that referenced this pull request Jan 3, 2023
…ts (scikit-learn#24140)

Co-authored-by: johayon <johayon.math@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
jjerphan pushed a commit to jjerphan/scikit-learn that referenced this pull request Jan 20, 2023
…ts (scikit-learn#24140)

Co-authored-by: johayon <johayon.math@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
jjerphan pushed a commit to jjerphan/scikit-learn that referenced this pull request Jan 20, 2023
…ts (scikit-learn#24140)

Co-authored-by: johayon <johayon.math@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
jjerphan pushed a commit to jjerphan/scikit-learn that referenced this pull request Jan 23, 2023
…ts (scikit-learn#24140)

Co-authored-by: johayon <johayon.math@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
adrinjalali pushed a commit that referenced this pull request Jan 24, 2023
…ts (#24140)

Co-authored-by: johayon <johayon.math@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
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.

Add common test for classifiers reducing to less than two classes via sample weights during fit
5 participants