diff --git a/R-package/R/lgb.Booster.R b/R-package/R/lgb.Booster.R index fa34c182b64e..d53bb6ba97f8 100644 --- a/R-package/R/lgb.Booster.R +++ b/R-package/R/lgb.Booster.R @@ -743,15 +743,18 @@ Booster <- R6::R6Class( #' data(agaricus.test, package = "lightgbm") #' test <- agaricus.test #' dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -#' params <- list(objective = "regression", metric = "l2") +#' params <- list( +#' objective = "regression" +#' , metric = "l2" +#' , min_data = 1L +#' , learning_rate = 1.0 +#' ) #' valids <- list(test = dtest) #' model <- lgb.train( #' params = params #' , data = dtrain #' , nrounds = 5L #' , valids = valids -#' , min_data = 1L -#' , learning_rate = 1.0 #' ) #' preds <- predict(model, test$data) #' @@ -824,15 +827,18 @@ predict.lgb.Booster <- function(object, #' data(agaricus.test, package = "lightgbm") #' test <- agaricus.test #' dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -#' params <- list(objective = "regression", metric = "l2") +#' params <- list( +#' objective = "regression" +#' , metric = "l2" +#' , min_data = 1L +#' , learning_rate = 1.0 +#' ) #' valids <- list(test = dtest) #' model <- lgb.train( #' params = params #' , data = dtrain #' , nrounds = 5L #' , valids = valids -#' , min_data = 1L -#' , learning_rate = 1.0 #' , early_stopping_rounds = 3L #' ) #' model_file <- tempfile(fileext = ".txt") @@ -885,15 +891,18 @@ lgb.load <- function(filename = NULL, model_str = NULL) { #' data(agaricus.test, package = "lightgbm") #' test <- agaricus.test #' dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -#' params <- list(objective = "regression", metric = "l2") +#' params <- list( +#' objective = "regression" +#' , metric = "l2" +#' , min_data = 1L +#' , learning_rate = 1.0 +#' ) #' valids <- list(test = dtest) #' model <- lgb.train( #' params = params #' , data = dtrain #' , nrounds = 10L #' , valids = valids -#' , min_data = 1L -#' , learning_rate = 1.0 #' , early_stopping_rounds = 5L #' ) #' lgb.save(model, tempfile(fileext = ".txt")) @@ -936,15 +945,18 @@ lgb.save <- function(booster, filename, num_iteration = NULL) { #' data(agaricus.test, package = "lightgbm") #' test <- agaricus.test #' dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -#' params <- list(objective = "regression", metric = "l2") +#' params <- list( +#' objective = "regression" +#' , metric = "l2" +#' , min_data = 1L +#' , learning_rate = 1.0 +#' ) #' valids <- list(test = dtest) #' model <- lgb.train( #' params = params #' , data = dtrain #' , nrounds = 10L #' , valids = valids -#' , min_data = 1L -#' , learning_rate = 1.0 #' , early_stopping_rounds = 5L #' ) #' json_model <- lgb.dump(model) @@ -983,15 +995,18 @@ lgb.dump <- function(booster, num_iteration = NULL) { #' data(agaricus.test, package = "lightgbm") #' test <- agaricus.test #' dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -#' params <- list(objective = "regression", metric = "l2") +#' params <- list( +#' objective = "regression" +#' , metric = "l2" +#' , min_data = 1L +#' , learning_rate = 1.0 +#' ) #' valids <- list(test = dtest) #' model <- lgb.train( #' params = params #' , data = dtrain #' , nrounds = 5L #' , valids = valids -#' , min_data = 1L -#' , learning_rate = 1.0 #' ) #' #' # Examine valid data_name values diff --git a/R-package/R/lgb.cv.R b/R-package/R/lgb.cv.R index c011935080bc..81890a6a90c7 100644 --- a/R-package/R/lgb.cv.R +++ b/R-package/R/lgb.cv.R @@ -63,14 +63,17 @@ CVBooster <- R6::R6Class( #' data(agaricus.train, package = "lightgbm") #' train <- agaricus.train #' dtrain <- lgb.Dataset(train$data, label = train$label) -#' params <- list(objective = "regression", metric = "l2") +#' params <- list( +#' objective = "regression" +#' , metric = "l2" +#' , min_data = 1L +#' , learning_rate = 1.0 +#' ) #' model <- lgb.cv( #' params = params #' , data = dtrain #' , nrounds = 5L #' , nfold = 3L -#' , min_data = 1L -#' , learning_rate = 1.0 #' ) #' } #' @importFrom data.table data.table setorderv diff --git a/R-package/R/lgb.train.R b/R-package/R/lgb.train.R index 4d975687967d..6f602fe416a4 100644 --- a/R-package/R/lgb.train.R +++ b/R-package/R/lgb.train.R @@ -36,15 +36,18 @@ #' data(agaricus.test, package = "lightgbm") #' test <- agaricus.test #' dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -#' params <- list(objective = "regression", metric = "l2") +#' params <- list( +#' objective = "regression" +#' , metric = "l2" +#' , min_data = 1L +#' , learning_rate = 1.0 +#' ) #' valids <- list(test = dtest) #' model <- lgb.train( #' params = params #' , data = dtrain #' , nrounds = 5L #' , valids = valids -#' , min_data = 1L -#' , learning_rate = 1.0 #' , early_stopping_rounds = 3L #' ) #' } diff --git a/R-package/R/lgb.unloader.R b/R-package/R/lgb.unloader.R index a24f622cf787..443a0d1899e0 100644 --- a/R-package/R/lgb.unloader.R +++ b/R-package/R/lgb.unloader.R @@ -21,15 +21,18 @@ #' data(agaricus.test, package = "lightgbm") #' test <- agaricus.test #' dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -#' params <- list(objective = "regression", metric = "l2") +#' params <- list( +#' objective = "regression" +#' , metric = "l2" +#' , min_data = 1L +#' , learning_rate = 1.0 +#' ) #' valids <- list(test = dtest) #' model <- lgb.train( #' params = params #' , data = dtrain #' , nrounds = 5L #' , valids = valids -#' , min_data = 1L -#' , learning_rate = 1.0 #' ) #' #' lgb.unloader(restore = FALSE, wipe = FALSE, envir = .GlobalEnv) diff --git a/R-package/R/readRDS.lgb.Booster.R b/R-package/R/readRDS.lgb.Booster.R index df48d4807f2d..4844abeb3aa9 100644 --- a/R-package/R/readRDS.lgb.Booster.R +++ b/R-package/R/readRDS.lgb.Booster.R @@ -15,15 +15,18 @@ #' data(agaricus.test, package = "lightgbm") #' test <- agaricus.test #' dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -#' params <- list(objective = "regression", metric = "l2") +#' params <- list( +#' objective = "regression" +#' , metric = "l2" +#' , min_data = 1L +#' , learning_rate = 1.0 +#' ) #' valids <- list(test = dtest) #' model <- lgb.train( #' params = params #' , data = dtrain #' , nrounds = 10L #' , valids = valids -#' , min_data = 1L -#' , learning_rate = 1.0 #' , early_stopping_rounds = 5L #' ) #' model_file <- tempfile(fileext = ".rds") diff --git a/R-package/R/saveRDS.lgb.Booster.R b/R-package/R/saveRDS.lgb.Booster.R index 64b1f78ecc03..705cc266fcbb 100644 --- a/R-package/R/saveRDS.lgb.Booster.R +++ b/R-package/R/saveRDS.lgb.Booster.R @@ -26,15 +26,18 @@ #' data(agaricus.test, package = "lightgbm") #' test <- agaricus.test #' dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -#' params <- list(objective = "regression", metric = "l2") +#' params <- list( +#' objective = "regression" +#' , metric = "l2" +#' , min_data = 1L +#' , learning_rate = 1.0 +#' ) #' valids <- list(test = dtest) #' model <- lgb.train( #' params = params #' , data = dtrain #' , nrounds = 10L #' , valids = valids -#' , min_data = 1L -#' , learning_rate = 1.0 #' , early_stopping_rounds = 5L #' ) #' model_file <- tempfile(fileext = ".rds") diff --git a/R-package/man/lgb.cv.Rd b/R-package/man/lgb.cv.Rd index bec7d9ca4f50..bd098a81dbdc 100644 --- a/R-package/man/lgb.cv.Rd +++ b/R-package/man/lgb.cv.Rd @@ -159,14 +159,17 @@ Cross validation logic used by LightGBM data(agaricus.train, package = "lightgbm") train <- agaricus.train dtrain <- lgb.Dataset(train$data, label = train$label) -params <- list(objective = "regression", metric = "l2") +params <- list( + objective = "regression" + , metric = "l2" + , min_data = 1L + , learning_rate = 1.0 +) model <- lgb.cv( params = params , data = dtrain , nrounds = 5L , nfold = 3L - , min_data = 1L - , learning_rate = 1.0 ) } } diff --git a/R-package/man/lgb.dump.Rd b/R-package/man/lgb.dump.Rd index 6fbc5cbe9b43..c9b242a812e3 100644 --- a/R-package/man/lgb.dump.Rd +++ b/R-package/man/lgb.dump.Rd @@ -26,15 +26,18 @@ dtrain <- lgb.Dataset(train$data, label = train$label) data(agaricus.test, package = "lightgbm") test <- agaricus.test dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -params <- list(objective = "regression", metric = "l2") +params <- list( + objective = "regression" + , metric = "l2" + , min_data = 1L + , learning_rate = 1.0 +) valids <- list(test = dtest) model <- lgb.train( params = params , data = dtrain , nrounds = 10L , valids = valids - , min_data = 1L - , learning_rate = 1.0 , early_stopping_rounds = 5L ) json_model <- lgb.dump(model) diff --git a/R-package/man/lgb.get.eval.result.Rd b/R-package/man/lgb.get.eval.result.Rd index 917e0a403a18..cb54217bc42d 100644 --- a/R-package/man/lgb.get.eval.result.Rd +++ b/R-package/man/lgb.get.eval.result.Rd @@ -40,15 +40,18 @@ dtrain <- lgb.Dataset(train$data, label = train$label) data(agaricus.test, package = "lightgbm") test <- agaricus.test dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -params <- list(objective = "regression", metric = "l2") +params <- list( + objective = "regression" + , metric = "l2" + , min_data = 1L + , learning_rate = 1.0 +) valids <- list(test = dtest) model <- lgb.train( params = params , data = dtrain , nrounds = 5L , valids = valids - , min_data = 1L - , learning_rate = 1.0 ) # Examine valid data_name values diff --git a/R-package/man/lgb.load.Rd b/R-package/man/lgb.load.Rd index 4cdbf79fa988..55d241b2d670 100644 --- a/R-package/man/lgb.load.Rd +++ b/R-package/man/lgb.load.Rd @@ -26,15 +26,18 @@ dtrain <- lgb.Dataset(train$data, label = train$label) data(agaricus.test, package = "lightgbm") test <- agaricus.test dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -params <- list(objective = "regression", metric = "l2") +params <- list( + objective = "regression" + , metric = "l2" + , min_data = 1L + , learning_rate = 1.0 +) valids <- list(test = dtest) model <- lgb.train( params = params , data = dtrain , nrounds = 5L , valids = valids - , min_data = 1L - , learning_rate = 1.0 , early_stopping_rounds = 3L ) model_file <- tempfile(fileext = ".txt") diff --git a/R-package/man/lgb.save.Rd b/R-package/man/lgb.save.Rd index 9ac19eadb3fc..0736c26ab3f6 100644 --- a/R-package/man/lgb.save.Rd +++ b/R-package/man/lgb.save.Rd @@ -28,15 +28,18 @@ dtrain <- lgb.Dataset(train$data, label = train$label) data(agaricus.test, package = "lightgbm") test <- agaricus.test dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -params <- list(objective = "regression", metric = "l2") +params <- list( + objective = "regression" + , metric = "l2" + , min_data = 1L + , learning_rate = 1.0 +) valids <- list(test = dtest) model <- lgb.train( params = params , data = dtrain , nrounds = 10L , valids = valids - , min_data = 1L - , learning_rate = 1.0 , early_stopping_rounds = 5L ) lgb.save(model, tempfile(fileext = ".txt")) diff --git a/R-package/man/lgb.train.Rd b/R-package/man/lgb.train.Rd index 80a3ba84f101..4c8935df4f2d 100644 --- a/R-package/man/lgb.train.Rd +++ b/R-package/man/lgb.train.Rd @@ -144,15 +144,18 @@ dtrain <- lgb.Dataset(train$data, label = train$label) data(agaricus.test, package = "lightgbm") test <- agaricus.test dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -params <- list(objective = "regression", metric = "l2") +params <- list( + objective = "regression" + , metric = "l2" + , min_data = 1L + , learning_rate = 1.0 +) valids <- list(test = dtest) model <- lgb.train( params = params , data = dtrain , nrounds = 5L , valids = valids - , min_data = 1L - , learning_rate = 1.0 , early_stopping_rounds = 3L ) } diff --git a/R-package/man/lgb.unloader.Rd b/R-package/man/lgb.unloader.Rd index d3a0bbd01f74..5a07d3eb1e17 100644 --- a/R-package/man/lgb.unloader.Rd +++ b/R-package/man/lgb.unloader.Rd @@ -33,15 +33,18 @@ dtrain <- lgb.Dataset(train$data, label = train$label) data(agaricus.test, package = "lightgbm") test <- agaricus.test dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -params <- list(objective = "regression", metric = "l2") +params <- list( + objective = "regression" + , metric = "l2" + , min_data = 1L + , learning_rate = 1.0 +) valids <- list(test = dtest) model <- lgb.train( params = params , data = dtrain , nrounds = 5L , valids = valids - , min_data = 1L - , learning_rate = 1.0 ) lgb.unloader(restore = FALSE, wipe = FALSE, envir = .GlobalEnv) diff --git a/R-package/man/predict.lgb.Booster.Rd b/R-package/man/predict.lgb.Booster.Rd index d80515e99552..313d2dc7eb63 100644 --- a/R-package/man/predict.lgb.Booster.Rd +++ b/R-package/man/predict.lgb.Booster.Rd @@ -74,15 +74,18 @@ dtrain <- lgb.Dataset(train$data, label = train$label) data(agaricus.test, package = "lightgbm") test <- agaricus.test dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -params <- list(objective = "regression", metric = "l2") +params <- list( + objective = "regression" + , metric = "l2" + , min_data = 1L + , learning_rate = 1.0 +) valids <- list(test = dtest) model <- lgb.train( params = params , data = dtrain , nrounds = 5L , valids = valids - , min_data = 1L - , learning_rate = 1.0 ) preds <- predict(model, test$data) diff --git a/R-package/man/readRDS.lgb.Booster.Rd b/R-package/man/readRDS.lgb.Booster.Rd index add489441986..3592148ac128 100644 --- a/R-package/man/readRDS.lgb.Booster.Rd +++ b/R-package/man/readRDS.lgb.Booster.Rd @@ -26,15 +26,18 @@ dtrain <- lgb.Dataset(train$data, label = train$label) data(agaricus.test, package = "lightgbm") test <- agaricus.test dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -params <- list(objective = "regression", metric = "l2") +params <- list( + objective = "regression" + , metric = "l2" + , min_data = 1L + , learning_rate = 1.0 +) valids <- list(test = dtest) model <- lgb.train( params = params , data = dtrain , nrounds = 10L , valids = valids - , min_data = 1L - , learning_rate = 1.0 , early_stopping_rounds = 5L ) model_file <- tempfile(fileext = ".rds") diff --git a/R-package/man/saveRDS.lgb.Booster.Rd b/R-package/man/saveRDS.lgb.Booster.Rd index 76f1165f851b..02f5a715762c 100644 --- a/R-package/man/saveRDS.lgb.Booster.Rd +++ b/R-package/man/saveRDS.lgb.Booster.Rd @@ -50,15 +50,18 @@ dtrain <- lgb.Dataset(train$data, label = train$label) data(agaricus.test, package = "lightgbm") test <- agaricus.test dtest <- lgb.Dataset.create.valid(dtrain, test$data, label = test$label) -params <- list(objective = "regression", metric = "l2") +params <- list( + objective = "regression" + , metric = "l2" + , min_data = 1L + , learning_rate = 1.0 +) valids <- list(test = dtest) model <- lgb.train( params = params , data = dtrain , nrounds = 10L , valids = valids - , min_data = 1L - , learning_rate = 1.0 , early_stopping_rounds = 5L ) model_file <- tempfile(fileext = ".rds")