-
-
Notifications
You must be signed in to change notification settings - Fork 26.5k
[MRG] FIX Use take instead of choose #12165
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
Conversation
ogrisel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM besides the non-regression test could be made more intuitive.
| # Non-regression smoke test for #12146 | ||
| y = np.arange(50) | ||
| weight = compute_sample_weight('balanced', y, indices=np.arange(50)) | ||
| assert len(np.unique(weight)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the intent of this assertion. The following looks more natural to me:
n_classes = 50 # more than 32 distinct classes
y = np.arange(n_classes) # one sample for each class
indices = np.arange(n_classes) # disable subsampling explicitly
weight = compute_sample_weight('balanced', y, indices)
assert_allclose(weight, np.ones(y.shape[0]))|
I think we should backport this fix for 0.20.1. Meaning the whats new entry should be written accordingly. |
I don't mind much either way but have moved what's new. Do we have a 0.20.1 PR open? |
qinhanmin2014
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #12146