0

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?

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.

4

1 回答 1

2

要测试实例,实例必须具有类标签。即使您提供类标签,在使用构建的模型进行分类时,Weka 也看不到测试实例的类标签。而是在测试之后,它匹配它对测试实例类的预测是否正确。如果您在训练实例中有标签(您必须有)而不是在测试实例上,那么您将收到一条错误消息,例如“训练集和测试集不兼容”。谢谢你。

于 2012-05-18T17:56:47.313 回答