Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9
Mottl/lightgbm3-rs
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
lightgbm3
is based onlightgbm
crate(which is unsupported by now), but it is not back-compatible with it.
cargo add lightgbm3
Sincelightgbm3
compilesLightGBM
from source, you also need to install development libraries:
apt install -y cmake clang libclang-dev libc++-dev gcc-multilib
brew install cmakebrew install libomp # only required if you compile with "openmp" feature
- Install CMake and VS Build Tools.
- Install LLVM and set
LIBCLANG_PATH
environment variable (i.e.C:\Program Files\LLVM\bin
)
Please see below for details.
use lightgbm3::{Dataset,Booster};use serde_json::json;let features =vec![vec![1.0,0.1,0.2], vec![0.7,0.4,0.5], vec![0.9,0.8,0.5], vec![0.2,0.2,0.8], vec![0.1,0.7,1.0]];let labels =vec![0.0,0.0,0.0,1.0,1.0];let dataset =Dataset::from_vec_of_vec(features, labels,true).unwrap();let params =json!{{"num_iterations":10,"objective":"binary","metric":"auc",}};let bst =Booster::train(dataset,¶ms).unwrap();bst.save_file("path/to/model.lgb").unwrap();
use lightgbm3::{Dataset,Booster};let bst =Booster::from_file("path/to/model.lgb").unwrap();let features =vec![1.0,2.0, -5.0];let n_features = features.len();let y_pred = bst.predict_with_params(&features, n_featuresasi32,true,"num_threads=1").unwrap()[0];
Look in the./examples/
folder for more details:
lightgbm3
supports the following features:
polars
forpolars supportopenmp
formulti-processing supportgpu
forGPU supportcuda
forCUDA support
cargo bench
Add--features=openmp
,--features=gpu
and--features=cuda
appropriately.
git clone --recursive https://github.com/Mottl/lightgbm3-rs.git
Great respect tovaaaaanquish for the LightGBM Rust package, which unfortunatelyno longer supported.
Much reference was made to implementation and documentation. Thanks.
About
Rust bindings for LightGBM
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.