I want to do MultiTargetReression by Meka and my code is as under:
try {
ConverterUtils.DataSource dataSource = new ConverterUtils.DataSource(FILE_PATH);
Instances preparedDataSet = dataSource.getDataSet();
preparedDataSet = filterUnsupervisedAttributes(preparedDataSet);
preparedDataSet.setClassIndex(8);
Instances trainingInstances = new Instances(dataSource.getStructure());
trainingInstances = filterUnsupervisedAttributes(trainingInstances);
trainingInstances.setClassIndex(8);
CRUpdateable classifier = new CRUpdateable();
RandomForest randomForest = new RandomForest();
classifier.setClassifier(randomForest);
int numInst = preparedDataSet.numInstances();
for(int row = 0; row < numInst; row++) {
Instance instance = preparedDataSet.instance(row);
System.out.println("instance index : "+instance.classIndex());
trainingInstances.add(instance);
if (row != 0 && row%100==0) {
classifier.buildClassifier(trainingInstances);
}
}
} catch (Exception e) {
e.printStackTrace();
}
With this code I want to build classifier 100 by 100, to do thet, I create the new Instances object as trainingInstances and put 100 intances then call buildClassifier but it has some error as under:
weka.core.WekaException: weka.classifiers.trees.RandomTree: Not enough training instances with class labels (required: 1, provided: 0)!
at weka.core.Capabilities.test(Capabilities.java:1286)
at weka.core.Capabilities.test(Capabilities.java:1138)
at weka.core.Capabilities.testWithFail(Capabilities.java:1468)
at weka.classifiers.meta.Bagging.buildClassifier(Bagging.java:696)
at meka.classifiers.multitarget.CR.buildClassifier(CR.java:81)
You need to know if I am giving preparedDataSet to buildClassifier which is original dataset there is no errors. but I need to train the model 100 by 100.
Appreciate if you can help me.
Thanks
Mali
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I want to do MultiTargetReression by Meka and my code is as under: