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

Skip to content

[MRG] FIX make count_nonzero dtype invariant wrt axis #12341

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 2 commits into from
Oct 14, 2018

Conversation

jnothman
Copy link
Member

Pulled out of #11179, where using samplewise=True changed the confusion matrix dtype.

I don't think this should affect any public interfaces until #11179.

@qinhanmin2014
Copy link
Member

@jnothman So you pull it out here and keep it in #11179 , what's your intention?
And again where do you find the return type of bincount? I definitely trust you but I just want to learn how to find these things. Thanks :)

@jnothman
Copy link
Member Author

jnothman commented Oct 10, 2018 via email

@jnothman
Copy link
Member Author

@qinhanmin2014, please confirm this works on your window setup too :)

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, these new test passes (and fail on master) on my Windows.
I'm not familiar with numpy, so not sure whether the return type will be changed since it's not officially documented. Maybe I'll cast all the return values to a specific type (e.g., int), but I guess this is not a big problem here.

@qinhanmin2014
Copy link
Member

And let's hurry this one into 0.20.1 unless you oppose.

@qinhanmin2014 qinhanmin2014 added this to the 0.20.1 milestone Oct 11, 2018
@jnothman
Copy link
Member Author

jnothman commented Oct 11, 2018 via email

@qinhanmin2014 qinhanmin2014 removed this from the 0.20.1 milestone Oct 11, 2018
@qinhanmin2014
Copy link
Member

Apologies for the previous comment. I somehow messed up some PRs.
@jnothman I've removed the milestone here.

Copy link
Member

@rth rth left a comment

Choose a reason for hiding this comment

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

LGTM apart for the comment below. Thanks!


# Check dtypes with large sparse matrices too
X_csr = sp.csr_matrix((X_csr.data, X_csr.indices.astype(np.int64),
X_csr.indptr.astype(np.int64)), shape=X_csr.shape)
Copy link
Member

Choose a reason for hiding this comment

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

If you want to test this, you would have to monkeypatch X_csr.indices etc as otherwise csr_matrix will downcast them as needed (here to int32)

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.

I think the test failures are unrelated.

@qinhanmin2014 qinhanmin2014 merged commit 98357ec into scikit-learn:master Oct 14, 2018
anuragkapale pushed a commit to anuragkapale/scikit-learn that referenced this pull request Oct 23, 2018
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
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