use*_*731 3 nlp classification weka arff
我正在使用Weka中的Naive Bayes分类器进行NLP分类项目.我打算使用半监督机器学习,因此使用未标记的数据.当我在一组独立的未标记测试数据上测试从我的标记训练数据中获得的模型时,Weka会忽略所有未标记的实例.任何人都可以指导我如何解决这个问题?之前有人已在此处提出此问题,但未提供任何适当的解决方案.这是一个示例测试文件:
@relation referents
@attribute feature1 NUMERIC
@attribute feature2 NUMERIC
@attribute feature3 NUMERIC
@attribute feature4 NUMERIC
@attribute class{1 -1}
@data
1, 7, 1, 0, ?
1, 5, 1, 0, ?
-1, 1, 1, 0, ?
1, 1, 1, 1, ?
-1, 1, 1, 1, ?
Run Code Online (Sandbox Code Playgroud)
问题是,当您指定训练集 -t train.arff和测试集时 test.arff,操作模式是基于测试集计算模型的性能.但是如果不了解实际的课程,就无法计算出任何形式的表现.没有实际的课程,你怎么知道你的预测是对还是错?
我使用了您提供的数据train.arff以及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
Run Code Online (Sandbox Code Playgroud)
和
=== 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
Run Code Online (Sandbox Code Playgroud)
Weka可以为您提供训练集的统计数据,因为它知道实际的类标签和预测的标签(在训练集上应用模型).对于测试集,它无法获得有关性能的任何信息,因为它不知道真正的类标签.
你可能想做的是:
java -cp weka.jar weka.classifiers.bayes.NaiveBayes -t train.arff -T test.arff -p 1-4
Run Code Online (Sandbox Code Playgroud)
在我的情况下会给你:
=== 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)
Run Code Online (Sandbox Code Playgroud)
所以,你可以得到的预测,但你不能得到一个表现,因为你未标记的测试数据.
| 归档时间: |
|
| 查看次数: |
3812 次 |
| 最近记录: |