0
votes

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?

1

1 Answers

0
votes

Here is an official example of using. Also, the same example is described. About API you can see more here.