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

Why am I getting 32 bit response for confusion_matrix when all the inputs are 64 bit? #7929

Closed
simonm3 opened this issue Nov 24, 2016 · 6 comments

Comments

@simonm3
Copy link

@simonm3 simonm3 commented Nov 24, 2016

I have a sample of 1m rows and the cohen_kappa_score showed as -11.3 when it should be -1 to +1. Further investigation showed that the confusion matrix returns a 32 bit result and in cohen_kappa calculation the outer product overflows.

Here is an example with a small amount of data. If I put np.int64 around the confusion matrix then it works.

import sys
from sklearn.metrics import confusion_matrix
y1 = np.int64([1,0,0,1])
y2 = np.int64([0,0,1,1])
confusion = confusion_matrix(y1, y2)
sys.version, type(y1[0]), type(y2[0]), type(confusion[0,0])

('3.5.2 |Anaconda 4.1.1 (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)]',
numpy.int64,
numpy.int64,
numpy.int32)

@jnothman
Copy link
Member

@jnothman jnothman commented Nov 24, 2016

@simonm3
Copy link
Author

@simonm3 simonm3 commented Nov 24, 2016

@jnothman
Copy link
Member

@jnothman jnothman commented Nov 24, 2016

@lesteve
Copy link
Member

@lesteve lesteve commented Dec 1, 2016

Why is the default int 32 bit when I am running a 64 bit machine?

For the record this happens only on Windows, on my Linux box, np.iinfo(int) is int64. I always wondered what is the point of using np.int to be honest instead of an explicit np.int32 or np.int64. @jnothman I am interested if you have any hints about that.

@amueller
Copy link
Member

@amueller amueller commented Mar 3, 2017

@jnothman is this still open?

@jnothman
Copy link
Member

@jnothman jnothman commented Mar 4, 2017

Waiting for you or someone to review #8094

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.