Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[R-package] fix warnings in unit tests #4225

Merged
merged 1 commit into from
Apr 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions R-package/tests/testthat/test_basic.R
Original file line number Diff line number Diff line change
Expand Up @@ -1582,9 +1582,6 @@ test_that("If first_metric_only is TRUE, lgb.cv() decides to stop early based on
, data = DTRAIN_RANDOM_REGRESSION
, nfold = nfolds
, nrounds = nrounds
, valids = list(
"valid1" = DVALID_RANDOM_REGRESSION
)
, eval = list(
.increasing_metric
, .constant_metric
Expand Down Expand Up @@ -1641,9 +1638,6 @@ test_that("early stopping works with lgb.cv()", {
, data = DTRAIN_RANDOM_REGRESSION
, nfold = nfolds
, nrounds = nrounds
, valids = list(
"valid1" = DVALID_RANDOM_REGRESSION
)
, eval = list(
.constant_metric
, .increasing_metric
Expand Down Expand Up @@ -1841,15 +1835,16 @@ test_that("lgb.train() works with linear learners, bagging, and a Dataset that h
test_that("lgb.train() works with linear learners and data where a feature has only 1 non-NA value", {
set.seed(708L)
.new_dataset <- function() {
values <- rep(NA_real_, 100L)
values[18L] <- rnorm(1L)
values <- c(rnorm(100L), rep(NA_real_, 100L))
values[118L] <- rnorm(1L)
X <- matrix(
data = values
, ncol = 1L
, ncol = 2L
)
return(lgb.Dataset(
data = X
, label = 2L * X + runif(nrow(X), 0L, 0.1)
, label = 2L * X[, 1L] + runif(nrow(X), 0L, 0.1)
, feature_pre_filter = FALSE
))
}

Expand Down Expand Up @@ -1888,7 +1883,7 @@ test_that("lgb.train() works with linear learners when Dataset has categorical f
, metric = "mse"
, seed = 0L
, num_leaves = 2L
, categorical_features = 1L
, categorical_feature = 1L
)

dtrain <- .new_dataset()
Expand Down