From 2a38bea9260187dc69c2cb2452f6ca4ea150d96d Mon Sep 17 00:00:00 2001 From: Daniel Falbel Date: Sun, 26 Dec 2021 10:57:08 -0300 Subject: [PATCH] small tweaks to reduce verbosity. --- R/lightgbm.R | 5 +++-- tests/testthat/helper-model.R | 2 +- tests/testthat/test-lightgbm.R | 17 ----------------- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/R/lightgbm.R b/R/lightgbm.R index 61ea6f5..9631b5e 100644 --- a/R/lightgbm.R +++ b/R/lightgbm.R @@ -272,7 +272,7 @@ train_lightgbm <- function(x, y, max_depth = 17, num_iterations = 10, learning_r data = prepare_df_lgbm(x), label = y, categorical_feature = categorical_columns(x), - feature_pre_filter = FALSE + params = list(feature_pre_filter = FALSE) ) main_args <- list( @@ -345,7 +345,8 @@ predict_lightgbm_classification_raw <- function(object, new_data, ...) { #' @export predict_lightgbm_regression_numeric <- function(object, new_data, ...) { # train_colnames <- object$fit$.__enclos_env__$private$train_set$get_colnames() - p <- stats::predict(object$fit, prepare_df_lgbm(new_data), reshape = TRUE, predict_disable_shape_check=TRUE, ...) + p <- stats::predict(object$fit, prepare_df_lgbm(new_data), reshape = TRUE, + params = list(predict_disable_shape_check=TRUE), ...) p } diff --git a/tests/testthat/helper-model.R b/tests/testthat/helper-model.R index 42e833a..0403c2e 100644 --- a/tests/testthat/helper-model.R +++ b/tests/testthat/helper-model.R @@ -5,7 +5,7 @@ mtcars_class_binary$vs <- as.factor(mtcars$vs) expect_all_modes_works <- function(model, engine) { if(engine == "lightgbm") { - model <- parsnip::set_engine(model, engine, verbosity = -1L) + model <- parsnip::set_engine(model, engine, verbose = -1L) } else { model <- parsnip::set_engine(model, engine) } diff --git a/tests/testthat/test-lightgbm.R b/tests/testthat/test-lightgbm.R index cd1db6f..1309ffa 100644 --- a/tests/testthat/test-lightgbm.R +++ b/tests/testthat/test-lightgbm.R @@ -1,20 +1,3 @@ -test_that("simple test", { - - library(lightgbm) - data(agaricus.train, package='lightgbm') - train <- agaricus.train - dtrain <- lgb.Dataset(train$data, label = train$label) - model <- lgb.cv( - params = list( - objective = "regression" - , metric = "l2" - ) - , data = dtrain - ) - - expect_s3_class(model, "lgb.CVBooster") -}) - test_that("lightgbm", { model <- parsnip::boost_tree(mtry = 1, trees = 50, tree_depth = 15, min_n = 1)