Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jnothman
Copy link
Member

Fixes #12146

Copy link
Member

@ogrisel ogrisel left a 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))
Copy link
Member

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]))

@ogrisel
Copy link
Member

ogrisel commented Sep 27, 2018

I think we should backport this fix for 0.20.1. Meaning the whats new entry should be written accordingly.

@ogrisel ogrisel added this to the 0.20.1 milestone Sep 27, 2018
@jnothman
Copy link
Member Author

I think we should backport this fix for 0.20.1.

I don't mind much either way but have moved what's new. Do we have a 0.20.1 PR open?

Copy link
Member

@qinhanmin2014 qinhanmin2014 left a comment

Choose a reason for hiding this comment

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

LGTM

@qinhanmin2014 qinhanmin2014 merged commit da0cb32 into scikit-learn:master Sep 27, 2018
jnothman added a commit to jnothman/scikit-learn that referenced this pull request Oct 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants