Description Usage Arguments Details Value Examples
Downloads and install LightGBM from repository. Allows to customize the commit/branch used, the compiler, use a precompiled lib/dll, the link to the repository (if using a custom fork), and the number of cores used (for non-Visual Studio compilations). Requires git
and compiler make
(or mingw32-make
for MinGW) in PATH
environment variable. Windows uses \\
(backward slashes) while Linux uses /
(forward slashes) but you can mix them.
1 2 3 |
commit |
The commit / branch to use. Put |
compiler |
Applicable only to Windows. The compiler to use (either |
libdll |
Applicable only if you use a precompiled dll/lib. The precompiled dll/lib to use. Defaults to |
repo |
The link to the repository. Defaults to |
use_gpu |
Whether to install with GPU enabled or not. Defaults to |
cores |
The number of cores to use for compilation, ignored for Visual Studio. Defaults to |
This installation function supports only Windows (Visual Studio and MinGW) and Linux (gcc and any other compiler making use of make
). Performance of Visual Studio is higher when multithreading is heavy, while MinGW performance is higher when you are using a domestic computer (low number of physical cores, like 2 or 4).
Check here for more details: Laurae's Microsoft/LightGBM#542 (Visual Studio reports higher CPU usage than MinGW). and guolinke's Microsoft/LightGBM#584 (Compile R package by custom tool chain).
A logical describing whether the LightGBM package was installed or not (TRUE
if installed, FALSE
if installation failed AND you did not have the package before).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ## Not run:
# Install using Visual Studio
# (Download: http://landinghub.visualstudio.com/visual-cpp-build-tools)
lgb.dl(commit = "master",
compiler = "vs",
repo = "https://github.com/Microsoft/LightGBM")
# Install using Rtools MinGW or use Linux compilation
lgb.dl(commit = "master",
compiler = "gcc",
repo = "https://github.com/Microsoft/LightGBM",
cores = 2)
# Install using precompiled DLL in Windows
lgb.dl(commit = "master",
libdll = "C:\\xgboost\\LightGBM\\windows\\x64\\DLL\\lib_lightgbm.dll",
repo = "https://github.com/Microsoft/LightGBM",
cores = 2)
# Test package
library(lightgbm)
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
data(agaricus.test, package = "lightgbm")
test <- agaricus.test
dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label)
params <- list(objective = "regression", metric = "l2")
valids <- list(test = dtest)
model <- lgb.train(params,
dtrain,
100,
valids,
min_data = 1,
learning_rate = 1,
early_stopping_rounds = 10)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.