是否有 RWeka 的详细精度 Class?

Are there RWeka's Detailed Accuracy By Class?

Weka 3.8.3(机器学习平台)中,使用JRip分类器的分析结果如下表。

=== Summary ===

Correctly Classified Instances         158               25.2396 %
Incorrectly Classified Instances       468               74.7604 %
Kappa statistic                          0.0004
Mean absolute error                      0.3743
Root mean squared error                  0.4365
Relative absolute error                 99.7998 %
Root relative squared error            100.7977 %
Total Number of Instances              626    

=== Detailed Accuracy By Class ===

               TP Rate   FP Rate   Precision   Recall  F-Measure   ROC Area  Class
                 0.166     0.162      0.255     0.166     0.201      0.504    A
                 0         0          0         0         0          0.464    B
                 0.006     0.009      0.2       0.006     0.012      0.526    C
                 0.829     0.829      0.252     0.829     0.387      0.499    D
Weighted Avg.    0.252     0.252      0.177     0.252     0.151      0.498

=== Confusion Matrix ===

   a   b   c   d   <-- classified as
  26   0   1 130 |   a = A
  31   0   1 123 |   b = B
  20   0   1 135 |   c = C
  25   0   2 131 |   d = D

使用 RWeka 0.4-40(Weka for R),相同类型的分析产生以下形式的结果。

=== Summary ===

Correctly Classified Instances         203               32.4281 %
Incorrectly Classified Instances       423               67.5719 %
Kappa statistic                          0.0966
Mean absolute error                      0.3605
Root mean squared error                  0.4246
Relative absolute error                 96.1482 %
Root relative squared error             98.0552 %
Total Number of Instances              626     

=== Confusion Matrix ===

   a   b   c   d   <-- classified as
  41   0   3 113 |   a = A
  12   0   5 138 |   b = B
   7   0  23 126 |   c = C
   9   0  10 139 |   d = D

"Detailed Accuracy By Class" 部分(原始 Weka 结果的第二部分)的数据在哪里?我试过了

library(RWeka)
library(caret)
TrainData <- p[,2:211]
TrainClasses <- p[,215]
jripFit <- train(TrainData,TrainClasses,method='JRip')
jripFit
summary(jripFit)
str(jripFit)

但无处可寻。显然,p是我的data.frame,第215列是分类器

不需要使用 caret 包。

library(RWeka)
jripFit <- JRip(myClass ~ ., data = p[,c(2:211,215)])
summary(jripFit,class=T)

其中 myClassp 的第 215 列的名称,它必须是一个因子(而第 2 到 211 列是数字)。

另一个兴趣点:JRip 函数比 train 函数快 663 (!) 倍,至少在我的机器上是这样。