[R-package] update parameter 'verbosity' based on keyword arg 'verbose' #4899
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #4667.
Related to #4862.
While investigating #4667, I noticed a small inconsistency in
lgb.train()
andlgb.cv()
. Those functions have a keyword argumentverbose
and update the parameterverbose
in parameters passed down toLGBM_BoosterCreate
.LightGBM/R-package/R/lgb.cv.R
Line 105 in 7b10baf
LightGBM/R-package/R/lgb.train.R
Line 77 in 7b10baf
As a result, if you pass different values for
verbosity
(inparams
) andverbose
(via keyword arguments), then the Booster's parameters will contain bothverbosity
andverbose
.Consider this example:
Note that
verbosity
is the main parameter recognized by LightGBM (https://lightgbm.readthedocs.io/en/latest/Parameters.html#verbosity) andverbose
is an alias for it.This PR proposes two changes:
params$verbosity
(the main parameter name, instead of an alias) based on the value of keyword argumentverbose
lgb.check.wrapper_param()
to ensure consistent behavior when processing keyword arguments.