R-callbacks tests + other tests brushup

This commit is contained in:
Vadim Khotilovich
2016-06-09 02:53:37 -05:00
parent 2e0ffcc303
commit f34f9fb9f7
6 changed files with 372 additions and 61 deletions

View File

@@ -9,7 +9,7 @@ dtrain <- xgb.DMatrix(agaricus.train$data, label = agaricus.train$label)
dtest <- xgb.DMatrix(agaricus.test$data, label = agaricus.test$label)
bst <- xgboost(data = dtrain,
max.depth = 2,
max_depth = 2,
eta = 1,
nround = 10,
nthread = 1,
@@ -17,16 +17,14 @@ bst <- xgboost(data = dtrain,
objective = "binary:logistic")
test_that("call is exposed to R", {
model_call <- attr(bst, "call")
expect_is(model_call, "call")
expect_true(!is.null(bst$call))
expect_is(bst$call, "call")
})
test_that("params is exposed to R", {
model_params <- attr(bst, "params")
model_params <- bst$params
expect_is(model_params, "list")
expect_equal(model_params$eta, 1)
expect_equal(model_params$max.depth, 2)
expect_equal(model_params$max_depth, 2)
expect_equal(model_params$objective, "binary:logistic")
})