Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to integrate LightGBM Model to predict C++ under linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of "how C++ integrates LightGBM model for forecasting under linux". The editor shows you the operation process through an actual case, and the operation method is simple, fast and practical. I hope this article "how to integrate LightGBM model for forecasting under linux" can help you solve the problem.

1 related materials 1.1 installation package

(1) lightGBM source code extraction code: qab2

(2) cmake extraction code: 3sdn

(3) Environment: centos7

1.2 prerequisite preparation

The operating system has been compiled in accordance with Gmail + and gcc, and can be installed using the command

Yum install gcc

Yum install gcc-c++

2 process

The operation directory is in / root/test, as shown in the following figure:

2.1 decompress and install cmake

(1) enter the command: tar-zxvf cmake-3.18.4.tar.gz decompress cmake.tar.gz

(2) enter the cmake-3.18.4 folder and execute the. / configure command

If "Could not find OpenSSL. Install an OpenSSL development package or" is reported in the process, you need to execute yum instal openssl and yum install openssl-devel before executing the. / configure command

(3) execute the command gmake

(4) execute the command to confirm the version of cmake and confirm whether cmake is installed successfully.

2.2 decompress and compile the lightGBM2.3 lightGBM model generate 2.3.1 C++ generate lgb model 2.3.2 python generates lgb model 2.4 C++ integrated lightGBM prediction # include # include # include void predict (std::vector & row) {std::string pred_result = ""; int temp;int p = 1 row BoosterHandle handle;temp = LGBM_BoosterCreateFromModelfile ("models/3_300_gbm.txt", & p, & handle); std::cout

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report