Skip to content

Commit

Permalink
Merge branch 'master' into Rinterface8
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb committed Apr 4, 2022
2 parents 2782379 + 3d620bf commit 42e660f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
10 changes: 9 additions & 1 deletion R-package/tests/testthat/test_Predictor.R
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,20 @@ test_that("predictions for regression and binary classification are returned as
data(mtcars)
X <- as.matrix(mtcars[, -1L])
y <- as.numeric(mtcars[, 1L])
dtrain <- lgb.Dataset(X, label = y, params = list(max_bins = 5L))
dtrain <- lgb.Dataset(
X
, label = y
, params = list(
max_bins = 5L
, min_data_in_bin = 1L
)
)
model <- lgb.train(
data = dtrain
, obj = "regression"
, nrounds = 5L
, verbose = VERBOSITY
, params = list(min_data_in_leaf = 1L)
)
pred <- predict(model, X)
expect_true(is.vector(pred))
Expand Down
9 changes: 7 additions & 2 deletions R-package/tests/testthat/test_basic.R
Original file line number Diff line number Diff line change
Expand Up @@ -1718,7 +1718,8 @@ test_that("lgb.train() works with integer, double, and numeric data", {
, label = y
, params = list(
objective = "regression"
, min_data = 1L
, min_data_in_bin = 1L
, min_data_in_leaf = 1L
, learning_rate = 0.01
, seed = 708L
)
Expand Down Expand Up @@ -2984,7 +2985,11 @@ test_that("lightgbm() accepts 'weight' and 'weights'", {
, weights = w
, obj = "regression"
, nrounds = 5L
, verbose = -1L
, verbose = VERBOSITY
, params = list(
min_data_in_bin = 1L
, min_data_in_leaf = 1L
)
)
expect_equal(model$.__enclos_env__$private$train_set$get_field("weight"), w)

Expand Down
22 changes: 18 additions & 4 deletions R-package/tests/testthat/test_lgb.Booster.R
Original file line number Diff line number Diff line change
Expand Up @@ -1273,10 +1273,17 @@ test_that("Booster's print, show, and summary work correctly", {

data("mtcars")
model <- lgb.train(
params = list(objective = "regression")
params = list(
objective = "regression"
, min_data_in_leaf = 1L
)
, data = lgb.Dataset(
as.matrix(mtcars[, -1L])
, label = mtcars$mpg)
, label = mtcars$mpg
, params = list(
min_data_in_bin = 1L
)
)
, verbose = VERBOSITY
, nrounds = 5L
)
Expand Down Expand Up @@ -1332,10 +1339,17 @@ test_that("Booster's print, show, and summary work correctly", {
test_that("LGBM_BoosterGetNumFeature_R returns correct outputs", {
data("mtcars")
model <- lgb.train(
params = list(objective = "regression")
params = list(
objective = "regression"
, min_data_in_leaf = 1L
)
, data = lgb.Dataset(
as.matrix(mtcars[, -1L])
, label = mtcars$mpg)
, label = mtcars$mpg
, params = list(
min_data_in_bin = 1L
)
)
, verbose = VERBOSITY
, nrounds = 5L
)
Expand Down

0 comments on commit 42e660f

Please sign in to comment.