I have to use WEKA in my java code for prediction. Basically I have to study a given code and reuse it.
testdata.setClassIndex(data.numAttributes() - 1);
I am unable to understand what the above line means. What is a Class Index?
testdata
and data
are Intances object.
As outlined here, setClassIndex is used to define the attribute that will represent the class (for prediction purposes). Given that the index starts at zero, data.numAttributes() - 1 represents the last attribute of the testdata set.
Hope this Helps!