From 98c54d11bb73fe6d934909d12429f86809aa525b Mon Sep 17 00:00:00 2001 From: Aditya Trivedi Date: Mon, 12 Oct 2020 00:24:28 +0530 Subject: [PATCH 1/3] [R-package] Updated lgb.train.R with keyword arguments --- R-package/R/lgb.train.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/R-package/R/lgb.train.R b/R-package/R/lgb.train.R index 24596b1c8385..51ebbae47c58 100644 --- a/R-package/R/lgb.train.R +++ b/R-package/R/lgb.train.R @@ -47,7 +47,7 @@ #' } #' @export lgb.train <- function(params = list(), - data, + data = data, nrounds = 10L, valids = list(), obj = NULL, @@ -82,10 +82,10 @@ lgb.train <- function(params = list(), # Setup temporary variables additional_params <- list(...) - params <- append(params, additional_params) + params <- append(params = params, additional_params = additional_params) params$verbose <- verbose - params <- lgb.check.obj(params, obj) - params <- lgb.check.eval(params, eval) + params <- lgb.check.obj(params = params, obj = obj) + params <- lgb.check.eval(params = params, eval = eval) fobj <- NULL eval_functions <- list(NULL) @@ -238,7 +238,7 @@ lgb.train <- function(params = list(), # If user supplied early_stopping_rounds, add the early stopping callback if (using_early_stopping) { callbacks <- add.cb( - callbacks + callbacks = callbacks , cb.early.stop( stopping_rounds = early_stopping_rounds , first_metric_only = isTRUE(params[["first_metric_only"]]) From 8e3ab74dc7560d6a2085b46387cdf3a030536ce4 Mon Sep 17 00:00:00 2001 From: Aditya Trivedi Date: Mon, 12 Oct 2020 11:02:34 +0530 Subject: [PATCH 2/3] [R-package] Updated lgb.train.R with keyword arguments --- R-package/R/lgb.train.R | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/R-package/R/lgb.train.R b/R-package/R/lgb.train.R index 51ebbae47c58..967f1814cebc 100644 --- a/R-package/R/lgb.train.R +++ b/R-package/R/lgb.train.R @@ -47,7 +47,7 @@ #' } #' @export lgb.train <- function(params = list(), - data = data, + data, nrounds = 10L, valids = list(), obj = NULL, @@ -82,7 +82,7 @@ lgb.train <- function(params = list(), # Setup temporary variables additional_params <- list(...) - params <- append(params = params, additional_params = additional_params) + params <- append(params, additional_params) params$verbose <- verbose params <- lgb.check.obj(params = params, obj = obj) params <- lgb.check.eval(params = params, eval = eval) @@ -238,7 +238,8 @@ lgb.train <- function(params = list(), # If user supplied early_stopping_rounds, add the early stopping callback if (using_early_stopping) { callbacks <- add.cb( - callbacks = callbacks + cb_list = callbacks + , cb = cb , cb.early.stop( stopping_rounds = early_stopping_rounds , first_metric_only = isTRUE(params[["first_metric_only"]]) @@ -247,16 +248,16 @@ lgb.train <- function(params = list(), ) } - cb <- categorize.callbacks(callbacks) + cb <- categorize.callbacks(cb_list = callbacks) # Construct booster with datasets booster <- Booster$new(params = params, train_set = data) if (valid_contain_train) { - booster$set_train_data_name(train_data_name) + booster$set_train_data_name(name = train_data_name) } for (key in names(reduced_valid_sets)) { - booster$add_valid(reduced_valid_sets[[key]], key) + booster$add_valid(data = reduced_valid_sets[[key]], name = key) } # Callback env From 7e6a903b277374103fe059713a699d4a91a8cdb1 Mon Sep 17 00:00:00 2001 From: Aditya Trivedi Date: Mon, 12 Oct 2020 13:23:01 +0530 Subject: [PATCH 3/3] [R-package] Updated lgb.train.R with keyword arguments --- R-package/R/lgb.train.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/R-package/R/lgb.train.R b/R-package/R/lgb.train.R index 967f1814cebc..71e2c3ad7ef8 100644 --- a/R-package/R/lgb.train.R +++ b/R-package/R/lgb.train.R @@ -239,8 +239,7 @@ lgb.train <- function(params = list(), if (using_early_stopping) { callbacks <- add.cb( cb_list = callbacks - , cb = cb - , cb.early.stop( + , cb = cb.early.stop( stopping_rounds = early_stopping_rounds , first_metric_only = isTRUE(params[["first_metric_only"]]) , verbose = verbose