Furthermore, we can inspect where a particular misclassification has been made by examining the confusion matrix. The confusion matrix shows how a specific class value was predicted:
double[][] confusionMatrix = eval_roc.confusionMatrix(); System.out.println(eval_roc.toMatrixString());
The resulting confusion matrix is as follows:
=== Confusion Matrix === a b c d e f g <-- classified as 41 0 0 0 0 0 0 | a = mammal 0 20 0 0 0 0 0 | b = bird 0 0 3 1 0 1 0 | c = reptile 0 0 0 13 0 0 0 | d = fish 0 0 1 0 3 0 0 | e = amphibian 0 0 0 0 0 5 3 | f = insect 0 0 0 0 0 2 8 | g = invertebrate
The column names in the first row correspond to the labels assigned by the classification node. Each additional row then corresponds to an actual true class value. For instance, the second row corresponds to instances with the mammal true class label. In the column line, we read that all mammals were correctly classified as mammals. In the fourth row, reptiles, we notice that three were correctly classified as reptiles, while one was classified as fish and one as insect. The confusion matrix gives us insight into the kinds of errors that our classification model can make.