File: test_base_Learner_properties.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 1,281 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("Learner_properties", {
  lrn.char = "regr.glm"
  lrn = makeLearner(lrn.char)
  lrn.prop = getLearnerProperties(lrn)
  lrn.char.prop = getLearnerProperties(lrn.char)
  expect_equal(lrn.prop, lrn.char.prop)
  expect_equal(lrn.prop, c("numerics", "factors", "se", "weights"))

  lrn.wrap = makeImputeWrapper(lrn)
  expect_equal(getLearnerProperties(lrn.wrap), c(lrn.prop, "missings"))
})

test_that("listLearnerProperties", {
  regr = c("numerics", "factors", "ordered", "missings", "weights", "se",
    "featimp", "oobpreds", "functionals", "single.functional")
  expect_equal(listLearnerProperties("regr"), regr)
  classif = c("numerics", "factors", "ordered", "missings", "weights", "prob",
    "oneclass", "twoclass", "multiclass", "class.weights", "featimp", "oobpreds",
    "functionals", "single.functional")
  expect_equal(listLearnerProperties("classif"), classif)
  surv = c("numerics", "factors", "ordered", "missings", "weights", "prob", "lcens",
    "rcens", "icens", "featimp", "oobpreds", "functionals", "single.functional")
  expect_equal(listLearnerProperties("surv"), surv)
  cluster = c("numerics", "factors", "ordered", "missings", "weights", "prob",
    "functionals", "single.functional")
  expect_equal(listLearnerProperties("cluster"), cluster)
})