To create a confusion matrix with labels in Matlab, you can use the confusionmat
function. Here is an example:
main.m185 chars7 lines
In this example, we have two classes with labels 0 and 1. The confusionmat
function takes in the actual labels, predicted labels and the order of the labels. The resulting confusion matrix will have the actual labels as rows and the predicted labels as columns. You can then use the confusionchart
function to visualize the confusion matrix with labels:
main.m108 chars2 lines
This will create a confusion chart with row-normalized and column-normalized summary statistics.
gistlibby LogSnag