0
votes

I've developed a model to make regression. I need now to give it a dataset as Inputs and receive prediction results as Output. My target attribute is numeric, I think I need to fill it with "null" value in the input dataset.

here is my code to set values of the target attribute to 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;
}  

I got this Exception telling me that the attribute is neither nominal nor string.

java.lang.IllegalArgumentException: Attribute neither nominal nor string!
at weka.core.AbstractInstance.setValue(AbstractInstance.java:501) ~[weka-stable-3.8.0.jar:na] 

So can I set my numeric attribute values to null?

Thanks in Advance

1

1 Answers

0
votes

I ve encountred this by assigning the prediction results in the same column instead of filling the existing column with Null value and assigning the prediction results in a new column.