Skip to content
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.train.R with keyword arguments #3452

Merged
merged 3 commits into from
Oct 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions R-package/R/lgb.train.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ lgb.train <- function(params = list(),
additional_params <- list(...)
params <- append(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)

Expand Down Expand Up @@ -238,25 +238,25 @@ lgb.train <- function(params = list(),
# If user supplied early_stopping_rounds, add the early stopping callback
if (using_early_stopping) {
callbacks <- add.cb(
callbacks
, cb.early.stop(
cb_list = callbacks
, cb = cb.early.stop(
stopping_rounds = early_stopping_rounds
, first_metric_only = isTRUE(params[["first_metric_only"]])
, verbose = verbose
)
)
}

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
Expand Down