-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[R-package] respect aliases for objective and metric and lgb.train() and lgb.cv() #4913
Conversation
Could you please resolve a conflict with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
expect_equal(sort(names(record_results)), c("auc", "binary_logloss")) | ||
expect_length(record_results[["auc"]][["eval"]], nrounds) | ||
expect_length(record_results[["binary_logloss"]][["eval"]], nrounds) | ||
expect_equal(bst$params[["metric"]], list("auc", "binary_logloss")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this assertion! Can we add the same assertion for objective into test_that("lgb.train() respects parameter aliases for objective",
test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yep, definitely! good point that params
should be checked for that test too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in f90b2d6
This pull request 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. |
Similar to #4903, this PR proposes changes to ensure that parameter aliases in
lgb.train()
andlgb.cv()
are handled correctly in the R package.Currently, internal helper functions access
params$objective
andparams$metric
directly, without considering aliases.LightGBM/R-package/R/utils.R
Line 168 in ce486e5
LightGBM/R-package/R/utils.R
Line 194 in ce486e5
As a result, it's not possible today to use any of the aliases for
objective
withlgb.train()
andlgb.cv()
.This PR proposes the following changes to address that:
params$objective
andparams$metric
using internal helper functionlgb.check.wrapper_param()
, which handles reconciling parameters passed by main parameter name and aliasesparams