1
$\begingroup$

I've implemented random forest with both R random forest package and Weka java api. both with same data set (train and test sets are the same) and same configuration (number of trees and mtry). However, the results are different: R - 88.96% (1338 from 1504) accuracy, Weka - 69.28% (1042 from 1504) any suggestion what could make the differences?

$\endgroup$
1
  • 1
    $\begingroup$ Could you post some code please ? $\endgroup$
    – RUser4512
    Commented Sep 13, 2015 at 11:34

2 Answers 2

2
$\begingroup$

Random forests do have a lot of parameters... Are you using the default parameters, or did you set yours ?

My first guess is that you are using default parameters, therefore you have 10 trees in your Weka RF, whereas you have 500 trees with R. This would explain the huge difference in accuracy, in favor of R.

But there can be a lot of other differences as well! The seed may be a problem as well (though the impact will not even compare to the impact of the number of trees), mtry, split criterion, max_depth are to be considered with special care as well.

$\endgroup$
2
  • $\begingroup$ As I wrote, the number of trees and the mtry are equal between R and Weka (I set them manually, even the seed is the same). I didn't check for the split criterion and the max_depth - can it makes this kind of different? any other suggestions? $\endgroup$
    – Adir Cohen
    Commented Sep 11, 2015 at 18:12
  • 1
    $\begingroup$ Usually, there is a slight difference between using entropy and fini $\endgroup$
    – RUser4512
    Commented Sep 11, 2015 at 21:02
0
$\begingroup$

This is an old thread, but if you are here, then see this for further details: https://weka.8497.n7.nabble.com/R-vs-Weka-RandomForest-tp30573p30575.html

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.