Test a single instance in Weka

被刻印的时光 ゝ 提交于 2019-12-04 06:23:57

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/10649708/test-a-single-instance-in-weka

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!