# \donttest{
set.seed(183)
# Two-class
binomial_case <- data.frame(labels = sample(c("True","False"), 100, replace = TRUE),
predictions = sample(c("True","False"), 100, replace = TRUE))
# Multi-class
multinomial_case <- data.frame(labels = sample(c("Red","Blue", "Green"), 100,
replace = TRUE), predictions = sample(c("Red","Blue", "Green"), 100, replace = TRUE))
# Plot two-class confusion matrix
confusion_matrix(data = binomial_case, obs = labels, pred = predictions,
plot = TRUE, colors = c(low="pink" , high="steelblue"), unit = "count")
# Plot multi-class confusion matrix
confusion_matrix(data = multinomial_case, obs = labels, pred = predictions,
plot = TRUE, colors = c(low="#f9dbbd" , high="#735d78"), unit = "count")
# }
Run the code above in your browser using DataLab