ERROR While using WEKA API in java code: Class Attribute Not Set?

心已入冬 提交于 2019-12-05 00:53:13
iinception

You should set class index of for your dataset before passing it into classifier. Your classifier must know which is your outcome variable.
After these lines...

loader.setQuery("select * from data_training");
Instances data = loader.getDataSet();

Add the following:

data.setClassIndex(data.numAttributes() - 1);

If Hujan is your class attribute (outcome variable)

See Api Docs for more Info

zhu

try it

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