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

Confusion Matrix setup in scikit-learn #4

Closed
ouverz opened this issue Feb 3, 2016 · 1 comment
Closed

Confusion Matrix setup in scikit-learn #4

ouverz opened this issue Feb 3, 2016 · 1 comment

Comments

@ouverz
Copy link

ouverz commented Feb 3, 2016

Hi!
I wanted to start off by saying that your tutorials and videos are really great! so clear and simple!

I've been working on a binary classification problem for my school with scikit-learn and I have been scratching my head in regards to how it displays the confusion matrix. For instance I have as output

 [ [30  5]
    [2 42] ]

I noticed by looking at the classification report that scikit learn by default outputs the negative class first. This leads me to understand that the first list is the negative class and that the second is the positive class. However, what I don't understand how to interpret what each number stands for as in TP, FP, TN, FN.

TN(30) FN (5)
FP(2) TP (42)

Is this a current representation of the input above?

Thanks a bunch!

@justmarkham
Copy link
Owner

Hi @ouverz, thanks for your kind comments!

Regarding your interpretation of the confusion matrix, you have the FP and FN backwards. It should be:

TN(30) FP(5)
FN(2) TP(42)

Scroll down to the Confusion Matrix section of this notebook for more information and another example: https://github.com/justmarkham/scikit-learn-videos/blob/master/09_classification_metrics.ipynb

Hope that helps!

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

No branches or pull requests

2 participants