A 1500 lines simple C++ implementation of RandomForests with detailed comments. No dependency, support regression and classification.
- download MNIST dataset from http://yann.lecun.com/exdb/mnist/ and unzip train&test data in some dir
- git clone https://github.com/handspeaker/RandomForests.git
- cd RandomForests and make
- run the following command:
./RandomForests
mnist_train_image_file_path
mnist_train_label_file_path
mnist_test_image_file_path
mnist_test_label_file_path
Open main.cpp file and modify as you want. In RandomForest.h there are some parameters you can change. input samples is a matrix, every row is a sample.