File: test_base_orderBMRLevels.R

package info (click to toggle)
r-cran-mlr 2.19.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,392 kB
  • sloc: ansic: 65; sh: 13; makefile: 5
file content (28 lines) | stat: -rwxr-xr-x 954 bytes parent folder | download | duplicates (2)
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

test_that("RankMatrix", {
  lrns = list(makeLearner("classif.nnet"), makeLearner("classif.rpart"))
  tasks = list(multiclass.task, binaryclass.task)
  rdesc = makeResampleDesc("CV", iters = 2L)
  meas = list(acc, mmce, ber, featperc)
  res = benchmark(lrns, tasks, rdesc, meas)

  # Create vector with learner.ids and task.ids
  lrn.id1 = c("classif.nnet", "classif.rpart")
  lrn.id2 = getBMRLearnerIds(res)[c(1L, 2L)]
  tsk.id1 = getBMRTaskIds(res)[c(1L, 2L)]

  # Test ordering Lrns
  # Test Class
  r1 = orderBMRLrns(res, order.lrns = lrn.id1)
  expect_s3_class(r1, "data.frame")
  r2 = orderBMRLrns(res, order.lrns = lrn.id2)
  expect_s3_class(r2, "data.frame")
  # Test constant dimensions
  expect_equal(dim(r1), dim(as.data.frame(res)))
  expect_equal(dim(r2), dim(as.data.frame(res)))

  # Test ordering Tsks
  r3 = orderBMRTasks(res, order.tsks = tsk.id1)
  expect_s3_class(r3, "data.frame")
  expect_equal(dim(r2), dim(as.data.frame(res)))
})