R how to visualize confusion matrix using the caret package
confusion-matrix, r
Solution
You could use the built-in `fourfoldplot`. For example,
ctable <- as.table(matrix(c(42, 6, 8, 28), nrow = 2, byrow = TRUE))
fourfoldplot(ctable, color = c("#CC6666", "#99CC99"),
conf.level = 0, margin = 1, main = "Confusion Matrix")
Problem
I'd like to visualize the data I've put in the confusion matrix. Is there a function I could simply put the confusion matrix and it would visualize it (plot it)? Example what I'd like to do(Matrix$nnet is simply a table containing results from the classification): ``` Confusion$nnet <- confusionMatrix(Matrix$nnet) plot(Confusion$nnet) ``` My Confusion$nnet$table looks like this: ``` prediction (I would also like to get rid of this string, any help?) 1 2 1 42 6 2 8 28 ```