问题是当你指定一个训练集 -t train.arff
and a test set test.arff
,操作模式是基于计算模型的性能test set。但在不知道实际类别的情况下,您无法计算任何类型的性能。如果没有实际的课程,你怎么知道你的预测是对还是错?
我用你提供的数据作为train.arff
and as test.arff
具有我分配的任意类标签。相关的输出行是:
=== Error on training data ===
Correctly Classified Instances 4 80 %
Incorrectly Classified Instances 1 20 %
Kappa statistic 0.6154
Mean absolute error 0.2429
Root mean squared error 0.4016
Relative absolute error 50.0043 %
Root relative squared error 81.8358 %
Total Number of Instances 5
=== Confusion Matrix ===
a b <-- classified as
2 1 | a = 1
0 2 | b = -1
and
=== Error on test data ===
Total Number of Instances 0
Ignored Class Unknown Instances 5
=== Confusion Matrix ===
a b <-- classified as
0 0 | a = 1
0 0 | b = -1
Weka 可以为您提供这些统计数据训练集,因为它知道实际的类标签和预测的类标签(在训练集上应用模型)。为了test set,它无法获得有关性能的任何信息,因为它不知道真正的类标签。
您可能想做的是:
java -cp weka.jar weka.classifiers.bayes.NaiveBayes -t train.arff -T test.arff -p 1-4
就我而言,这会给你:
=== Predictions on test data ===
inst# actual predicted error prediction (feature1,feature2,feature3,feature4)
1 1:? 1:1 1 (1,7,1,0)
2 1:? 1:1 1 (1,5,1,0)
3 1:? 2:-1 0.786 (-1,1,1,0)
4 1:? 2:-1 0.861 (1,1,1,1)
5 1:? 2:-1 0.861 (-1,1,1,1)
So, you can得到预测,但是你can't获得性能,因为您有未标记的测试数据。