microsoft / LightGBM

A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.
https://lightgbm.readthedocs.io/en/latest/
MIT License
16.57k stars 3.82k forks source link

[R-package] [LightGBM] [Warning] No further splits with positive gain, best gain: -inf #4949

Closed Steviey closed 2 years ago

Steviey commented 2 years ago

R latest, tidymodels latest, lightGbm latest

This message...

[LightGBM] [Warning] No further splits with positive gain, best gain: -inf ... is occupying the whole screen, while training, even with 'verbose=-1'.

it drives me nuts

model_spec <- boost_tree( trees = as.numeric(resObj$bestParams$trees) ,tree_depth = as.numeric(resObj$bestParams$tree_depth) ,min_n = as.numeric(resObj$bestParams$min_n) ) %>% set_mode("regression") %>% set_engine("lightgbm", objective = "rmse",verbose=-1)

Any ideas?

jameslamb commented 2 years ago

Thanks for using {lightgbm}! We'd be happy to help you, but we need more information than you've provided.

Can you please provide a minimal, reproducible example? In addition to the code you're running, that should include:

This information is necessary for maintainers to assist you and try to reproduce the behavior you're seeing.

Steviey commented 2 years ago

I actually want to know, how to suppress this message in R.

jameslamb commented 2 years ago

Here's a minimal, reproducible example showing one way to train a LightGBM model in R and suppress all warning-level log messages.

library(lightgbm)

dtrain <- lightgbm::lgb.Dataset(
    data = matrix(rnorm(1000L), ncol = 4L)
    , label = rnorm(250L)
)

# produces logs, including "No further splits with positive gain"
bst <- lightgbm::lgb.train(
    data = dtrain
    , nrounds = 5L
    , obj = "regression_l2"
)

# no logs
bst <- lightgbm::lgb.train(
    data = dtrain
    , nrounds = 5L
    , obj = "regression_l2"
    , verbose = -1L
)

I installed {lightgbm} v3.3.2 from CRAN with install.packages().

output of sessionInfo() (click me) ```text R version 4.1.0 (2021-05-18) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Mojave 10.14.6 Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods [7] base other attached packages: [1] lightgbm_3.3.2 R6_2.5.1 loaded via a namespace (and not attached): [1] compiler_4.1.0 Matrix_1.3-4 tools_4.1.0 [4] grid_4.1.0 data.table_1.14.0 jsonlite_1.7.2 [7] lattice_0.20-44 ```

We'd be happy to help you, but cannot unless you provide this type of information.

Steviey commented 2 years ago

I see- that's enough info. Then it's highly likely to be a third party issue (tidymodels or treesnip). thx.

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.