I have a test set and a training set and I should perform a numeric prediction of the class label using M5p. How it is possible to invoke m5p using java weka api? I tried this but I think that it doesn't work because I get values very high of rmse: ("testSet" have class values equal to '0' while "testset" no)
M5P predictor = new M5P ();
predictor.buildClassifier(trainingSet);
for (int i = 0; i < testSet.numInstances(); i++)
{
double pred = predictor.classifyInstance(testSet.instance(i));
Attribute last = testSet.instance(i).classAttribute();
testSet.instance(i).setValue(last, pred);
Evaluation eval = new Evaluation(testSet);
eval.evaluateModelOnce(pred, testset.instance(i));
double rmse = eval.rootMeanSquaredError();
}
If it is wrong can you advise me which instruction to use to make numerical prediction?