Skip to content

Latest commit

 

History

History
39 lines (35 loc) · 903 Bytes

README.md

File metadata and controls

39 lines (35 loc) · 903 Bytes

LightGBM-predictor-cpp

1. Build LightGBM

git clone --recursive --branch stable --depth 1 https://github.com/Microsoft/LightGBM && \
    mkdir LightGBM/build && \
    cd LightGBM/build && \
    cmake .. && \
    make -j8 && \
    make install && \

2. Train a binary classification model

cd LightGBM/examples/binary_classification &&
    lightgbm config=train.conf

We will get the output model: LightGBM_model.txt, it will be used in test.cpp

3. Build test.cpp

In test.cpp, row and row2 are from LightGBM/examples/binary_classification/binary.train

g++ -g -Wall -std=c++11 test.cpp -l_lightgbm -Wl,-R /usr/local/lib -o test

4. Run

./test

5. Output

Load model success!
Predict state: 0
Predict size: 1 , result: 0.870713
###########################
Predict state: 0
Predict size: 1 , result: 0.472528
Success!