我对数据挖掘并不陌生,但WEKA结果却让我困惑不已。希望能得到帮助。谢谢!
我的数据集由具有二分类(S、H)的数值向量组成。我使用了朴素贝叶斯模型(虽然方法并不重要)进行留一交叉验证训练。以下是结果:
=== Predictions on test data ===
inst# actual predicted error distribution
1 1:H 1:H *1,0
1 1:H 1:H *1,0
1 1:H 1:H *1,0
1 1:H 1:H *1,0
1 1:H 1:H *1,0
1 1:H 1:H *1,0
1 1:H 1:H *1,0
1 1:H 1:H *1,0
1 1:H 2:S + 0,*1
1 1:H 1:H *1,0
1 1:H 1:H *1,0
1 1:H 1:H *1,0
1 1:H 1:H *1,0
1 1:H 1:H *1,0
1 1:H 1:H *0.997,0.003
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 1:H + *1,0
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 2:S 0,*1
1 2:S 1:H + *1,0
=== Stratified cross-validation ===
=== Summary ===
Total Number of Instances 66
=== Confusion Matrix ===
a b <-- classified as
14 1 | a = H
2 49 | b = S
正如你所见,在输出结果和混淆矩阵中都有三个错误。然后我使用具有相同属性和相同两个类别的独立数据集重新评估模型。以下是结果:
=== Re-evaluation on test set ===
User supplied test set
Relation: FCBC_New.TagProt
Instances: unknown (yet). Reading incrementally
Attributes: 355
=== Predictions on user test set ===
inst# actual predicted error distribution
1 1:S 2:H + 0,*1
2 1:S 1:S *1,0
3 1:S 2:H + 0,*1
4 2:H 1:S + *1,0
5 2:H 2:H 0,*1
6 1:S 2:H + 0,*1
7 1:S 2:H + 0,*1
8 2:H 2:H 0,*1
9 1:S 1:S *1,0
10 1:S 2:H + 0,*1
11 1:S 2:H + 0,*1
12 2:H 1:S + *1,0
13 2:H 2:H 0,*1
14 1:S 2:H + 0,*1
15 1:S 2:H + 0,*1
16 1:S 2:H + 0,*1
17 2:H 2:H 0,*1
18 2:H 2:H 0,*1
19 1:S 2:H + 0,*1
20 1:S 2:H + 0,*1
21 1:S 2:H + 0,*1
22 1:S 1:S *1,0
23 1:S 2:H + 0,*1
24 1:S 2:H + 0,*1
25 2:H 1:S + *1,0
26 1:S 2:H + 0,*1
27 1:S 1:S *1,0
28 1:S 2:H + 0,*1
29 1:S 2:H + 0,*1
30 1:S 2:H + 0,*1
31 1:S 2:H + 0,*1
32 1:S 2:H + 0,*1
33 1:S 2:H + 0,*1
34 1:S 1:S *1,0
35 2:H 1:S + *1,0
36 1:S 2:H + 0,*1
37 1:S 1:S *1,0
38 1:S 1:S *1,0
39 2:H 1:S + *1,0
40 1:S 2:H + 0,*1
41 1:S 2:H + 0,*1
42 1:S 2:H + 0,*1
43 1:S 2:H + 0,*1
44 1:S 2:H + 0,*1
45 1:S 2:H + 0,*1
46 1:S 2:H + 0,*1
47 2:H 1:S + *1,0
48 1:S 2:H + 0,*1
49 2:H 1:S + *1,0
50 2:H 1:S + *1,0
51 1:S 2:H + 0,*1
52 1:S 2:H + 0,*1
53 2:H 1:S + *1,0
54 1:S 2:H + 0,*1
55 1:S 2:H + 0,*1
56 1:S 2:H + 0,*1
=== Summary ===
Correctly Classified Instances 44 78.5714 %
Incorrectly Classified Instances 12 21.4286 %
Kappa statistic 0.4545
Mean absolute error 0.2143
Root mean squared error 0.4629
Coverage of cases (0.95 level) 78.5714 %
Total Number of Instances 56
=== Detailed Accuracy By Class ===
TP Rate FP Rate Precision Recall F-Measure MCC ROC Area PRC Area Class
0.643 0.167 0.563 0.643 0.600 0.456 0.828 0.566 H
0.833 0.357 0.875 0.833 0.854 0.456 0.804 0.891 S
Weighted Avg. 0.786 0.310 0.797 0.786 0.790 0.456 0.810 0.810
=== Confusion Matrix ===
a b <-- classified as
9 5 | a = H
7 35 | b = S
这里就是我的问题所在。输出清楚地显示出有许多错误。实际上,有44个错误。然而,混淆矩阵和结果摘要表明只有12个错误。如果将预测类别颠倒,则混淆矩阵将变得正确。现在,我看一下分数的分布,发现在交叉验证结果中,逗号前的值表示H类,第二个值表示S类(因此1,0的值意味着H预测)。但是,在测试结果中,这些相反,1,0的值意味着S预测。因此,如果参考分数分布,混淆矩阵是正确的。如果根据预测结果(H或S),则混淆矩阵是错误的。
我试过将所有测试文件的类别更改为H或S。但是这并没有改变输出结果或混淆矩阵的总数:在混淆矩阵中,16个实例始终被预测为a(H),40个实例始终被预测为b(S),即使纯文本输出实际上是16个b(S)和40个a(H)。你有什么想法吗?这必须是一件简单的事情,但我完全不知道怎么做...