R语言使用caret包的confusionMatrix函数计算混淆矩阵、使用编写的自定义函数可视化混淆矩阵(confusion matrix)
目录
R语言使用caret包的confusionMatrix函数计算混淆矩阵、使用编写的自定义函数可视化混淆矩阵(confusion matrix)
#使用caret包的confusionMatrix函数计算混淆矩阵
#导入包和库
library(caret)
library(ggplot2)
#仿真数据
# construct the evaluation dataset
set.seed(144)
true_class <- factor(sample(paste0("Class