Skip to content

Wanke15/LightGBM-predictor-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

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!

About

A naive cpp demo for LightGBM Predictor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published