TST add balance property check for linear models#22892
Merged
jjerphan merged 14 commits intoscikit-learn:mainfrom Nov 18, 2022
Merged
TST add balance property check for linear models#22892jjerphan merged 14 commits intoscikit-learn:mainfrom
jjerphan merged 14 commits intoscikit-learn:mainfrom
Conversation
2 tasks
Member
Author
|
@rth @agramfort @TomDLT might be interested. |
Member
Author
|
I'm not sure where the best place for such a test is. Other models like trees and isotonic regression (should) also fulfil this property and pass such a test. |
TomDLT
approved these changes
Oct 11, 2022
Member
TomDLT
left a comment
There was a problem hiding this comment.
LGTM
Failing tests:
- For SGDRegressor, it is expected that the algorithm does not fully converge to a high-precision solution. It is due to the stochastic nature of the SGD algorithm, I would just skip the test.
- For SAG/SAGA, it is a bug, which is due to the fact that the random-sample selection does not take into account the sample weights. To fix the bug, we should implement an importance sampling scheme (see #21305).
jjerphan
approved these changes
Nov 18, 2022
Member
jjerphan
left a comment
There was a problem hiding this comment.
LGTM. Thank you for adding this theoretical assertion, @lorentzenchr!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference Issues/PRs
none
What does this implement/fix? Explain your changes.
This adds a test for all suitable models in
sklearn.linear_modelthat the balance property holds when fit withfit_intercept=True:sum(predicted) = sum(observed)on the training data.Any other comments?
Placed in
linear_model.test.test_common.py.Failing tests are marked as
xfail.