Hi, I'm having challenges understanding how to read confusion matrix results when there are multiple predictions. I have two examples below. Can someone help me interpret either one of these? What I speculate is that the diagonals are the accuracies, but this is not quite right because in my first example, I can't say Setosa is 33% correct.

It seems to me that the numbers in the confusion matrix are the percent of samples in each category. From your first example, notice that the iris data are perfectly balanced across the three species.

Note that each column of the confusion matrix sums to 33.3, matching the percentage of each species in the population and all of the displayed percentages result in integers (with a little rounding) when applied to 150 samples. The confusion matrix says that 33.3% (50) of the samples are predicted to be setosa and all of them are truly setosa. 32% (48 samples) are predicted to be versicolor and truly are versicolor while 2% (3 samples) are predicted versicolor and are truly virginica.

To add to FJCC's answer, when you apply confusionMatrix on a object of class train, it uses confusionMatrix.train, which is by default confusionMatrix(data, norm = "overall", dnn = c("Prediction", "Reference"), ...).

If you want to get the absolute values as FJCC showed in the above post, use norm = "none". Here's an excerpt from the documentation:

There are several ways to show the table entries. Using norm = "none" will show the aggregated counts of samples on each of the cells (across all resamples). For norm = "average" , the average number of cell counts across resamples is computed (this can help evaluate how many holdout samples there were on average). The default is norm = "overall" , which is equivalento to "average" but in percentages.