forked from mlr-org/mlr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_classif_randomUniformForest.R
29 lines (23 loc) · 1.16 KB
/
test_classif_randomUniformForest.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
test_that("classif_randomUniformForest", {
skip_on_travis() # FIXME: I dont know why this breaks on travis
requirePackages("randomUniformForest", default.method = "load")
parset.list = list(
list(ntree = 5, mtry = 4)
)
for (i in seq_along(parset.list)) {
parset = c(list(formula = binaryclass.formula, data = binaryclass.train, OOB = FALSE,
importance = FALSE, unsupervised = FALSE, threads = 1L), parset.list[[i]])
set.seed(getOption("mlr.debug.seed"))
capture.output({
m = do.call(randomUniformForest::randomUniformForest, parset)
})
old.predicts = predict(m, binaryclass.test)
lrn = do.call("makeLearner", c("classif.randomUniformForest", parset.list[[i]]))
set.seed(getOption("mlr.debug.seed"))
trained.mod = train(lrn, binaryclass.task, binaryclass.train.inds)
new.predicts = predict(trained.mod, binaryclass.task, subset = binaryclass.test.inds)$data$response
# randomUniformForest is such randomized that using the same seed will produce different results on
# the same data, see vignette("randomUniformForestsOverview") on page 22.
expect_true(length(old.predicts) == length(new.predicts))
}
})