Skip to content

Commit

Permalink
small tweaks to reduce verbosity.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfalbel committed Dec 26, 2021
1 parent c872c42 commit 2a38bea
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
5 changes: 3 additions & 2 deletions R/lightgbm.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/helper-model.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
17 changes: 0 additions & 17 deletions tests/testthat/test-lightgbm.R
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 2a38bea

Please sign in to comment.