【发布时间】:2018-03-19 19:21:01
【问题描述】:
我开发了一个模型来进行回归。 我现在需要给它一个数据集作为输入并接收预测结果作为输出。 我的目标属性是数字,我想我需要在输入数据集中用“null”值填充它。
这是我将目标属性的值设置为 null 的代码:
//a method to vacate a given column situated in a given index
private Instances vacateAttribute(Instances dataCSV, int index) {
Instance instance ;
//at each iteration, fill the value of the "Nombre" column in the given index with a null value
for (int i=0; i < dataCSV.numInstances();i++) {
//read the value of each row of dataCSV
instance = dataCSV.instance(i);
instance.setValue(index,null ); //attribute("DureeNumeric"). index 7
}
return dataCSV;
}
我收到此异常,告诉我该属性既不是名义上的也不是字符串。
java.lang.IllegalArgumentException: Attribute neither nominal nor string!
at weka.core.AbstractInstance.setValue(AbstractInstance.java:501) ~[weka-stable-3.8.0.jar:na]
那么我可以将我的数字属性值设置为 null 吗?
提前致谢
【问题讨论】:
标签: machine-learning regression weka prediction data-cleaning