It cost too much time while using the lib_lightgbm.so for predicting
Environment info
Operating System:CentOS release 6.3 (Final) CPU:Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz C++/Python/R version:C++
Hi, guolin, I am using the LGBM_BoosterPredictForMat function for predicting in the so file. But it can be really slow. I have 100 trees and 40 leaves.The #feature is just 73. Each round, I feed 10*73 into lightgbm, and it cost about 500+ us . Sometimes it can be 7445 us. I think the so file is quite instability. How can I get out of the trouble?
@MenglaiWang Every time you calling LGBM_BoosterPredictForMat, it will re-init the predictor. So the best practice is only calling it one time with all data.
If you want calling it multi-time, you can separate the init work(https://github.com/Microsoft/LightGBM/blob/master/src/c_api.cpp#L177-L194) to a addition function, to avoid the many duplicated init.
OK,i will try it😀
@guolinke Follow your advice, I have tried to separate the init work to avoid re-init the predictor, and it is exciting to get 2x faster speed. But it is not satisfying yet. How can I speed up 2x more faster?
@MenglaiWang can you use more data in every single batch ?
@guolinke No,I can't. Each time I only need to predict for 10 samples.😫