如何合并来自多个算法输出的混淆矩阵?

问题描述

我想在一张表中提取多个预测模型的预测混淆矩阵,以便于比较。 我从每个模型中收集了混淆矩阵表,并将它们合并以创建下表。

Table1 <- rbind(confmat_nb$table,confmat_nb_2$table,confmat_svm$table)                          
Table1

      

                      Reference
                            excluded    included
      naive_bayes   excluded    6234    46
                    included    3107    470
      naive_bayes_2 excluded    5774    60
                    included    3567    456
      svm           excluded    7197    101
                    included    2144    415

表2是使用以下代码创建的

byClass <- rbind(naive_bayes =round(confmat_nb$byClass,3),naive_bayes_2=round(confmat_nb_2$byClass,svm = round(confmat_svm$byClass,3)

overall <- rbind(naive_bayes =round(confmat_nb$overall,naive_bayes_2=round(confmat_nb_2$overall,svm = round(confmat_svm$overall,3)

Table2 <- rbind(byClass,overall)

Table2

             Accuracy   Sensitivity Specificity Pos Pred Value  Neg Pred Value  Precision   
  naive_bayes   0.680     0.911      0.667        0.131            0.993        0.131   
  naive_bayes_2 0.632     0.884      0.618        0.113            0.990        0.113   
  svm           0.772     0.804      0.770        0.162            0.986        0.162
  

我的目标是合并表1和表2,并将输出提取一个表中。像这样

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)