问题描述
weka是否要求测试实例具有class属性。
我使用训练集arff文件来训练分类器。现在我想测试一个实例(不是来自arff文件,必须通过代码创建)而没有class属性并预测类。
我发现此链接
Does weka require the test instances to have the class attribute.I have used a training set arff file to train the classifier. Now I want to test an instance (not from arff file, have to create by code) without the class attribute and predict the class.I found this link Weka: How do I get the prediction value in java for a test instance?
但我的class属性是字符串'Y'或'N'。如果evaluateModelOnce()返回double,那意味着什么。是类属性还是其他东西。我正在使用weka API。
But my class attribute is a string 'Y' or 'N'. If evaluateModelOnce() returns double, what does it mean. Is it the class attribute or something else. i am using the weka API.
推荐答案
要测试实例,实例必须具有类标签。即使您提供类标签,在使用构建的模型进行分类时,Weka也看不到测试实例的类标签。而是在测试之后,它匹配其关于测试实例的类的预测是否正确。如果您在训练实例(您必须拥有)中有标签而不在测试实例上,那么您将收到类似训练和测试集不兼容的错误消息。谢谢。
To test instances, the instances must have class labels. Even if you provide class labels, when classifying with the built model, Weka does not see the test instance's class labels. Rather after the testing, it matches whether or not its prediction about the test instance's class is correct. If you have labels in training instances (which you must have) and not on the test instances, then you will get an error message something like "the training and testing sets are not compatible." Thank you.
这篇关于在Weka中测试单个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!