Skip to content
Branch: master
Clone or download
sztyler Update
update example
Latest commit 7fb6304 Jan 20, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
data add comment header and example Sep 29, 2016
src/de/unima/classifiers adapt arff class Jan 19, 2017
LICENSE Initial commit Sep 28, 2016

Online Random Forest Classifier (Java)

This is a Java implementation of an online random forest classifier. Online machine learning enables to update an existing classification model continuously without keeping the processed data available or knowing all data a-priori. This implementation relies on the implementation of Amir Saffari (C++). We reimplemented this classifier to use it also on wearable devices, e.g., android platforms.


Download: latest build (JAR, Build190117)


DataSet dsTrain = new ARFF();
dsTrain.load(new FileInputStream(new File("data/data_train.arff")));
DataSet dsTest = new ARFF();
dsTest.load(new FileInputStream(new File("data/data_test.arff")));

Config config = new Config();
RandomForest rf = new RandomForest(config, dsTrain.getNumOfClasses(), dsTrain.getNumOfFeatures(), dsTrain.getMinFeatRange(), dsTrain.getMaxFeatRange());

for (int nEpoch = 0; nEpoch < config.numEpochs; nEpoch++) { // train
  for (Sample sample : dsTrain.getSamples()) {

for (Sample sample : dsTest.getSamples()) { // test
  Result result = new Result(dsTrain.getNumOfClasses());
  rf.eval(sample, result);
  results.put(result, sample.getLabel());

Please also consider the complete example


Documentation (JavaDoc) is coming soon . If you have any issues, feel free to contact me

You can’t perform that action at this time.