Minor addition to R unit tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
context('Test poisson regression model')
|
||||
|
||||
require(xgboost)
|
||||
set.seed(1994)
|
||||
|
||||
test_that("poisson regression works", {
|
||||
data(mtcars)
|
||||
@@ -9,5 +10,5 @@ test_that("poisson regression works", {
|
||||
expect_equal(class(bst), "xgb.Booster")
|
||||
pred <- predict(bst,as.matrix(mtcars[, -11]))
|
||||
expect_equal(length(pred), 32)
|
||||
sqrt(mean( (pred - mtcars[,11]) ^ 2))
|
||||
})
|
||||
expect_equal(sqrt(mean( (pred - mtcars[,11]) ^ 2)), 1.16, tolerance = 0.01)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user