-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Description
Question
I'm opening this request for comment (RFC) to get feedback on the following proposal, originally mentioned in #4202 (comment).
In its next major release, should
{lightgbm}remove support for passing parameters through...in function calls?
This would apply to:
lgb.cv()lgb.Dataset()lgb.Dataset.create.valid()lgb.train()lightgbm()
Description
LightGBM's core library supports many parameters, documented at https://lightgbm.readthedocs.io/en/latest/Parameters.html. The exported functions in {lightgbm} (the R package), support at least 3 different ways to pass values for these parameters.
- in a named list called
params - (for some parameters) via explicit keyword arguments
- via implicit keyword arguments with
...
For example, the following calls to lightgbm::lightgbm() are all equally valid ways to say "perform 14 boosting rounds".
library(lightgbm)
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
# option 1 - params
bst <- lightgbm(
data = train$data
, label = train$label
, objective = "binary"
, params = list(
num_iterations = 14L
)
)
# option 2 - explicit keyword argument ("nrounds")
bst <- lightgbm(
data = train$data
, label = train$label
, objective = "binary"
, nrounds = 14L
)
# option 3 - passing params through ...
bst <- lightgbm(
data = train$data
, label = train$label
, objective = "binary"
, num_iterations = 14L
)Motivation
pros
- reduces friction for new users getting familiar with LightGBM
- turns some situations that are currently warnings into failures ([R-package] clarify parameter documentation (fixes #4193) #4202 (comment))
- reduces maintenance burden of the R package by limiting the number of combinations of inputs that have to be tested
cons
- breaks existing code that relies on the
...behavior- NOTE: maintainers have agreed that the next LightGBM release will be a 4.0.0 release, so this breaking change by itself wouldn't force a new major version of LightGBM
References
{catboost}does not support passing parameters through...: https://github.com/catboost/catboost/blob/80fa998c355fb9e5e937893e8b7d67286352965c/catboost/R-package/R/catboost.R#L1478{xgboost}supports passing parameters through...: https://github.com/dmlc/xgboost/blob/8760ec48277b345aaaa895b82570c25566fc0503/R-package/R/xgb.train.R#L265- The process of creating the
paramslist might be made easier in the future by implementing the proposal in [R-package] Add function to generate a list of parameters #4195 - I believe this proposed new behavior would break
{treesnip}'s current LightGBM integration: https://github.com/curso-r/treesnip/blob/bf27cd871b7fb663a76818f66ea0a5f9bf09f444/R/lightgbm.R#L208, although I think that that package could be patched in a way that's compatible with and without this behavior
Reactions are currently unavailable