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?
2 Answers
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.
-
$\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$ Commented Sep 11, 2015 at 18:12
-
1$\begingroup$ Usually, there is a slight difference between using entropy and fini $\endgroup$ Commented Sep 11, 2015 at 21:02
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