0
$\begingroup$

I've this matrix confusion:

[9779  107]
[2227  148]

What is the accuracy of my model? My doubt is because the confusion matrix is calculated based on Test dataset so how can it evaluate the accuracy of my model?

Thanks!

$\endgroup$
2
$\begingroup$

A confusion matrix gives you the following:

[TP, FP]
[FN, TN]

where TP = 'true positives'; FP = 'false positives'; FN = 'false negatives'; TN = 'true negatives'.

You can read more here: http://www.dataschool.io/simple-guide-to-confusion-matrix-terminology/

By taking TP+TN and dividing by TP+FP+FN+TN, you can get the classification accuracy of your model. In your case, that means (9779+148)/(9779+107+2227+148) = about 81%

More details:

This type of confusion matrix is used for binary classification.

  • A 'true positive' in this case means a true instance of class 0; that is, the model predicts that a given example belongs to class 0 and it really does belong to class 0.
  • A 'true negative' means a true instance of class 1.
  • A 'false positive' means the model predicts that the example belongs to class 0 when it really belongs to class 1;
  • A 'false negative' means the model predicts that the example belongs to class 1 when it really belongs to class 0.
$\endgroup$
1
$\begingroup$

Assuming you have the elements 9779 = True Positive, 148 = True Negative, you can obtain the accuracy by adding the diagonal elements, then dividing by the sum of all the numbers within the matrix. So for your example:

(9779 + 148)/(9779 + 148 + 107 + 2227) = 0.80964..

Hence, Accuracy = 80.96%

More info: http://www.dataschool.io/simple-guide-to-confusion-matrix-terminology/

$\endgroup$
  • $\begingroup$ lol you beat me to the link! $\endgroup$ – StatsSorceress Mar 1 '18 at 16:23
  • $\begingroup$ Manoeuvring in supersonic speed mode o.O $\endgroup$ – Gale Mar 1 '18 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.