Adam Zeidan
Adam Zeidan

Reputation: 21

How do I calculate the Confusion Matrix?

This is the WEKA output that i was able to generate. Unfortunatly, I do not know how to calculate the confusion matrix. Could someone help me calculate it?

=== Classifier model (full training set) ===

J48 pruned tree

-----------------

plas <= 127: negative (485.0/94.0)
plas > 127
|   mass <= 29.9
|   |   plas <= 145: negative (41.0/6.0)
|   |   plas > 145
|   |   |   age <= 25: negative (4.0)
|   |   |   age > 25
|   |   |   |   age <= 61: positive (27.0/9.0)
|   |   |   |   age > 61: negative (4.0)
|   mass > 29.9
|   |   plas <= 157
|   |   |   age <= 30: negative (50.0/23.0)
|   |   |   age > 30: positive (65.0/18.0)
|   |   plas > 157: positive (92.0/12.0)

Number of Leaves  : 8

Size of the tree :  15

a. Use the WEKA output to construct a confusion matrix. (Hint: look at each leaf node to determine how many instances fall into each of the four quadrants; and aggregate results of all leaf nodes to obtain the final counts) enter image description here

TP=?

FP=?

FN=?

TN=?

b. In medical diagnosis, three metrics are commonly used: sensitivity, specificity and diagnosis accuracy. Sensitivity is defined as TP/(TP+FN) ; Specificity is defined as TN/(FP+TN); Diagnosis Accuracy is defined as the average of Sensitivity and Specificity. Calculate the Diagnosis Accuracy based on the confusion matrix above.

If someone could help me with this, i would greatly appreciate it. Thank you!

Upvotes: 1

Views: 2522

Answers (2)

knb
knb

Reputation: 9303

In the "Classify" Panel, click on "More Options", Click on "Output Confusion matrix", click OK.

I have added a screenshot of the respective GUI screens and dialog boxes. In the sccreenshot "More options..." button (1) is greyed out because I have already clicked it.

enter image description here

Upvotes: 1

drp
drp

Reputation: 340

Here to fill the required table you have to understand the tree and figures at each of its leaf. Root node of the tree is 'plas'. It has two children. All the cases of input where 'plas' less than or equal to 127 falls at first child whereas all cases where 'plas' greater than 127 falls at second. Negative at leaf of first child indicates that cases which falls at first child are all negative. Figure 485 in parenthesis denotes number of input cases that are having 'plas' less than or equal to 127 & 94 denotes that out of these 485 cases, 94 are miss-classified as negative. Similar is the case for rest of the tree. So,

  • TP=145
  • FP=39
  • TN=461
  • FN=123

Hope this helps. Comment if anything seems doubtful.

Upvotes: 0

Related Questions