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] Updated lgb.Booster.R with keyword arguments #3496
Conversation
-I am facing problems while generating the docs Little help please
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.
thanks for taking the time to contribute to {lightgbm}
!
There are other function calls in lgb.Booster.R
that also should be using keyword arguments.
Can you please add keyword arguments to these calls in this file?
lgb.check.r6.class()
lgb.params2str()
private$inner_eval()
lgb.call.return.str()
predictor$predict()
Predictor$new()
self$save_model_to_string()
object$predict()
booster$save_model()
booster$dump_model()
Once you've made these changes, I can re-generate the documentation and push it to this pull request.
R-package/R/lgb.Booster.R
Outdated
@@ -335,7 +335,7 @@ Booster <- R6::R6Class( | |||
|
|||
lower_bound <- 0.0 | |||
lgb.call( | |||
"LGBM_BoosterGetLowerBoundValue_R" | |||
fun_name="LGBM_BoosterGetLowerBoundValue_R" |
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.
fun_name="LGBM_BoosterGetLowerBoundValue_R" | |
fun_name = "LGBM_BoosterGetLowerBoundValue_R" |
Can you please put a space between the argument name and value for all of these cases?
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.
Okay..will be done soon
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.
thanks! I left a few small suggestions
R-package/R/lgb.Booster.R
Outdated
private$inner_eval( | ||
name = name, | ||
data_idx = data_idx, | ||
feval = feval) |
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.
private$inner_eval( | |
name = name, | |
data_idx = data_idx, | |
feval = feval) | |
private$inner_eval( | |
data_name = name | |
, data_idx = data_idx | |
, feval = feval | |
) |
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.
like I mentioned in #3391 , could you please use comma-first style when breaking up lines?
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 think accepting this and the other suggestions will fix the test failures on GitHub Actions. The right keyword argument here is data_name
, not name
R-package/R/lgb.Booster.R
Outdated
predictor$predict( | ||
data = data, | ||
start_iteration = start_iteration, | ||
num_iteration = num_iteration, | ||
rawscore = rawscore, | ||
predleaf = predleaf, | ||
predcontrib = predcontrib, | ||
header = header, | ||
reshape = reshape) |
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.
predictor$predict( | |
data = data, | |
start_iteration = start_iteration, | |
num_iteration = num_iteration, | |
rawscore = rawscore, | |
predleaf = predleaf, | |
predcontrib = predcontrib, | |
header = header, | |
reshape = reshape) | |
predictor$predict( | |
data = data | |
, start_iteration = start_iteration | |
, num_iteration = num_iteration | |
, rawscore = rawscore | |
, predleaf = predleaf | |
, predcontrib = predcontrib | |
, header = header | |
, reshape = reshape | |
) |
R-package/R/lgb.Booster.R
Outdated
invisible(booster$save_model( | ||
filename = filename, | ||
num_iterations = num_iteration)) |
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.
invisible(booster$save_model( | |
filename = filename, | |
num_iterations = num_iteration)) | |
invisible(booster$save_model( | |
filename = filename | |
, num_iteration = num_iteration | |
)) |
R-package/R/lgb.Booster.R
Outdated
predictor$predict( | ||
data = data, | ||
start_iteration = start_iteration, | ||
num_iteration = num_iteration, | ||
rawscore = rawscore, | ||
predleaf = predleaf, | ||
predcontrib = predcontrib, | ||
header = header, | ||
reshape = reshape | ||
) |
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.
predictor$predict( | |
data = data, | |
start_iteration = start_iteration, | |
num_iteration = num_iteration, | |
rawscore = rawscore, | |
predleaf = predleaf, | |
predcontrib = predcontrib, | |
header = header, | |
reshape = reshape | |
) | |
predictor$predict( | |
data = data | |
, start_iteration = start_iteration | |
, num_iteration = num_iteration | |
, rawscore = rawscore | |
, predleaf = predleaf | |
, predcontrib = predcontrib | |
, header = header | |
, reshape = reshape | |
) |
R-package/R/lgb.Booster.R
Outdated
invisible(booster$save_model(filename, num_iteration)) | ||
invisible(booster$save_model( | ||
filename = filename | ||
, num_iterations = num_iteration)) |
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.
, num_iterations = num_iteration)) | |
, num_iterations = num_iteration | |
)) |
, predcontrib | ||
, header | ||
, reshape | ||
data = data |
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.
data = data | |
data = data |
R-package/R/lgb.Booster.R
Outdated
private$inner_eval( | ||
data_name = name | ||
, data_idx = data_idx | ||
, feval = feval) |
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.
, feval = feval) | |
, feval = feval | |
) |
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.
sorry for all of the requested style changes. If you just click on the suggestions in the browser instead of committing them yourself, it might be easier
Co-authored-by: James Lamb <jaylamb20@gmail.com>
Co-authored-by: James Lamb <jaylamb20@gmail.com>
Co-authored-by: James Lamb <jaylamb20@gmail.com>
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.
Thanks for the efforts so far! Please see my suggested changes.
I'll review again once this PR also adds the keywords args for these:
- self$save_model_to_string()
- lgb.check.r6.class()
- Predictor$new()
Co-authored-by: James Lamb <jaylamb20@gmail.com>
This reverts commit 9b81ce8.
Co-authored-by: James Lamb <jaylamb20@gmail.com>
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.
looks good so far! But you are still missing these:
self$save_model_to_string()
lgb.check.r6.class()
Predictor$new()
If you're struggling with them, please let me know and I'd be happy to help!
Not sure about these |
no problem! You can skip these, I will do them in a separate PR. |
Co-authored-by: James Lamb <jaylamb20@gmail.com>
Co-authored-by: James Lamb <jaylamb20@gmail.com>
Co-authored-by: James Lamb <jaylamb20@gmail.com>
This reverts commit 4f2cc94.
R-package/R/lgb.Booster.R
Outdated
@@ -216,7 +216,7 @@ Booster <- R6::R6Class( | |||
if (!is.null(train_set)) { | |||
|
|||
# Check if training set is lgb.Dataset | |||
if (!lgb.check.r6.class(train_set, "lgb.Dataset")) { | |||
if (!lgb.check.r6.class(object = train_set, name = "lgb.Dataset")) |
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.
if (!lgb.check.r6.class(object = train_set, name = "lgb.Dataset")) | |
if (!lgb.check.r6.class(object = train_set, name = "lgb.Dataset")) { |
It looks like this {
was lost, and the lines are no longer aligned.
R-package/R/lgb.Booster.R
Outdated
@@ -346,7 +346,7 @@ Booster <- R6::R6Class( | |||
eval = function(data, name, feval = NULL) { | |||
|
|||
# Check if dataset is lgb.Dataset | |||
if (!lgb.check.r6.class(data, "lgb.Dataset")) { | |||
if (!lgb.check.r6.class(object = data, name = "lgb.Dataset")) |
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.
if (!lgb.check.r6.class(object = data, name = "lgb.Dataset")) | |
if (!lgb.check.r6.class(object = data, name = "lgb.Dataset")) { |
It looks like the {
was lost
R-package/R/lgb.Booster.R
Outdated
@@ -149,7 +149,7 @@ Booster <- R6::R6Class( | |||
add_valid = function(data, name) { | |||
|
|||
# Check if data is lgb.Dataset | |||
if (!lgb.check.r6.class(data, "lgb.Dataset")) { | |||
if (!(lgb.Dataset = lgb.check.r6.class(data, "lgb.Dataset"))) { |
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.
this check is still incorrect. Please accept this suggestion in your browser.
if (!(lgb.Dataset = lgb.check.r6.class(data, "lgb.Dataset"))) { | |
if (!lgb.check.r6.class(object = data, name = "lgb.Dataset")) { |
Co-authored-by: James Lamb <jaylamb20@gmail.com>
Co-authored-by: James Lamb <jaylamb20@gmail.com>
Co-authored-by: James Lamb <jaylamb20@gmail.com>
Co-authored-by: James Lamb <jaylamb20@gmail.com>
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.
thanks for your time and efforts! I will merge this once the builds are done.
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. |
-I am facing problems while generating the docs
Little help please
#3390