fix test
This commit is contained in:
parent
4554da0537
commit
5773d4d3c4
@ -2,19 +2,18 @@ require(xgboost)
|
|||||||
|
|
||||||
context("basic functions")
|
context("basic functions")
|
||||||
|
|
||||||
test_that("data loading", {
|
data(agaricus.train, package='xgboost')
|
||||||
data(agaricus.train, package='xgboost')
|
data(agaricus.test, package='xgboost')
|
||||||
data(agaricus.test, package='xgboost')
|
train = agaricus.train
|
||||||
})
|
test = agaricus.test
|
||||||
|
|
||||||
test_that("train and prediction",{
|
test_that("train and predict", {
|
||||||
train = agaricus.train
|
|
||||||
test = agaricus.test
|
|
||||||
bst = xgboost(data = train$data, label = train$label, max.depth = 2,
|
bst = xgboost(data = train$data, label = train$label, max.depth = 2,
|
||||||
eta = 1, nthread = 2, nround = 2, objective = "binary:logistic")
|
eta = 1, nthread = 2, nround = 2, objective = "binary:logistic")
|
||||||
pred = predict(bst, test$data)
|
pred = predict(bst, test$data)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
test_that("early stopping", {
|
test_that("early stopping", {
|
||||||
res = xgb.cv(data = train$data, label = train$label, max.depth = 2, nfold = 5,
|
res = xgb.cv(data = train$data, label = train$label, max.depth = 2, nfold = 5,
|
||||||
eta = 0.3, nthread = 2, nround = 20, objective = "binary:logistic",
|
eta = 0.3, nthread = 2, nround = 20, objective = "binary:logistic",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user