0% found this document useful (0 votes)
50 views6 pages

Abdul Wajid Moroojo

The document discusses building a confusion matrix to evaluate a model that classifies images as cats or dogs. There were 15 images of cats and 20 of dogs passed to the model. The model incorrectly predicted 9 of the cat images as dogs and 6 of the dog images as cats. The confusion matrix shows that the model had 6 true positives (correctly identified cats), 9 false negatives (missed cats), 6 false positives (incorrectly identified dogs as cats), and 14 true negatives (correctly identified dogs). Formulas are provided to calculate several evaluation metrics from the confusion matrix, including accuracy (0.571428571), precision (0.5), recall (0.4), specificity (0.7), false positive rate

Uploaded by

Milton
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views6 pages

Abdul Wajid Moroojo

The document discusses building a confusion matrix to evaluate a model that classifies images as cats or dogs. There were 15 images of cats and 20 of dogs passed to the model. The model incorrectly predicted 9 of the cat images as dogs and 6 of the dog images as cats. The confusion matrix shows that the model had 6 true positives (correctly identified cats), 9 false negatives (missed cats), 6 false positives (incorrectly identified dogs as cats), and 14 true negatives (correctly identified dogs). Formulas are provided to calculate several evaluation metrics from the confusion matrix, including accuracy (0.571428571), precision (0.5), recall (0.4), specificity (0.7), false positive rate

Uploaded by

Milton
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

19SW117

ABDUL WAJID MOROOJO


Problem Statement: Imagine solving a binary Classification task. For example, you are
trying to determine whether a cat or a dog is on an image. You have a model and want to
evaluate its performance using the Confusion matrix. You pass 15 pictures with a cat
and 20 images with a dog to the model. From the given 15 cat images, the algorithm
predicts 9 pictures as the dog ones, and from the 20 dog images - 6 pictures as the cat ones. It
is time to build a Confusion matrix.

Solution:  Let’s say that the cat images are a Positive class, whereas the dog pictures are
a Negative one, i.e., is a cat and is not a cat of the 15 cat images (P), 9 were predicted as the
dog ones. So, only 15 - 9 = 6 predictions were correct. TP = 6. Of the 20 dog images
(N), 6 were predicted as the cat ones. So, 20 - 6 = 14 predictions were correct. TN = 14.
9 pictures were predicted as the dog ones, but they actually have a cat on them. So, FN = 9;
6 images were predicted as the cat ones, but they actually have a dog on them. So, FP = 6.

Confusion Matrix:

Observed Positive observed Negative

Predicted Positive TP=6 FP=6

Predicted Negative FN=9 TN=14

Calculating metrics on the above confusion matrix:

1) Accuracy:

OR
So, by the above formula, we have:

6+ 14
Accuracy=
6+6+ 9+14

20
Accuracy=
35

Acuracy=0.571428571

2) Precision:

6
precision=
6+6

6
precision=
12

precision=0.5

3) Recall (TRUE POSITIVE RATE):


6
Recall=
6+ 9

6
Recall=
15

Recall=0.4

4) Specificity (TRUE NEGATIVE RATE):

14
Specificity=
20

Specificity=0.7
5) False Positive Rate:

6
FPR=
6+14

6
FPR=
20

FPR=0.3

OR
FPR=1−SPECIFICITY

FPR=1−0.7

FPR=0.3
6) Error Rate:

6+9
ERR=
35

15
ERR=
35

ERR=0.428571429

You might also like