diff --git a/R-package/R/lgb.Booster.R b/R-package/R/lgb.Booster.R index e5b4c8001d40..99231cec7f73 100644 --- a/R-package/R/lgb.Booster.R +++ b/R-package/R/lgb.Booster.R @@ -36,7 +36,7 @@ Booster <- R6::R6Class( } train_set_handle <- train_set$.__enclos_env__$private$get_handle() params <- utils::modifyList(params, train_set$get_params()) - params_str <- .lgb_params2str(params = params) + params_str <- .params2str(params = params) # Store booster handle handle <- .Call( LGBM_BoosterCreate_R @@ -167,7 +167,7 @@ Booster <- R6::R6Class( params <- utils::modifyList(self$params, params) } - params_str <- .lgb_params2str(params = params) + params_str <- .params2str(params = params) self$restore_handle() @@ -586,7 +586,7 @@ Booster <- R6::R6Class( , predcontrib , start_iteration , num_iteration - , .lgb_params2str(params = params) + , .params2str(params = params) ) private$fast_predict_config <- list( diff --git a/R-package/R/lgb.Dataset.R b/R-package/R/lgb.Dataset.R index 2f5a488ac21c..ddc338d2cae3 100644 --- a/R-package/R/lgb.Dataset.R +++ b/R-package/R/lgb.Dataset.R @@ -191,7 +191,7 @@ Dataset <- R6::R6Class( } # Generate parameter str - params_str <- .lgb_params2str(params = private$params) + params_str <- .params2str(params = private$params) # Get handle of reference dataset ref_handle <- NULL @@ -589,8 +589,8 @@ Dataset <- R6::R6Class( tryCatch({ .Call( LGBM_DatasetUpdateParamChecking_R - , .lgb_params2str(params = private$params) - , .lgb_params2str(params = new_params) + , .params2str(params = private$params) + , .params2str(params = new_params) ) private$params <- new_params }, error = function(e) { diff --git a/R-package/R/lgb.Predictor.R b/R-package/R/lgb.Predictor.R index 17e0cb8f746d..3a411efd75ba 100644 --- a/R-package/R/lgb.Predictor.R +++ b/R-package/R/lgb.Predictor.R @@ -28,7 +28,7 @@ Predictor <- R6::R6Class( # Initialize will create a starter model initialize = function(modelfile, params = list(), fast_predict_config = list()) { - private$params <- .lgb_params2str(params = params) + private$params <- .params2str(params = params) handle <- NULL if (is.character(modelfile)) { diff --git a/R-package/R/utils.R b/R-package/R/utils.R index 6fc59cfcbc4a..1ac6f197ca77 100644 --- a/R-package/R/utils.R +++ b/R-package/R/utils.R @@ -19,7 +19,7 @@ ) } -.lgb_params2str <- function(params) { +.params2str <- function(params) { if (!identical(class(params), "list")) { stop("params must be a list") diff --git a/R-package/tests/testthat/test_dataset.R b/R-package/tests/testthat/test_dataset.R index 587d5154a581..a8585baa2621 100644 --- a/R-package/tests/testthat/test_dataset.R +++ b/R-package/tests/testthat/test_dataset.R @@ -206,7 +206,7 @@ test_that("lgb.Dataset: Dataset should be able to construct from matrix and retu , rawData , nrow(rawData) , ncol(rawData) - , lightgbm:::.lgb_params2str(params = list()) + , lightgbm:::.params2str(params = list()) , ref_handle ) expect_true(methods::is(handle, "externalptr")) diff --git a/R-package/tests/testthat/test_utils.R b/R-package/tests/testthat/test_utils.R index 1761f42c426c..898aed9b0915 100644 --- a/R-package/tests/testthat/test_utils.R +++ b/R-package/tests/testthat/test_utils.R @@ -1,12 +1,12 @@ -test_that(".lgb_params2str() works as expected for empty lists", { - out_str <- .lgb_params2str( +test_that(".params2str() works as expected for empty lists", { + out_str <- .params2str( params = list() ) expect_identical(class(out_str), "character") expect_equal(out_str, "") }) -test_that(".lgb_params2str() works as expected for a key in params with multiple different-length elements", { +test_that(".params2str() works as expected for a key in params with multiple different-length elements", { metrics <- c("a", "ab", "abc", "abcdefg") params <- list( objective = "magic" @@ -14,7 +14,7 @@ test_that(".lgb_params2str() works as expected for a key in params with multiple , nrounds = 10L , learning_rate = 0.0000001 ) - out_str <- .lgb_params2str( + out_str <- .params2str( params = params ) expect_identical(class(out_str), "character") @@ -24,8 +24,8 @@ test_that(".lgb_params2str() works as expected for a key in params with multiple ) }) -test_that(".lgb_params2str() passes through duplicated params", { - out_str <- .lgb_params2str( +test_that(".params2str() passes through duplicated params", { + out_str <- .params2str( params = list( objective = "regression" , bagging_fraction = 0.8