Skip to content

Commit

Permalink
limit
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Sep 22, 2023
1 parent 8b21207 commit b7d5ffd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions R-package/tests/testthat/test_update.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ context("update trees in an existing model")

data(agaricus.train, package = 'xgboost')
data(agaricus.test, package = 'xgboost')

n_threads <- 1

dtrain <- xgb.DMatrix(
agaricus.train$data, label = agaricus.train$label, nthread = 2
agaricus.train$data, label = agaricus.train$label, nthread = n_threads
)
dtest <- xgb.DMatrix(
agaricus.test$data, label = agaricus.test$label, nthread = 2
agaricus.test$data, label = agaricus.test$label, nthread = n_threads
)

# Disable flaky tests for 32-bit Windows.
Expand All @@ -18,7 +21,7 @@ test_that("updating the model works", {

# no-subsampling
p1 <- list(
objective = "binary:logistic", max_depth = 2, eta = 0.05, nthread = 2,
objective = "binary:logistic", max_depth = 2, eta = 0.05, nthread = n_threads,
updater = "grow_colmaker,prune"
)
set.seed(11)
Expand Down Expand Up @@ -91,10 +94,10 @@ test_that("updating the model works", {

test_that("updating works for multiclass & multitree", {
dtr <- xgb.DMatrix(
as.matrix(iris[, -5]), label = as.numeric(iris$Species) - 1, nthread = 2
as.matrix(iris[, -5]), label = as.numeric(iris$Species) - 1, nthread = n_threads
)
watchlist <- list(train = dtr)
p0 <- list(max_depth = 2, eta = 0.5, nthread = 2, subsample = 0.6,
p0 <- list(max_depth = 2, eta = 0.5, nthread = n_threads, subsample = 0.6,
objective = "multi:softprob", num_class = 3, num_parallel_tree = 2,
base_score = 0)
set.seed(121)
Expand Down

0 comments on commit b7d5ffd

Please sign in to comment.