How to build and install RGF (Regularized Greedy Forest) on Mac OS

Regularized Greedy Forest was introduced in this article. And now it is one of the approaches for efficient boosting training. However, building and installing it on Mac not yet (for November 2018) is as simple as pip3 install xgboost. So, this short note is about how to build and run RGF on Mac, if you have any troubles with it.

Starting point is an official repo for the project. To install RGF as a python package we will need to perform two-step process:

  1. Build and install FastRGF.
  2. Install python-wrapper rgf_python.

It’s easy and it requires a couple of minutes. First of all, you need to make sure that you have g++-8 installed, as the official repo suggests and install it with `brew install gcc`, if you don’t have it. Then, you will need to point cmake to it, to build the executables.

git clone https://github.com/RGF-team/rgf.git
cd rgf/FastRGF
mkdir build
cd build
export CXX=g++-8 && export CC=gcc-8
cmake -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 ..
make
make install
mv ../bin/forest_* /usr/local/bin

That’s it.

And then you only need to install wrapper with pip3 install rgf_python  and you will be able to start training RGF.